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); } } }
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); } } }
private void OnProcessTerminate(CommandMessageRsp rsp) { if (rsp.RspType == CommandMessageRsp.StringDataType) { var result = JsonConvert.DeserializeObject<bool>(rsp.StringCommandRsp); } }
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); } } } }
private void OnFilePathExistResponse(CommandMessageRsp rsp) { if (rsp.RspType == CommandMessageRsp.StringDataType) { var result = JsonConvert.DeserializeObject<bool>(rsp.StringCommandRsp); } }
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)); } } }
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)); } } } }