C# - 시스템 프로그래밍

다른 프로세스 실행 System.Diagnostics.Process.Start("실행파일경로\실행파일명.exe",파라메터) System.Diagnostics.Process.Start("cmd.exe 명령어"); 프로세스 종료 System.Diagnostics.Close(); // 프로세스의 리소스를 해재(종료) 시킨다. System.Diagnostics.CloseMainWindow(); // UI가 있는 프로세스에 메시지를 보내 종료 시킨다. System.Diagnostics.Kill(); // 즉시 프로세스를 종료시킨다. 프로세스 실행 후 종료까지 대기 System.Diagnostics.Process p = System.Diagnostics.Process.Start("C:\\test.txt"); p.WaitForExit(); //혹은 시간으로...
더 읽기

C# - SharpZipLib을 사용한 복수 개의 파일 압축 및 해제

SharpZipLib : http://icsharpcode.net/OpenSource/SharpZipLib/Default.aspx // 압축 void Compression() { try { string zipPath = "test.zip"; System.IO.FileStream writer = new System.IO.FileStream( zipPath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Write); ICSharpCode.SharpZipLib.Zip.ZipOutputStream zos = new ICSharpCode.SharpZipLib.Zip.ZipOutputStream(writer); foreach (string file in DiffFiles) { int Substringindex = textBox2.Text.Length; string f...
더 읽기

C# - Timer

DispatcherTimer 일반 타이머는 메인 스레드가 아닌 다른 스레드를 만들어서 처리 되지만 이것은 실행은 메인 스레드에서 처리 되어 메인 스레드와 동기화가 보장 된다. MSDN의 설명 각 Dispatcher 루프의 맨 위에서 DispatcherTimer가 다시 평가됩니다. 시간 간격이 발생할 때 정확하게 타이머가 실행될지 보장할...
더 읽기

C# - SmtpClient로 메일 보내기

닷넷의 SmtpClient 클래스를 사용하여 메일을 보내는 방법이다. MSDN의 예제는 빠진 부분이 많아서 그걸 사용하면 제대로 되지 않았다. 삽질하다가 구글링으로 알아냈다. 아래 예제는 구글의 Gmail을 사용하는 것으로 했다. Gmail의 주소는 smtp.gmail.com 이다. 포트번호는 587을 사용한다. 구글에서는 465도 사용 할수 있다고 하지만...
더 읽기

C# - WPF - 멀티 스레드에서 컨트롤 조작

from : MSDN // 아래의 예는 리스트박스에 새로운 데이터를 추가하는 것이다. private delegate void ListBoxDelegate(string arg); void SetStateText(string state) { this.listBox1.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new ListBoxDelegate(UpdateListBox), state); } private void UpdateListBox(string state) { this.listBox1.Items.Add(state); } // 메인 스레드가 아닌 곳에서는 SetStateText(string state)을...
더 읽기

C# - 다중 스레드에서 컨트롤을 변경 할 때

출처: MSDN // 델리게이트를 선언한다. delegate void SetTextCallback(string text); // 컨트롤의 접근은 따로 함수를 만들어서 접근하도록 한다. private void SetText(string text) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the...
더 읽기

C# - 문자열

지정 단어로 문자열 분해 string readLine = "A=B"; string[] word = readLine.Split(new Char[] { '=' }); 문자열 포맷 string CheatString = string.Format("@timeevent1:{0}", textBoxBlessing.Text); 지정된 단어를 문자열에서 (제일 처음 나오는)제거 하고 싶을 때 string str1 = "C:\ASDD"; string str2 = "C:\ASDD\Server.exe";...
더 읽기

C# - 파일 조작

클래스 단위로 파일에 쓰기 이 직렬화 방식은 꼭 .NET 플랫폼에서 서로 파일을 읽고 쓸 때만 사용 가능하다. 만약 .NET으로 만든 프로그램에서 아래와 같이 파일을 만들고 이것을 네이티브에서 읽으면 앞에 다른 값이 들어가 있다( 정확하게는 직렬화 되는 클래스의 메타 정보가 들어가...
더 읽기

C# - json 데이터 암호화, 복호화 하기

AESEncrypt로 암호화/복호화 하기 public static async Task<RESULT_T> RequestHttpAESEncry<REQUEST_T, RESULT_T>( string address, string reqAPI, string loginSeq, string userID, REQUEST_T reqPacket) where RESULT_T : new() { var resultData = new RESULT_T(); var api = "http://" + address + "/GameService/" + reqAPI; var...
더 읽기

코딩용 폰트

CodingFont - 자신에게 맞는 코딩 폰트를 찾는 게임 MonoLisa - 개발자를 위한 고정폭 폰트 (monolisa.dev) https://monolisa.dev/ 눈이 편하게 폭이 넓음 C와G, IL1, 0OØ 등에 확실한 차이를 둠 읽기 편한 선의 흐름 글자 흑백 공간의 조화 전혀 느낌이 다른 이탤릭체 Ligatures...
더 읽기