예제 #1
0
        //폼실행시
        private void Form1_Load(object sender, EventArgs e)
        {
            checkAdmin();// 관리자권한 있는지 없는지 확인

               DirectoryInfo temp = new DirectoryInfo(@"C:\temp"); //환경설정 저장을 위한 폴더, 파일입출력
               if (temp.Exists == false)
               {
                   temp.Create();
               }

               try//환경설정을 가져옴
               {

                   FileStream fs = new FileStream(@"C:\temp\Config.txt", FileMode.Open);
                   StreamReader r = new StreamReader(fs);
                   while (!r.EndOfStream)
                   {
                       ConfigAlways.Add(r.ReadLine());
                   }
                   r.Close();
                   r.Dispose();

                   if (ConfigAlways[0].ToString() == "true")//프로세스 종료시 쿠키도 삭제 체크박스
                   {
                       child1.CkBox_OneClick.CheckState = CheckState.Checked;
                   }

                   if (ConfigAlways[1].ToString() == "true")//창 항상위 체크박스
                   {
                       child1.CkBox_Always.CheckState = CheckState.Checked;
                   }

               }

               catch
               {

               }

               try //예외처리목록을 가져옴
               {
                   FileStream fs3 = new FileStream(@"C:\temp\Config2.txt", FileMode.Open);
                   StreamReader r3 = new StreamReader(fs3);
                   while (!r3.EndOfStream)
                   {
                       child3.ListBox_Process.Items.Add(r3.ReadLine());
                   }
                   r3.Close();
               }

               catch//환경설정 파일이 없어서 못 가져올경우
               {
                   if (MessageBox.Show("프로그램을 초기실행시 환경설정을 진행해야합니다. 진행하시겠습니까?", "Config?", MessageBoxButtons.OKCancel) == DialogResult.OK)
                   {
                       child3 = new Form4(); //다시 인스턴스생성
                       child3.ShowDialog();//자식폼2 보여줌
                   }
               }
              /* 폰트 설정하면오류...
               PrivateFontCollection privateFonts = new PrivateFontCollection();
               privateFonts.AddFontFile("hanna.ttf");
               Font font = new Font(privateFonts.Families[0], 9f);
               Btn_AddFuction.Font = font;
               Btn_AllProcessKill.Font = font;
               Btn_DeleteCookie.Font = font;
               Btn_Exit.Font = font;
               Btn_SizeAdjust.Font = font;
               Btn_SelcetProcessKill.Font = font;
               Btn_Config.Font = font;
               Btn_Exception.Font = font;
            */

               if (Properties.Settings.Default.KeyHook == true) //설정값에 키보드 후킹이 true
               {
                   child1.CkBox_Keyboard.CheckState = CheckState.Checked; //설정값 체크
               }
               if (child1.CkBox_Keyboard.CheckState == CheckState.Checked)
               {
                   HookManager.KeyUp += HookManager_KeyUp;
               }

               else
               {
                   HookManager.KeyUp -= HookManager_KeyUp;

               }
        }
예제 #2
0
 //환경설정(예외파일exe)
 private void button3_Click(object sender, EventArgs e)
 {
     if (child3.IsDisposed) // 컨트롤이 죽었으면 ☆
     {
         child3 = new Form4(); // 다시 인스턴스생성
         child3.ShowDialog();//자식폼2 보여줌
     }
     else
     {
         child3.ShowDialog();//자식폼2 보여줌
     }
 }