Ejemplo n.º 1
0
        public override void Unserialize(GMDataReader reader, ListUnserialize before = null,
                                         ListUnserialize after             = null,
                                         ListUnserializeElement elemReader = null)
        {
            // Read the element count and begin reading elements
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                before?.Invoke(reader, i, Count);

                // Read the current element and add it to the list
                T elem;
                if (elemReader == null)
                {
                    elem = reader.ReadPointerObject <T>(reader.ReadInt32(), true);
                }
                else
                {
                    elem = (T)elemReader(reader, true);
                }
                Add(elem);

                after?.Invoke(reader, i, Count);
            }
        }
Ejemplo n.º 2
0
 private static GMSerializable DoReadPointerObject(GMDataReader reader, bool notLast)
 {
     return(reader.ReadPointerObject <T>(reader.ReadInt32(), notLast));
 }