Пример #1
0
 public bool Write(Stream stream, object obj)
 {
     if (@ref.TryGetValue(obj, out int r))
     {
         stream.WriteByte(TagRef);
         ValueWriter.WriteInt(stream, r);
         stream.WriteByte(TagSemicolon);
         return(true);
     }
     return(false);
 }
Пример #2
0
        public static byte[] GetMetaData(string typeName, IEnumerable <string> memberNames, int count)
        {
            var stream = memoryStream.Value;

            stream.SetLength(0);
            stream.WriteByte(TagClass);
            ValueWriter.Write(stream, typeName);
            if (count > 0)
            {
                ValueWriter.WriteInt(stream, count);
            }
            stream.WriteByte(TagOpenbrace);
            foreach (string name in memberNames)
            {
                stream.WriteByte(TagString);
                ValueWriter.Write(stream, name);
            }
            stream.WriteByte(TagClosebrace);
            return(stream.ToArray());
        }