Esempio n. 1
0
        public static byte[] ExecuteInstructionsCode(InstructionsInfo insCode, ControlItemConfiguration config)
        {
            byte[] result = null;

            OneLevelCode     lv      = (OneLevelCode)insCode.LevelOneCode;
            InstructionsCode invoker = null;

            switch (lv)
            {
            case OneLevelCode.MOUSE_AND_KEYBOARD:
                invoker = kic;
                break;

            case OneLevelCode.IMAGE_SEND:
                invoker = siic;
                break;

            case OneLevelCode.SYSTEM_OP:
                invoker = soic;
                break;
            }
            if (invoker != null)
            {
                if (insCode.Direct != 0)
                {
                    config.ReportClient.SendPacket((byte)insCode.Direct, config.Id, 0);
                }
                result = invoker.Execute(insCode, config);
            }
            return(result);
        }
        private void CommandControlListen(Object obj)
        {
            Socket svr = obj as Socket;

            EndPoint tp = new IPEndPoint(IPAddress.Parse(this.config.TargetAddress), 0);

            if (svr != null)
            {
                while (true)
                {
                    try
                    {
                        int len   = svr.ReceiveFrom(udpBuffer, ref tp);
                        var iinfo = InstructionsInfo.Parse(udpBuffer);
                        InstructionsCode.ExecuteInstructionsCode(iinfo, this.config);
                    }
                    catch (Exception)
                    {
                        //Console.WriteLine(ex.Message);
                    }
                }
            }
        }