Exemple #1
0
        public XLSFile(Stream stream)
        {
            var header  = new XLSHeader(stream);
            var sectors = GetSectors(stream);
            List <SectorIndex> index = new List <SectorIndex>((int)(MaxSectorIndex * header.FatCount));

            Set109Fats(header, sectors, index);
            SetRemainFats(header, sectors, index);
            SetMiniFats(header, sectors, index);
            var dirs = SetDirs(header, sectors, index);

            m_Root = XLSDirectoryFactory.CreateEntry(dirs, sectors, index);
            stream.Close();
        }
        public XLSDirectory Find(string name)
        {
            XLSDirectory child = Child;

            while (child != null)
            {
                int c = Compare(name, child.Name);
                if (c == 0)
                {
                    break;
                }
                child = GetNext(c, child);
            }

            return(child);
        }
        private static XLSDirectory GetEntry(DirectorySectorData entry, List <Sector> sectors, List <SectorIndex> index)
        {
            XLSDirectory result = null;

            switch (entry.Type)
            {
            case Stgty.Storage:
                result = new XLSDirectory(entry.Name);
                break;

            case Stgty.Stream:
                result = new XLSStreamDirectory(entry.Name, entry.Size, entry.Start, sectors, index);
                break;

            default:
                result = new XLSGenericDirectory(entry.Name, entry.Type);
                break;
            }
            return(result);
        }
 private XLSDirectory GetNext(int c, XLSDirectory child)
 {
     return(c < 0 ? child.LeftSibling
         : (c > 0 ? child.RightSibling : null));
 }