Example #1
0
 private static void Server_OnReceived(object sender, NetClientReceivedEventArgs <byte[]> e)
 {
     throw new NotImplementedException();
 }
Example #2
0
 static void server_OnReceived(object sender, NetClientReceivedEventArgs<byte[]> e)
 {
     lock(syncRoot)
     {
         Key = new byte[20];
         serialPort.SendByteArray(e.Data);
         //wait for key
         Thread.Sleep(settings.Freq);
         server.DispatchTo(e.Guid,Key);
     }
 }
Example #3
0
 private static void Server_OnReceived(object sender, NetClientReceivedEventArgs<byte[]> e)
 {
     throw new NotImplementedException();
 }
Example #4
0
 void onServerReceiveData(object sender, NetClientReceivedEventArgs<byte[]> e)
 {
     onReceiveData(e.Data);
 }
Example #5
0
        private void nS_OnReceived(object sender, NetClientReceivedEventArgs<byte[]> e)
        {

            bool canConnect  =true;

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                MainWindow mw = (MainWindow)Application.Current.MainWindow;
                canConnect = (bool)mw.canConnect.IsChecked;
            }));

            if (canConnect)
            {
                String by = System.Text.Encoding.UTF8.GetString(e.Data);
                by = by.Replace("\n", "");
                bool isSQ = false;

                string[] files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + "\\custom\\");
                string[] fl = new string[3];

                foreach (string item in files)
                {
                    fl = File.ReadAllText(item).Split('!');
                    if (fl[0] == by)
                        isSQ = true;
                }

                if (!isSQ)
                {
                    if (by.Contains("^"))
                        InputSimulator.SimulateKeyDown(VirtualKeyCode.LCONTROL);

                    if (by.Contains("+"))
                        InputSimulator.SimulateKeyDown(VirtualKeyCode.LSHIFT);

                    if (by.Contains("%"))
                        InputSimulator.SimulateKeyDown(VirtualKeyCode.MENU);

                    usesText = by.Contains("$");

                    by = by.Replace("^", "").Replace("+", "").Replace("%", "").Replace("$", "");

                    System.Windows.Forms.KeysConverter kc = new System.Windows.Forms.KeysConverter();
                    if (!usesText)
                    {
                        by = by.ToUpper();

                        bool isChar = false;

                        if (by == "TAB")
                        {
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.TAB);
                            isChar = true;
                        }
                        if (by == "ENTER")
                        {
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                            isChar = true;
                        }
                        if (by == "DEL")
                        {
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.BACK);
                            isChar = true;
                        }
                        if (by == "CLICK"){
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.LBUTTON);
                            isChar = true;
                        }
                        if (by == "CLICK2"){
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.RBUTTON);
                            isChar = true;
                        }
                        if (by == "SUPR"){
                            InputSimulator.SimulateKeyPress(VirtualKeyCode.DELETE);
                            isChar = true;
                        }

                        if(!isChar)
                            InputSimulator.SimulateKeyPress(getKey(by[0].ToString()));

                        int isFKey = 0;
                        for (int i = 1; i < 13; i++)
                            if (by.Contains("F" + i.ToString()))
                                isFKey = i;

                        if (isFKey != 0)
                        {
                            VirtualKeyCode KEY = (VirtualKeyCode)Convert.ToByte(isFKey + 111);
                            InputSimulator.SimulateKeyPress(KEY);
                        }
                    }
                    else
                    {
                        InputSimulator.SimulateTextEntry(by);
                        
                    }

                    Thread.Sleep(100);
                    InputSimulator.SimulateKeyUp(VirtualKeyCode.LCONTROL);
                    InputSimulator.SimulateKeyUp(VirtualKeyCode.LSHIFT);
                    InputSimulator.SimulateKeyUp(VirtualKeyCode.MENU);
                }
                else
                {
                    ProcessStartInfo start = new ProcessStartInfo();
                    start.Arguments = fl[2];
                    start.FileName = fl[1];
                    Process.Start(start);
                }
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    MainWindow mw = (MainWindow)Application.Current.MainWindow;
                    mw.appendConsole("[" + DateTime.Now.ToString() + "] " + by);
                }));
            }
        }
 static void server_OnReceived(object sender, NetClientReceivedEventArgs<NetObject> e)
 {
     Console.WriteLine("Server received");
 }
Example #7
0
 private void Server_OnReceived(object sender, NetClientReceivedEventArgs <string> e)
 {
     Console.WriteLine("< " + e.Data);
 }
Example #8
0
 protected virtual void OnReceivedHandler(NetClientReceivedEventArgs <TConnection> args) => OnReceived?.Invoke(args);