예제 #1
0
        public void SendName(string name)
        {
            MemoryByteStream bs = new MemoryByteStream();

            bs.Write(_idName);
            bs.Write(name);

            SendMessage(bs.AsBytes());
        }
예제 #2
0
        public void SendPing(bool response, UInt64 id)
        {
            MemoryByteStream bs = new MemoryByteStream();

            bs.Write(_idPing);
            bs.Write(response);
            bs.Write(id);

            SendMessage(bs.AsBytes());
        }
예제 #3
0
파일: Serializer.cs 프로젝트: alybaek2/cpvc
        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));
            }
        }
예제 #4
0
        public void SendSelectMachine(string machineName)
        {
            MemoryByteStream bs = new MemoryByteStream();

            bs.Write(_idSelectMachine);
            Serializer.SelectMachineToBytes(bs, machineName);

            SendMessage(bs.AsBytes());
        }
예제 #5
0
        public void SendCoreAction(CoreAction coreAction)
        {
            MemoryByteStream bs = new MemoryByteStream();

            bs.Write(_idCoreAction);
            Serializer.CoreActionToBytes(bs, coreAction);

            SendMessage(bs.AsBytes());
        }
예제 #6
0
        public void SendCoreRequest(CoreRequest coreRequest)
        {
            MemoryByteStream bs = new MemoryByteStream();

            bs.Write(_idCoreRequest);
            Serializer.CoreRequestToBytes(bs, coreRequest);

            SendMessage(bs.AsBytes());
        }
예제 #7
0
        public void SendAvailableMachines(IEnumerable <string> availableMachines)
        {
            MemoryByteStream bs = new MemoryByteStream();

            bs.Write(_idAvailableMachines);
            Serializer.AvailableMachinesToBytes(bs, availableMachines);

            SendMessage(bs.AsBytes());
        }
예제 #8
0
파일: Serializer.cs 프로젝트: alybaek2/cpvc
        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));
            }
        }
예제 #9
0
파일: Serializer.cs 프로젝트: alybaek2/cpvc
 static public void SelectMachineToBytes(MemoryByteStream stream, string machineName)
 {
     stream.Write(machineName);
 }