Esempio n. 1
0
        public void Pipe_Reader(NamedPipeServerStream server)
        {
            //int i = 0;

            var br = new BinaryReader(server);

            while (true)
            {
                try
                {
                    //i++;
                    var len = (int)br.ReadUInt32();
                    if (len == 0)
                    {
                        MessageBox.Show("Error");
                    }
                    var str = new string(br.ReadChars(len));    // Read string
                    if (str == "Logged In!")
                    {
                        Start_Explorer();
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker) delegate
                            {
                                this.Hide();
                                (new Form1()).ShowDialog();
                            });
                            break;
                        }
                    }

                    else
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker) delegate
                            {
                                MessageBox.Show(str);
                            });

                            this.Invoke((MethodInvoker) delegate
                            {
                                MessageBox.Show("Wrong User Name Or Password");
                                KBF_Activation_Delegate KBF = new KBF_Activation_Delegate(this.KBF_Activation);
                                this.Invoke(KBF);
                            });
                            break;
                        }
                    }
                }

                catch
                {
                    //MessageBox.Show("Error");
                }
            }

            //Pipe_Writer(server);
        }
Esempio n. 2
0
        public void Pipe_Reader(NamedPipeServerStream server)
        {
            //int i = 0;

            var br  = new BinaryReader(server);
            var str = "";

            while (true)
            {
                try
                {
                    //i++;
                    var len = (int)br.ReadUInt32();
                    if (len == 0)
                    {
                        str = new string(br.ReadChars(len)); // Read string
                    }
                    if (str == "OK")
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker) delegate
                            {
                                Close_Current_Form ccf = new Close_Current_Form(this.Close);
                                this.Invoke(ccf);
                            });
                            break;
                        }
                    }

                    else
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker) delegate
                            {
                                MessageBox.Show("NOTOK");
                            });

                            this.Invoke((MethodInvoker) delegate
                            {
                                MessageBox.Show("Wrong User Name Or Password");
                                KBF_Activation_Delegate KBF = new KBF_Activation_Delegate(this.KBF_Activation);
                                this.Invoke(KBF);
                            });
                            break;
                        }
                    }
                }

                catch
                {
                    //MessageBox.Show("Error");
                }
            }

            //Pipe_Writer(server);
        }
Esempio n. 3
0
        public void Pipe_Reader(NamedPipeServerStream server)
        {
            //int i = 0;

            var br = new BinaryReader(server);
            while (true)
            {
                try
                {
                    //i++;
                    var len = (int)br.ReadUInt32();
                    if (len == 0)
                        MessageBox.Show("Error");
                    var str = new string(br.ReadChars(len));    // Read string
                    if (str == "Logged In!")
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker)delegate
                            {
                                this.Hide();
                                (new Form1()).ShowDialog();
                            });
                            break;
                        }
                    }

                    else
                    {

                        if (this.InvokeRequired)
                        {
                             this.Invoke((MethodInvoker)delegate
                             {
                                 MessageBox.Show(str);

                             });

                            this.Invoke((MethodInvoker)delegate
                            {
                                MessageBox.Show("Wrong User Name Or Password");
                                KBF_Activation_Delegate KBF = new KBF_Activation_Delegate(this.KBF_Activation);
                                this.Invoke(KBF);

                            });
                            break;
                        }

                    }
                }

                catch
                {
                    //MessageBox.Show("Error");
                }

            }

            //Pipe_Writer(server);
        }
Esempio n. 4
0
        public void Pipe_Reader(NamedPipeServerStream server)
        {
            //int i = 0;

            var br = new BinaryReader(server);

            while (true)
            {
                try
                {
                    //i++;
                    var len = (int)br.ReadUInt32();
                    if (len == 0)
                        MessageBox.Show("len equals zero");

                    var str = new string(br.ReadChars(len));    // Read string
                    if (str == "OK")
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker)delegate
                            {
                                Close_Current_Form ccf = new Close_Current_Form(this.Close);
                                this.Invoke(ccf);
                            });
                            break;
                        }
                    }

                    else
                    {

                        if (this.InvokeRequired)
                        {

                            this.Invoke((MethodInvoker)delegate
                            {
                                MessageBox.Show("Wrong User Name Or Password");
                                KBF_Activation_Delegate KBF = new KBF_Activation_Delegate(this.KBF_Activation);
                                this.Invoke(KBF);

                            });
                            break;
                        }

                    }
                }

                catch
                {
                    //MessageBox.Show("Error");
                }

            }

            //Pipe_Writer(server);
        }
Esempio n. 5
0
        public void Pipe_Reader(NamedPipeServerStream server)
        {
            //int i = 0;

            var br = new BinaryReader(server);
            while (true)
            {
                try
                {
                    //i++;
                    var len = (int)br.ReadUInt32();
                    if (len == 0)
                        MessageBox.Show("Error");
                    var str = new string(br.ReadChars(len));    // Read string
                    if (str == "Logged In!")
                    {

                        //Start_Explorer();
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker)delegate
                            {

                                this.Hide();
                                (new Form1()).ShowDialog();
                            });
                            break;
                        }
                    }

                    else
                    {

                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker)delegate
                            {
                                GetProcessesByName kill = new GetProcessesByName(this.Killing_Python_Procsess);
                                this.Invoke(kill);

                            });

                             this.Invoke((MethodInvoker)delegate
                             {
                                 MessageBox.Show(str);
                                 progressBar1.Visible = false;
                                 button1.Visible = true;
                                 button3.Enabled = true;
                             });

                            this.Invoke((MethodInvoker)delegate
                            {
                                MessageBox.Show("Wrong User Name Or Password");
                                KBF_Activation_Delegate KBF = new KBF_Activation_Delegate(this.KBF_Activation);
                                this.Invoke(KBF);

                            });
                            continue;
                        }

                    }
                }

                catch
                {
                    //MessageBox.Show("Error");
                }

            }

            //Pipe_Writer(server);
        }
Esempio n. 6
0
        public void Pipe_Reader(NamedPipeServerStream server)
        {
            //int i = 0;

            var br = new BinaryReader(server);

            while (true)
            {
                try
                {
                    //i++;
                    var len = (int)br.ReadUInt32();
                    if (len == 0)
                    {
                        MessageBox.Show("Error");
                    }
                    var str = new string(br.ReadChars(len));    // Read string
                    if (str == "Logged In!")
                    {
                        //Start_Explorer();
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker) delegate
                            {
                                this.Hide();
                                (new Form1()).ShowDialog();
                            });
                            break;
                        }
                    }

                    else
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker) delegate
                            {
                                GetProcessesByName kill = new GetProcessesByName(this.Killing_Python_Procsess);
                                this.Invoke(kill);
                            });

                            this.Invoke((MethodInvoker) delegate
                            {
                                MessageBox.Show(str);
                                progressBar1.Visible = false;
                                button1.Visible      = true;
                                button3.Enabled      = true;
                            });

                            this.Invoke((MethodInvoker) delegate
                            {
                                MessageBox.Show("Wrong User Name Or Password");
                                KBF_Activation_Delegate KBF = new KBF_Activation_Delegate(this.KBF_Activation);
                                this.Invoke(KBF);
                            });
                            continue;
                        }
                    }
                }

                catch
                {
                    //MessageBox.Show("Error");
                }
            }

            //Pipe_Writer(server);
        }