示例#1
0
        public void OnCommandMessage(IMessage msg, NetConnection conn)
        {
            var comm = (CommandMessage)msg;

            if (comm.Command != null)
            {
                var result = ServerPluginMgr.ParsePluginCommand(comm.Command);

                if (result != null)
                {
                    var rspMsg = new CommandMessageRsp()
                    {
                        PluginName  = result.PluginName,
                        MethodName  = result.MethodName,
                        RspType     = result.MethodReturnValue.DataType,
                    };

                    if (rspMsg.RspType == PluginMethodReturnValueType.StringDataType)
                    {
                        rspMsg.StringCommandRsp = result.MethodReturnValue.Data as string;
                    }
                    else if (rspMsg.RspType == PluginMethodReturnValueType.BinaryDataType)
                    {
                        rspMsg.BinaryCommandRsp = result.MethodReturnValue.Data as byte[];
                    }
                    else if (rspMsg.RspType == PluginMethodReturnValueType.PacketBinaryDataType)
                    {
                        var data = result.MethodReturnValue.Data as PluginMehtodReturnValuePacket;
                        if (data != null)
                        {
                            foreach (var obj in data.Packet)
                            {
                                client.SendMessage(new BinaryPacketMessage()
                                {
                                    Data        = obj.Data,
                                    MetaData    = obj.MetaData,
                                });
                            }
                        }
                        return;
                    }
                    client.SendMessage(rspMsg);
                }
            }
        }
示例#2
0
        public void OnCommandMessage(IMessage msg)
        {
            var comm = (CozyAnywhere.Protocol.Messages.CommandMessage)msg;

            if (comm.Command != null)
            {
                var result = ServerPluginMgr.ParsePluginCommand(comm.Command);

                if (result != null)
                {
                    var rspMsg = new CommandMessageRsp()
                    {
                        PluginName = result.PluginName,
                        MethodName = result.MethodName,
                        CommandRsp = result.MethodReturnValue,
                    };
                    client.SendMessage(rspMsg);
                }
            }
        }
示例#3
0
 private void OnProcessTerminate(CommandMessageRsp rsp)
 {
     if (rsp.RspType == CommandMessageRsp.StringDataType)
     {
         var result = JsonConvert.DeserializeObject<bool>(rsp.StringCommandRsp);
     }
 }
示例#4
0
 private void OnProcessEnum(CommandMessageRsp rsp)
 {
     if (rsp.RspType == CommandMessageRsp.StringDataType)
     {
         var list = JsonConvert.DeserializeObject<List<WinProcessModel>>(rsp.StringCommandRsp);
         if (ProcessCollection != null)
         {
             ProcessCollection.Clear();
             foreach (var obj in list)
             {
                 var process = Tuple.Create<uint, string>(obj.ProcessId, obj.Name);
                 ProcessCollection.Add(process);
             }
         }
     }
 }
示例#5
0
 private void OnFilePathExistResponse(CommandMessageRsp rsp)
 {
     if (rsp.RspType == CommandMessageRsp.StringDataType)
     {
         var result = JsonConvert.DeserializeObject<bool>(rsp.StringCommandRsp);
     }
 }
示例#6
0
 private void OnFileGetCurrentDirectory(CommandMessageRsp rsp)
 {
     if(rsp.RspType == CommandMessageRsp.StringDataType)
     {
         var result = JsonConvert.DeserializeObject<string>(rsp.StringCommandRsp);
         if(CurrentFilePathHandler != null)
         {
             CurrentFilePathHandler(this, new CurrentFilePathRefreshEventArgs(result));
         }
     }
 }
示例#7
0
        private void OnFileEnumResponse(CommandMessageRsp rsp)
        {
            if (rsp.RspType == CommandMessageRsp.StringDataType)
            {
                if (FileCollection != null)
                {
                    FileCollection.Clear();
                    var list = JsonConvert.DeserializeObject<List<WinFileModel>>(rsp.StringCommandRsp);
                    foreach (var obj in list)
                    {
                        FileCollection.Add(Tuple.Create<string, bool>(obj.Name, obj.IsFolder));
                    }
                }
            }

        }