public override bool SaveContainer(AContainer <BinaryStream> container, string name)
        {
            string filePath = GetPersistentFilePath(name);

            return(SaveContainerAtPath(container, filePath));
        }
 public abstract bool SaveContainer(AContainer <TStream> container, string name);
Пример #3
0
 protected abstract void WriteElement(T e, BinaryWriter writer, AContainer <BinaryStream> container);
Пример #4
0
        public sealed override void ReadDataToObject(ref List <T> list, BinaryStream stream, AContainer <BinaryStream> container)
        {
            int len = stream.ReadInt(Metadata.CollectionSize);

            if (len < 0)
            {
                list = null;
                return;
            }
            if (list == null)
            {
                list = new List <T>(len > 4 ? len : 4);
            }
            else if (list.Capacity < len)
            {
                list.Capacity = len;
            }
            var reader = stream.GetReader();

            for (int i = 0, count = list.Count; i < len & i < count; i++)
            {
                var v = list[i];
                ReadElement(ref v, reader, container);
                list[i] = v;
            }
            for (int i = list.Count; i < len; i++)
            {
                var v = default(T);
                ReadElement(ref v, reader, container);
                list.Add(v);
            }
            if (list.Count > len)
            {
                list.RemoveRange(len, list.Count - len);
            }
            EndReading();
        }
Пример #5
0
 protected abstract void ReadElement(ref T e, BinaryReader reader, AContainer <BinaryStream> container);