示例#1
0
 public static void Serialize(Stream stream, AttributeFilter instance)
 {
     stream.WriteByte(8);
     ProtocolParser.WriteUInt64(stream, (ulong)((long)instance.Op));
     if (instance.Attribute.get_Count() > 0)
     {
         using (List <Attribute> .Enumerator enumerator = instance.Attribute.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Attribute current = enumerator.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.attribute.Attribute.Serialize(stream, current);
             }
         }
     }
 }
示例#2
0
        public uint GetSerializedSize()
        {
            uint num = 0u;

            num += ProtocolParser.SizeOfUInt64((ulong)((long)this.Op));
            if (this.Attribute.get_Count() > 0)
            {
                using (List <Attribute> .Enumerator enumerator = this.Attribute.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Attribute current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize = current.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            num += 1u;
            return(num);
        }