Ejemplo n.º 1
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write((byte)Status);
     writer.Write(ExitCode);
     writer.Write(Stdout);
     writer.Write(Stderr);
     writer.Write(ExecutionTime);
 }
Ejemplo n.º 2
0
 public void Serialize(IPCWriter writer)
 {
     writer.WriteLengthPrefixedArray(FilePath);
     writer.Write(BinaryOutput);
     writer.Write(ByteOffset);
     writer.Write(ByteCount);
     writer.Write(OutputOffset);
 }
Ejemplo n.º 3
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write(WorkingDirectory);
     writer.Write(Executable);
     writer.Write(Arguments);
     writer.Write(RunAsAdministrator);
     writer.Write(ExecutionTimeoutSecs);
 }
Ejemplo n.º 4
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write7BitEncodedInt(Files.Length);
     foreach (var file in Files)
     {
         writer.Write(file.RelativePath);
         writer.Write(file.Size);
         writer.Write(file.LastWriteTimeUtc);
     }
 }
Ejemplo n.º 5
0
        void GetChannels(IPCReceiver receiver, IPCReader data, SyncHandler sync)
        {
            var channels = sync.GetAllChannels();
            var packet   = new IPCWriter(IPC.ChannelList);

            packet.Write(channels.Count);           // server count

            foreach (var server in channels)
            {
                packet.Write((int)server.Key);      // server id
                packet.Write(server.Value.Count);   // channel count

                foreach (var channel in server.Value)
                {
                    packet.Write(channel.Value.id);
                    packet.Write(channel.Value.type);
                    packet.Write((int)channel.Value.ip);
                    packet.Write(channel.Value.port);
                    packet.Write(channel.Value.maxPlayers);
                    packet.Write(channel.Value.curPlayers);
                }
            }

            receiver.Send(packet);
        }
Ejemplo n.º 6
0
        public static void WriteResponse(this IPCWriter writer, IResponse response)
        {
            ResponseType type;

            switch (response)
            {
            case ExecutionCompleted _: type = ResponseType.ExecutionCompleted; break;

            case MetadataFetched _: type = ResponseType.MetadataFetched; break;

            case ResultRangeFetched _: type = ResponseType.ResultRangeFetched; break;

            case EnvironmentVariablesListed _: type = ResponseType.EnvironmentVariablesListed; break;

            case PutFileResponse _: type = ResponseType.PutFile; break;

            case PutDirectoryResponse _: type = ResponseType.PutDirectory; break;

            case ListFilesResponse _: type = ResponseType.ListFiles; break;

            case GetFilesResponse _: type = ResponseType.GetFiles; break;

            case GetServerCapabilitiesResponse _: type = ResponseType.GetServerCapabilities; break;

            case ExecutionTimedOutResponse _: type = ResponseType.ExecutionTimedOut; break;

            case ExecutionTerminatedResponse _: type = ResponseType.ExecutionTerminated; break;

            case CompressedResponse _: type = ResponseType.CompressedResponse; break;

            default: throw new ArgumentException($"Unable to serialize {response.GetType()}");
            }
            writer.Write((byte)type);
            response.Serialize(writer);
        }
Ejemplo n.º 7
0
        public static void WriteCommand(this IPCWriter writer, ICommand command)
        {
            CommandType type;

            switch (command)
            {
            case Execute _: type = CommandType.Execute; break;

            case FetchMetadata _: type = CommandType.FetchMetadata; break;

            case FetchResultRange _: type = CommandType.FetchResultRange; break;

            case Deploy _: type = CommandType.Deploy; break;

            case ListEnvironmentVariables _: type = CommandType.ListEnvironmentVariables; break;

            case PutFileCommand _: type = CommandType.PutFile; break;

            case PutDirectoryCommand _: type = CommandType.PutDirectory; break;

            case ListFilesCommand _: type = CommandType.ListFiles; break;

            case GetFilesCommand _: type = CommandType.GetFiles; break;

            case GetServerCapabilitiesCommand _: type = CommandType.GetServerCapabilities; break;

            case ExecutionTimedOutActionCommand _: type = CommandType.ExecutionTimedOutAction; break;

            case CompressedCommand _: type = CommandType.CompressedCommand; break;

            default: throw new ArgumentException($"Unable to serialize {command.GetType()}");
            }
            writer.Write((byte)type);
            command.Serialize(writer);
        }
Ejemplo n.º 8
0
        void GetUser(IPCReceiver receiver, IPCReader data, SyncHandler sync)
        {
            var magic  = data.ReadUInt64();
            var packet = new IPCWriter(IPC.GetUser);

            if (!sync.UserExists(magic))
            {
                packet.Write(-1);
                receiver.Send(packet);
                return;
            }

            var id = sync.GetUser(magic);

            packet.Write(id);
            receiver.Send(packet);
        }
Ejemplo n.º 9
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write7BitEncodedInt(ExtensionCapabilities.Count);
     foreach (var cap in ExtensionCapabilities)
     {
         writer.Write((byte)cap);
     }
 }
Ejemplo n.º 10
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write((byte)Status);
     writer.WriteLengthPrefixedArray(Files);
 }
Ejemplo n.º 11
0
 public void Serialize(IPCWriter writer)
 {
     writer.WriteLengthPrefixedBlob(Data);
     writer.Write(Path);
     writer.Write(WorkDir);
 }
Ejemplo n.º 12
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write((byte)Status);
 }
Ejemplo n.º 13
0
 public void Serialize(IPCWriter writer)
 {
     writer.WriteLengthPrefixedBlob(Data);
     writer.Write(Timestamp);
     writer.Write((byte)Status);
 }
Ejemplo n.º 14
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write(ByteCount);
     writer.Write(Timestamp);
     writer.Write((byte)Status);
 }
Ejemplo n.º 15
0
 public void Serialize(IPCWriter writer)
 {
     writer.WriteLengthPrefixedArray(Files);
     writer.Write(Path);
     writer.Write(PreserveTimestamps);
 }
Ejemplo n.º 16
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write(Path);
     writer.Write(IncludeSubdirectories);
 }
Ejemplo n.º 17
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write(UseCompression);
     writer.Write(RootPath);
     writer.WriteLengthPrefixedArray(Paths);
 }
Ejemplo n.º 18
0
 public void Serialize(IPCWriter writer)
 {
     writer.WriteLengthPrefixedBlob(Data);
     writer.Write(Destination);
 }
Ejemplo n.º 19
0
 public void Serialize(IPCWriter writer)
 {
     writer.Write(TerminateProcesses);
 }