コード例 #1
0
        public uint GetSerializedSize()
        {
            uint num            = 0u;
            uint serializedSize = this.EntityId.GetSerializedSize();

            num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
            if (this.Key.get_Count() > 0)
            {
                using (List <FieldKey> .Enumerator enumerator = this.Key.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        FieldKey current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize2 = current.GetSerializedSize();
                        num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2);
                    }
                }
            }
            num += 1u;
            return(num);
        }
コード例 #2
0
 public static void Serialize(Stream stream, QueryRequest instance)
 {
     if (instance.EntityId == null)
     {
         throw new ArgumentNullException("EntityId", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.EntityId.GetSerializedSize());
     EntityId.Serialize(stream, instance.EntityId);
     if (instance.Key.get_Count() > 0)
     {
         using (List <FieldKey> .Enumerator enumerator = instance.Key.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 FieldKey current = enumerator.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 FieldKey.Serialize(stream, current);
             }
         }
     }
 }