Example #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProcessFileExtReg(true);

            VPN_Class VPN = new VPN_Class();

            while (true)
            {
                VPN.CMD_VPN_Instruction("VPN");

                if (!VPN.VPN_Start())
                {
                    if (MessageBox.Show("VPN 연결에 실패하였습니다. 다시시도 하시겠습니까?", "YesOrNo", MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        VPN.CMD_VPN_Instruction("VPN");
                        Application.ExitThread();
                        Environment.Exit(0); //완전종료
                    }
                }
                else
                {
                    break;
                }
            }

            bool isInner = VPN.Network_Position;

            //isInner = true;
            Application.Run(new MainForm(isInner, VPN.IsInnerClient_Id));//인자값 | 첫번째 : 내부 | 두번째 : 내부(사용자계정명) 외부(VPN 사용자 입력값)
        }
Example #2
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            VPNClass = new VPN_Class();
            //클라이언트 cid 서버로부터 받아오기
            //ClientID = "test1";
            string SendMsg = ClientID + "," + isInner;                             //아이디 + 내부 외부 보내서 외부면 vpn로그남김 (isInner bool형. 디버그했을때 실질적인 값 : true -> "True" | false -> "False")

            byte[] SendStringToByteGender = Encoding.UTF8.GetBytes(SendMsg);       // String -> bytes 변환
            mainSocket.CryptoSend(SendStringToByteGender, PacketType.Response);    //서버로 클라이언트 id 보냄
            blindClientCidPacket = mainSocket.CryptoReceive();                     // 서버로부터 cid받아옴
            byte[] data = BlindNetUtil.ByteTrimEndNull(blindClientCidPacket.data); // 넑값 지움
            byte[] tmp  = new byte[4];
            Array.Copy(data, 0, tmp, 0, data.Length);
            uint ClintCID = BitConverter.ToUInt32(tmp, 0);

            if (ClintCID == 0) //서버에서 아이디를 조회못했을때 0반환
            {
                MessageBox.Show("서버로부터 id를 받지 못하였거나 등록되지 않은 아이디입니다." + Environment.NewLine + "\t           관리자에게 문의하십시요.");
                mainSocket.Close();
                Application.Exit();
                return;
            }

            //각 기능 객체 및 Task 생성
            TaskScheduler scheduler = TaskScheduler.Default;

            token = new CancellationTokenSource();

            documentCenter = new Doc_Center(document_Center, isInner);
            documentCenter.Run();
            document_Center.docCenter = documentCenter;

            _ChatMain      = new ChatMain(ClintCID);
            _ChatMain.Dock = DockStyle.Fill;
            MainControlPanel.Controls.Add(_ChatMain);

            //Func
            chat  = new BlindChat(ClintCID, ref _ChatMain, this);
            tChat = Task.Factory.StartNew(() => chat.Run(), token.Token, TaskCreationOptions.LongRunning, scheduler);

            //ScreenLocking
            lockForm = new LockForm(isInner, ClientID);
            lockForm.connect();
            MessageBox.Show("락 연결!");

            deviceDriver  = new DeviceDriverHelper();
            tDeviceDriver = Task.Factory.StartNew(() => deviceDriver.Run(), token.Token, TaskCreationOptions.LongRunning, scheduler);
        }
Example #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            pictureBox_Loading.Image = Properties.Resources.Loading;
            panel1.BackColor         = Color.FromArgb(5, 102, 118);
            panel_Login.BackColor    = Color.FromArgb(5, 102, 118);
            panel_Connect.BackColor  = Color.FromArgb(5, 102, 118);
            panel_Connect.BackColor  = Color.FromArgb(5, 102, 118);
            VPN_ID.BackColor         = Color.FromArgb(5, 102, 118);
            VPN_PW.BackColor         = Color.FromArgb(5, 102, 118);
            VPN_Class VPN = new VPN_Class();

            VPN_ID.Focus();
            this.FormClosed                 += Vpn_Login_FormClosed; //폼 종료되는 것 연결
            pictureBox_Login.Click          += Vpn_Login_Button_Click;
            pictureBox_Exit.Click           += EXIT_button_Click;
            pictureBox_ConnectingExit.Click += VPNConnectingExitbutton_Click;
            if (VpnLoginCheck == true)//로그인 성공시 폼을 숨기고 다시 show 하는것이기때문에 로그인 성공했으면 결과값 남아있음.
            {
                Vpn_EventTimer.Start();
            }
        }