private void MainForm_Load(object sender, EventArgs e) { this.FormClosed += MainForm_FormClosed; //폼 종료되는 것 연결 if (!BlindNetUtil.IsConnectedInternet()) { MessageBox.Show("There is no internet connection", "확인", MessageBoxButtons.OK); Close(); } bool result = mainSocket.ConnectWithECDH(); if (!result) { MessageBox.Show("Main socket connection failed.", "확인", MessageBoxButtons.OK); Close(); } //단축키&타이머 등록 BlindLockTimer.Enabled = true; RegisterHotKey(this.Handle, 0, KeyModifiers.Windows, Keys.L); RegisterHotKey(this.Handle, 1, KeyModifiers.Alt, Keys.L); ActivateControl(MainControl.Document); }
static void Main(string[] args) { Console.WriteLine("Well Come to Console \r\n\r\n"); if (!BlindNetUtil.IsConnectedInternet()) { Console.WriteLine("There is no internet connection"); Environment.Exit(0); } bool result = MainSocket.ConnectWithECDH(BlindNetConst.ServerIP, BlindNetConst.WebInterlockPort); if (!result) { Console.WriteLine("Main socket connection failed."); Environment.Exit(0); } Console.WriteLine("Main Server Connection. (Server IP : " + BlindNetConst.ServerIP + ")\r\n"); while (true) { //받기 -> 명령문 실행 -> 결과(Result) 스트링 전송) MainPacket = MainSocket.CryptoReceive(); //타입 + 아이디 + 비번 정보 받음 Console.Write("Server Message Receive Waiting"); //MainPacket.data = BlindNetUtil.ByteTrimEndNull(MainPacket.data); // ReceiveByteToStringGenderText = Encoding.Default.GetString(BlindNetUtil.ByteTrimEndNull(MainPacket.data)); //변환해서 ㅓㄶ음 Console.WriteLine("Receive Message : " + ReceiveByteToStringGenderText); if (CMD_Instruction(ReceiveByteToStringGenderText)) // 명령문 전달해서 실행 { Result = "true"; } else { Result = "false"; } MainSocket.CryptoSend(Encoding.UTF8.GetBytes(Result), PacketType.Response); // 결과 전송 Console.WriteLine("Send Message | Instruction Result = " + Result + "\r\n"); } }