오늘 프로그램 작성하다 문득 DB작업과 일반 어플을 병행하다 보면 포맷지정같이 비슷하지만 조금씩 다른 부분을 보고 정리가 필요하다란 생각이 들어 블로깅을 정리해 본다.
순서는 내 마음대로 향후 계속적으로 업데이트 하는걸로...

1. 날짜형식 처리
 > DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") // 2010-03-03 18:16:30

2. 레지스트리 읽기 및 쓰기
 > RegistryKey RegDAtakey = Registry.LocalMachine.CreateSubKey("Software").CreateSubKey("REG_TEST");
 > RegDAtakey.SetValue("STRING_NAME", "VALUE"); // 쓰기
 > RegDAtakey.GetValue("STRING_NAME") as string; // 읽기

3. 파일 읽기 쓰기
            string path = @"c:\1.ini";

            if (File.Exists(path))
            {
                //File.Delete(path);
            }

            //using (StreamWriter sw = new StreamWriter(path))
            //{
            //    sw.WriteLine("This");
            //    sw.WriteLine("is some text");
            //    sw.WriteLine("to test");
            //    sw.WriteLine("Reading");
            //}

            using (StreamReader sr = new StreamReader(path))
            {
                while (sr.Peek() >= 0)
                {
                    MessageBox.Show(sr.ReadLine());
                    //Console.WriteLine(sr.ReadLine());
                }
            }

4. 문자열(split) 처리
     string[] sPrtStr01 = new string[6];
     sPrtStr01 = str.ReadLine().Split('^');   // str = "a^b^c^d^e^f";

>>> [작성일시] 2010-03-03 오후 6:31:18

5. 포함 문자열(IndexOf) 처리
   int result1 = 0;
   result1 = str.IndexOf("/");   // str = "OK/NG";
   if (result1 != -1)   // '/' 포함이 돼 있으면
   {
      // 포함
   }

>>> [작성일시] 2010-03-04 오전 9:00:32

6. goto문
 > 초등학교 컴퓨터학원 다닐때 GW-BASIC 했던 생각난다. ^^

       Image GetImageFromFile = null;
       if (this.mUseXPDF & ImageUtil.IsPDF(sFileName))
       {
           try
           {
               GetImageFromFile = AFPDFLibUtil.GetImageFromPDF(ref this.mPDFDoc, iFrameNumber + 1, DPI);
           }
           catch
           {
               this.InitBottomToolbar("GS");
               goto Label_004E;
           }
           goto Label_0080;
       }
   Label_004E:
       if (ImageUtil.IsPDF(sFileName))
       {
           GetImageFromFile = PDFConvert.GetPageFromPDF(sFileName, iFrameNumber + 1, DPI, this.mPassword, false);
       }
       else if (ImageUtil.IsTiff(sFileName))
       {
           GetImageFromFile = ImageUtil.GetFrameFromTiff(sFileName, iFrameNumber);
       }
   Label_0080:
       if (mRotation != null)
       {
           ImageUtil.ApplyRotation(ref GetImageFromFile, this.mRotation[iFrameNumber]);
       }
       return GetImageFromFile;

>>> [작성일시] 2010-03-04 오후 4:34:54


WRITTEN BY
테네시왈츠
항상 겸손하게 항상 새롭게 항상 진실하게

,