public void SendName(string name) { MemoryByteStream bs = new MemoryByteStream(); bs.Write(_idName); bs.Write(name); SendMessage(bs.AsBytes()); }
public void SendPing(bool response, UInt64 id) { MemoryByteStream bs = new MemoryByteStream(); bs.Write(_idPing); bs.Write(response); bs.Write(id); SendMessage(bs.AsBytes()); }
static public void AvailableMachinesToBytes(MemoryByteStream stream, IEnumerable <string> machines) { int count = machines.Count(); stream.Write(count); for (int i = 0; i < count; i++) { stream.Write(machines.ElementAt(i)); } }
public void SendSelectMachine(string machineName) { MemoryByteStream bs = new MemoryByteStream(); bs.Write(_idSelectMachine); Serializer.SelectMachineToBytes(bs, machineName); SendMessage(bs.AsBytes()); }
public void SendCoreAction(CoreAction coreAction) { MemoryByteStream bs = new MemoryByteStream(); bs.Write(_idCoreAction); Serializer.CoreActionToBytes(bs, coreAction); SendMessage(bs.AsBytes()); }
public void SendCoreRequest(CoreRequest coreRequest) { MemoryByteStream bs = new MemoryByteStream(); bs.Write(_idCoreRequest); Serializer.CoreRequestToBytes(bs, coreRequest); SendMessage(bs.AsBytes()); }
public void SendAvailableMachines(IEnumerable <string> availableMachines) { MemoryByteStream bs = new MemoryByteStream(); bs.Write(_idAvailableMachines); Serializer.AvailableMachinesToBytes(bs, availableMachines); SendMessage(bs.AsBytes()); }
static public void CoreRequestToBytes(MemoryByteStream stream, CoreRequest request) { switch (request.Type) { case CoreRequest.Types.KeyPress: stream.Write(_coreActionKeyPress); stream.Write(request.KeyCode); stream.Write(request.KeyDown); break; case CoreRequest.Types.Reset: stream.Write(_coreActionReset); break; case CoreRequest.Types.LoadDisc: stream.Write(_coreActionLoadDisc); stream.Write(request.Drive); stream.WriteArray(request.MediaBuffer.GetBytes()); break; case CoreRequest.Types.LoadTape: stream.Write(_coreActionLoadTape); stream.WriteArray(request.MediaBuffer.GetBytes()); break; case CoreRequest.Types.RunUntil: stream.Write(_coreActionRunUntil); stream.Write(request.StopTicks); break; case CoreRequest.Types.LoadCore: stream.Write(_coreActionLoadCore); stream.WriteArray(request.CoreState.GetBytes()); break; case CoreRequest.Types.CoreVersion: stream.Write(_coreActionCoreVersion); stream.Write(request.Version); break; case CoreRequest.Types.CreateSnapshot: stream.Write(_coreActionCreateSnapshot); stream.Write(request.SnapshotId); break; case CoreRequest.Types.DeleteSnapshot: stream.Write(_coreActionDeleteSnapshot); stream.Write(request.SnapshotId); break; case CoreRequest.Types.RevertToSnapshot: stream.Write(_coreActionRevertToSnapshot); stream.Write(request.SnapshotId); break; default: throw new Exception(String.Format("Unknown CoreRequest type {0}!", request.Type)); } }
static public void SelectMachineToBytes(MemoryByteStream stream, string machineName) { stream.Write(machineName); }