示例#1
0
        public static Schema.KRPC.Argument ToProtobufMessage(this Argument argument)
        {
            var result = new Schema.KRPC.Argument();

            result.Position = argument.Position;
            result.Value    = Encoder.Encode(argument.Value);
            return(result);
        }
示例#2
0
        public static Schema.KRPC.Parameter ToProtobufMessage(this Parameter parameter)
        {
            var result = new Schema.KRPC.Parameter();

            result.Name = parameter.Name;
            result.Type = parameter.Type.ToProtobufMessage();
            if (parameter.HasDefaultValue)
            {
                result.DefaultValue = Encoder.Encode(parameter.DefaultValue);
            }
            return(result);
        }
示例#3
0
        public static Schema.KRPC.ProcedureResult ToProtobufMessage(this ProcedureResult procedureResult)
        {
            var result = new Schema.KRPC.ProcedureResult();

            if (procedureResult.HasValue)
            {
                result.Value = Encoder.Encode(procedureResult.Value);
            }
            if (procedureResult.HasError)
            {
                result.Error = procedureResult.Error.ToProtobufMessage();
            }
            return(result);
        }
示例#4
0
        public static Schema.KRPC.Response ToProtobufMessage(this Response response)
        {
            var result = new Schema.KRPC.Response();

            result.Time           = response.Time;
            result.HasError       = response.HasError;
            result.Error          = response.Error;
            result.HasReturnValue = response.HasReturnValue;
            if (response.HasReturnValue)
            {
                result.ReturnValue = Encoder.Encode(response.ReturnValue);
            }
            return(result);
        }