예제 #1
0
        private ProjectStream ReadProjectStream(CFStream PROJECTStorage, PROJECTCODEPAGE Codepage)
        {/*
          * var y = new List<string>();
          * PROJECTStorage.VisitEntries(x => y.Add(x.Name), false);*/
            Byte[] uncompressedData = PROJECTStorage.GetData();

            var stream = new ProjectStream(Codepage, uncompressedData);

            return(stream);
        }
예제 #2
0
        public VbaStorage(CompoundFile VbaBinFile)
        {
            this.m_disposable = VbaBinFile;

            // _VBA_PROJECT stream
            var VBAStorage = VbaBinFile.RootStorage.GetStorage("VBA");

            this._VBA_PROJECTStream = ReadVbaProjectStream(VBAStorage);

            // DIR STREAM -------------------------
            CFStream thisWorkbookStream = VBAStorage.GetStream("dir");

            Byte[] compressedData = thisWorkbookStream.GetData();
            Byte[] uncompressed   = XlCompressionAlgorithm.Decompress(compressedData);

            var uncompressedDataReader = new XlBinaryReader(ref uncompressed);

            this.DirStream = new DirStream(uncompressedDataReader);

            // MODULE STREAMS ----------------------------------------
            this._ModuleStreams = new Dictionary <string, ModuleStream>(DirStream.ModulesRecord.Modules.Length);
            this.ModuleStreams  = new ReadOnlyDictionary <string, ModuleStream>(this._ModuleStreams);

            foreach (var module in DirStream.ModulesRecord.Modules)
            {
                var streamName  = module.StreamNameRecord.GetStreamNameAsString();
                var stream      = VBAStorage.GetStream(streamName).GetData();
                var localreader = new XlBinaryReader(ref stream);

                var moduleStream = new ModuleStream(DirStream.InformationRecord, module, localreader);

                this._ModuleStreams.Add(streamName, moduleStream);
            }

            // PROJECT stream
            CFStream ProjectStorage = VbaBinFile.RootStorage.GetStream("PROJECT");

            this.ProjectStream = ReadProjectStream(ProjectStorage, this.DirStream.InformationRecord.CodePageRecord);
        }