Пример #1
0
 /// <summary>
 /// Serializes the field, including the field number, and writes it to
 /// <paramref name="output"/>
 /// </summary>
 /// <param name="fieldNumber">The unknown field number.</param>
 /// <param name="output">The write context to write to.</param>
 internal void WriteTo(int fieldNumber, ref WriteContext output)
 {
     if (varintList != null)
     {
         foreach (ulong value in varintList)
         {
             output.WriteTag(fieldNumber, WireFormat.WireType.Varint);
             output.WriteUInt64(value);
         }
     }
     if (fixed32List != null)
     {
         foreach (uint value in fixed32List)
         {
             output.WriteTag(fieldNumber, WireFormat.WireType.Fixed32);
             output.WriteFixed32(value);
         }
     }
     if (fixed64List != null)
     {
         foreach (ulong value in fixed64List)
         {
             output.WriteTag(fieldNumber, WireFormat.WireType.Fixed64);
             output.WriteFixed64(value);
         }
     }
     if (lengthDelimitedList != null)
     {
         foreach (ByteString value in lengthDelimitedList)
         {
             output.WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited);
             output.WriteBytes(value);
         }
     }
     if (groupList != null)
     {
         foreach (UnknownFieldSet value in groupList)
         {
             output.WriteTag(fieldNumber, WireFormat.WireType.StartGroup);
             value.WriteTo(ref output);
             output.WriteTag(fieldNumber, WireFormat.WireType.EndGroup);
         }
     }
 }
Пример #2
0
 void pb.IBufferMessage.InternalWriteTo(ref pb.WriteContext output)
 {
     if (ClientId.Length != 0)
     {
         output.WriteRawTag(10);
         output.WriteString(ClientId);
     }
     if (MessageId.Length != 0)
     {
         output.WriteRawTag(18);
         output.WriteString(MessageId);
     }
     if (Type != MessageType.Undefined)
     {
         output.WriteRawTag(24);
         output.WriteEnum((int)Type);
     }
     if (time_ != null)
     {
         output.WriteRawTag(34);
         output.WriteMessage(Time);
     }
     if (Status != MessageStatus.Undefined)
     {
         output.WriteRawTag(40);
         output.WriteEnum((int)Status);
     }
     if (Payload.Length != 0)
     {
         output.WriteRawTag(50);
         output.WriteBytes(Payload);
     }
     if (Response != ResponseType.Undefined)
     {
         output.WriteRawTag(56);
         output.WriteEnum((int)Response);
     }
     if (_unknownFields != null)
     {
         _unknownFields.WriteTo(ref output);
     }
 }