Esempio n. 1
0
        public void WriteRecordId(IRbfType type, DataWriter writer)
        {
            writer.Write(GetDescriptorIndex(type, out var isNew));
            writer.Write((byte)type.DataType);

            if (isNew)
            {
                writer.Write((ushort)type.Name.Length);
                writer.Write(Encoding.ASCII.GetBytes(type.Name));
            }
        }
Esempio n. 2
0
 internal void AddChild(IRbfType value)
 {
     if (PendingAttributes > 0)
     {
         PendingAttributes--;
         Attributes.Add(value);
     }
     else
     {
         Children.Add(value);
     }
 }
Esempio n. 3
0
        public byte GetDescriptorIndex(IRbfType t, out bool isNew)
        {
            var key = t.Name;// $"{t.Name}_{t.DataType}";

            isNew = false;

            if (!outDescriptors.TryGetValue(key, out var idx))
            {
                idx = outDescriptors.Count;
                outDescriptors.Add(key, idx);

                isNew = true;
            }

            return((byte)idx);
        }