Пример #1
0
        private void ReadDirectory(List <byte[]> sectors, int index, List <CompoundDocumentItem> l)
        {
            var br = new BinaryReader(new MemoryStream(sectors[index]));

            while (br.BaseStream.Position < br.BaseStream.Length)
            {
                var e = new CompoundDocumentItem();
                e.Read(br);
                if (e.ObjectType != 0)
                {
                    l.Add(e);
                }
            }
        }
Пример #2
0
        public CompoundDocumentFile()
        {
            RootItem = new CompoundDocumentItem()
            {
                Name = "<Root>", Children = new List <CompoundDocumentItem>(), ObjectType = 5
            };
            minorVersion   = 0x3E;
            majorVersion   = 3;
            sectorShif     = 9;
            minSectorShift = 6;

            _sectorSize     = 1 << sectorShif;
            _miniSectorSize = 1 << minSectorShift;
            _sectorSizeInt  = _sectorSize / 4;
        }
Пример #3
0
        private int AddChildren(CompoundDocumentItem item, List <CompoundDocumentItem> l)
        {
            var childId = -1;

            item.ColorFlag = 1; //Always Black-No matter here, we just add nodes as a b-tree
            if (item.Children.Count > 0)
            {
                foreach (var c in item.Children)
                {
                    InitItem(c);
                }

                item.Children.Sort();

                childId = SetSiblings(l.Count, item.Children, 0, item.Children.Count - 1, -1);
                l.AddRange(item.Children);
                foreach (var c in item.Children)
                {
                    c.ChildID = AddChildren(c, l);
                }
            }
            return(childId);
        }
Пример #4
0
 private void InitItem(CompoundDocumentItem item)
 {
     item.LeftSibling  = -1;
     item.RightSibling = -1;
     item._handled     = false;
 }