public override bool ProcessCommand(byte[] buffer, int offset, int count) //处理分完包的数据,子类从这个方法继承 { RemoteStreamSocketCommand command = StrToCommand(m_incomingDataParser.Command); m_outgoingDataAssembler.Clear(); m_outgoingDataAssembler.AddResponse(); m_outgoingDataAssembler.AddCommand(m_incomingDataParser.Command); switch (command) { case RemoteStreamSocketCommand.FileExists: return(DoFileExists()); case RemoteStreamSocketCommand.OpenFile: return(DoOpenFile()); case RemoteStreamSocketCommand.SetSize: return(DoSetSize()); case RemoteStreamSocketCommand.GetSize: return(DoGetSize()); case RemoteStreamSocketCommand.SetPosition: return(DoSetPosition()); case RemoteStreamSocketCommand.GetPosition: return(DoGetPosition()); case RemoteStreamSocketCommand.Read: return(DoRead()); case RemoteStreamSocketCommand.Write: return(DoWrite(buffer, offset, count)); case RemoteStreamSocketCommand.Seek: return(DoSeek()); case RemoteStreamSocketCommand.CloseFile: return(DoCloseFile()); default: Program.Logger.Error("Unknow command: " + m_incomingDataParser.Command); return(false); } }
public override bool ProcessCommand(byte[] buffer, int offset, int count) //处理分完包的数据,子类从这个方法继承 { RemoteStreamSocketCommand command = StrToCommand(m_incomingDataParser.Command); m_outgoingDataAssembler.Clear(); m_outgoingDataAssembler.AddResponse(); m_outgoingDataAssembler.AddCommand(m_incomingDataParser.Command); if (command == RemoteStreamSocketCommand.FileExists) { return(DoFileExists()); } else if (command == RemoteStreamSocketCommand.OpenFile) { return(DoOpenFile()); } else if (command == RemoteStreamSocketCommand.SetSize) { return(DoSetSize()); } else if (command == RemoteStreamSocketCommand.GetSize) { return(DoGetSize()); } else if (command == RemoteStreamSocketCommand.SetPosition) { return(DoSetPosition()); } else if (command == RemoteStreamSocketCommand.GetPosition) { return(DoGetPosition()); } else if (command == RemoteStreamSocketCommand.Read) { return(DoRead()); } else if (command == RemoteStreamSocketCommand.Write) { return(DoWrite(buffer, offset, count)); } else if (command == RemoteStreamSocketCommand.Seek) { return(DoSeek()); } else if (command == RemoteStreamSocketCommand.CloseFile) { return(DoCloseFile()); } else { Logger.Instance().Error("Unknow command: " + m_incomingDataParser.Command); return(false); } }