본문 바로가기

언어/C#

The log4net Tutorial: Logging in C# (hands-on from beginner to advanced) 더보기
LogString: A Simple C# 2 Application Event Logging Class 출처: https://www.codeproject.com/Articles/15364/LogString-A-Simple-C-Application-Event-Logging-C IntroductionWhen interfacing to real-world devices, it is typical to have one or more background processing tasks responsible for collecting data and/or controlling the devices. Monitoring these tasks can be done in a variety of ways, some of which can involve complex GUI components for status reporti.. 더보기
log관련 출처: https://stackoverflow.com/questions/2196097/elegant-log-window-in-winforms-c-sharp로그 수준에 따라 목록 상자에서 색상을 지원하며, RTF로 복사하기 위해 Ctrl + V와 Right-Click을 지원하고 다른 스레드에서 ListBox로 로깅을 처리합니다.ListBox에 보관 된 줄 수 (기본적으로 2000)와 생성자 오버로드 중 하나를 사용하여 메시지 형식을 재정의 할 수 있습니다. using System; using System.Drawing; using System.Windows.Forms; using System.Threading; using System.Text; namespace StackOverflow { public p.. 더보기
STREAMWRITER로 텍스트 로그 남기기 출처: http://hunit.tistory.com/348 프로그램을 개발할때 중요한건 로그를 남겨 오류를 확인해 보는 거죠~ 여러가지 방법이 있지만 잘 정리된 사이트를 찾기 힘들어 한번 정리해봅니다. 이번 포스팅에의 로그 남기기는 원하는 클래스안에 넣어서 사용하면 됩니다. StreamWriter writer = new StreamWriter( File.Open(파일경로, FileMode.Append)); TextWriterTraceListener listener = new TextWriterTraceListener(writer); Debug.Listeners.Add(listener); Debug.WriteLine(string.Format("{0} : " + "ERROR", DateTime.Now)); .. 더보기
Log4Net 사용법 출처: http://drt0927.tistory.com/7?category=682501 log4net 사용 관련 참고 사이트 : http://hind.pe.kr/1199log4net 설정 관련 참고 사이트 : http://egloos.zum.com/empty79/v/2956254 C#에서 logging을 할때 손쉽고 편하게 사용할 수 있는 라이브러리를 소개하려한다.Log4Net이라는 라이브러리 이다.이 라이브러리는 log4j라는 java라이브러리에서 따온것이라고 알고있다. log4net에 대한 자세한 내용은 홈페이지를 참조 바랍니다.https://logging.apache.org/log4net/ 1. 사용 방법 - Nuget으로 Log4Net을 검색하면 아파치 log4net이 제일 상위에 나타난다 "설치.. 더보기
ini file 사용법 출처: http://drt0927.tistory.com/8?category=682501 C# 응용 프로그램을 만들다보면 설정 파일이 필요한 경우가 있다.이때 ini file을 사용하면 간편하다. 물론 xml로 된 config file도 있지만 ini file이 직관적이고 수정하기 편하다.구글링을 해보면 C#에서 ini파일을 다루는 여러 내용들이 있지만, 효율적으로 ini file을 관리하고 수정이 용이하게 설명된 내용이 없어 직접 만든 내용을 공유하려 한다.그렇다고 내가 만든게 짱짱맨 이런 의미는 아니다. ini file의 구성은크게 section과 key로 나뉜다. 예를 들면 [Database]Address="localhost"Id="root" [User]Name="홍길동"Age="29" 이런 ini .. 더보기
C# Tutorials - Create Custom/Professional UI in WinForms app 더보기
참고사이트 https://docs.microsoft.com/ko-kr/dotnet/csharp/pattern-matching OpenCVSharp Template Matchinghttps://m.blog.naver.com/PostView.nhn?blogId=choihszg&logNo=120158087396&proxyReferer=https%3A%2F%2Fwww.google.co.kr%2F Rapid Object Detection in C#https://www.codeproject.com/Articles/826377/Rapid-Object-Detection-in-Csharp C# 듀랑고 매크로 예제완성 파일http://yc0345.tistory.com/220?category=154281 비활성 윈도우 화면 캡처하는 .. 더보기
Template Match Demo 출처: https://github.com/shimat/opencvsharp/issues/182 using static System.Console; using OpenCvSharp; using OpenCvSharp.Util; static void RunTemplateMatch(string reference, string template) { using (Mat refMat = new Mat(reference)) using (Mat tplMat = new Mat(template)) using (Mat res = new Mat(refMat.Rows - tplMat.Rows + 1, refMat.Cols - tplMat.Cols + 1, MatType.CV_32FC1)) { //Convert input imag.. 더보기
string format 출처: https://blog.naver.com/nezrats/220707731062 *소수점 자릿수를 제어하려면 형식 지정자 뒤에 원하는 자릿수를 기입하면 된다.(아래 고정 소수점 참고) 형식지정자종류예제출력C / c통화 Currency string.Format("{0:C}", 2.5);₩3 string.Format("{0:C}", -3.5);-₩4D / d10진법 Decimal string.Format("{0:D}", 00035);35E / e과학적지수 Scientific string.Format("{0:E}", 342);3.420000E+02F / f고정 소수점 Fixed-point string.Format("{0:F2}", 35.22));35.22 string.Format("{0:F0}", 35... 더보기