예제 #1
0
        bool findchrome = false; //크롬찾음

        #endregion Fields

        #region Constructors

        public Form1()
        {
            child1 = new Form2(); //자식폼1 생성(환경설정)
              child2 = new Form3(); //자식폼2 생성(선택종료)
              child3 = new Form4(); //자식폼3 생성(예외처리)
              child4 = new Form5(); //자식폼4 생성(부가기능)
              InitializeComponent();

              if (IsUserAdmin() == true) //관리자 계정이 확인되면 제목창 바꿈, 방패모양 제거
              {

              this.Text += " (Admin authorization Ok )";

              }
              else //관리자계정이 아닐경우 관리필요한 버튼에 방패모양 부여
              {
              this.Text += " (Admin authorization required)";
              AddShieldToButton(Btn_AllProcessKill);
              AddShieldToButton(Btn_SelcetProcessKill);
              AddShieldToButton(Btn_DeleteCookie);
              }
        }
예제 #2
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;

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