public static void Handle(NetworkMessage message) { //UnityEngine.Debug.Log("handling "+ message.typeName); INetworkCommand cmd = ConvertToCommand(message); QueueCommand(cmd, message.typeName); }
private async Task Process() { INetworkCommand networkCommand = await Receive(); networkCommand.Transport = () => Task.FromResult(Socket); await networkCommand.ServerSideSetup(this); await networkCommand.ExecuteOnServer();//.ExecuteSyncronizedCommand(); }
public bool Equals(INetworkCommand networkCommand) { if (!(networkCommand is FileOpenReadNetworkCommand)) { return(false); } FileOpenReadNetworkCommand other = (FileOpenReadNetworkCommand)networkCommand; return(EntryFullPath.Equals(other.EntryFullPath)); }
public bool Equals(INetworkCommand networkCommand) { if (!(networkCommand is ChildEntriesRequestNetworkCommand)) { return(false); } ChildEntriesRequestNetworkCommand other = (ChildEntriesRequestNetworkCommand)networkCommand; return(EntryFullPath.Equals(other.EntryFullPath)); }
public bool Equals(INetworkCommand networkCommand) { if (!(networkCommand is EntryGetNetworkCommand)) { return(false); } EntryGetNetworkCommand other = (EntryGetNetworkCommand)networkCommand; return(EntryFullPath.Equals(other.EntryFullPath)); }
public bool Equals(INetworkCommand networkCommand) { if (!(networkCommand is CreateEntryRequestNetworkCommand <T>)) { return(false); } CreateEntryRequestNetworkCommand <T> other = (CreateEntryRequestNetworkCommand <T>)networkCommand; return(ParentPath.Equals(other.ParentPath) && DocumentName.Equals(other.DocumentName)); }
public static async Task ExecuteClientSyncronizedCommand(this INetworkCommand command, JsonSerializer serializer, Func <Task <WebSocket> > transport) { string serializedJob; using (StringWriter send = new StringWriter()) { using (JsonWriter jw = new JsonTextWriter(send)) { serializer.Serialize(jw, command); serializedJob = send.ToString(); } } SendString sendString = new SendString(serializedJob, new SendBytes(transport)); await sendString.AwaitFlowControl(); await command.ExecuteOnClient();//.ExecuteSyncronizedCommand(); }
////////////////////////////////////////////////////////////////////////////////////////////////// public static INetworkCommand[] GetCommandsFromStream(MyBitStream stream) { int count = (int)(stream.ReadByte()); INetworkCommand[] commands = new INetworkCommand[count]; for (int i = 0; i < count; i++) { byte commandType = stream.ReadByte(); switch ((CommandTypes)commandType) { case CommandTypes.disconnectRequest: commands[i] = new DisconnectRequestCommand(); break; default: break; } } return(commands); }
public void HandleInput(INetworkCommand command, bool shouldShare) { HandleInput(command.ToSerializable(shouldShare)); }
public void OnlyShare(INetworkCommand command) { OnlyShare(command.ToSerializable(true)); }