Ejemplo n.º 1
0
        public static GMap Load(Stream FromStream)
        {
            var h = GElement.FromStream <GHeader>(FromStream);

            return(new GMap()
            {
                Header = h,
                Sections = LoadSections(FromStream, h.PostsCount).ToList()
            });
        }
Ejemplo n.º 2
0
        private static IEnumerable <GPost> LoadPosts(Stream str)
        {
            GPost p;

            while (true)
            {
                p = GElement.FromStream <GPost>(str);
                yield return(p);

                if (p.Position == PositionInSection.End)
                {
                    yield break;
                }
            }
        }
Ejemplo n.º 3
0
        protected void LoadChildren(Stream DataStream)
        {
            if (!DataStream.CanSeek)
            {
                throw new ArgumentException("Поток данных должен поддерживать функцию поиска", "DataStream");
            }

            var _StartPosition = DataStream.Position;

            Children = new List <TChild>();
            int ChildLength = GElement.LengthOf <TChild>();

            DataStream.Seek(ChildrenStartAdress, SeekOrigin.Begin);
            int cCount = GetChildrenCount(DataStream);

            for (int i = 0; i < cCount; i++)
            {
                TChild child = GElement.FromStream <TChild>(DataStream);
                Children.Add(child);
            }
            DataStream.Seek(_StartPosition, SeekOrigin.Begin);
        }