예제 #1
0
        public Dictionary <uint, Section> Parse(BinaryReader binaryReader, List <SectionHeader> sectionHeaders,
                                                Dictionary <uint, Func <Section> > sectionTypes)
        {
            Dictionary <uint, Section> parsedSections = new Dictionary <uint, Section>();

            foreach (SectionHeader sectionHeader in sectionHeaders)
            {
                Section section = new Unknown();
                if (sectionTypes.ContainsKey(sectionHeader.type))
                {
                    section = sectionTypes[sectionHeader.type]();
                }
                binaryReader.BaseStream.Position = sectionHeader.offset + 12L;
                LogSection(section, sectionHeader);
                section.StreamReadData(binaryReader, sectionHeader);
                parsedSections.Add(sectionHeader.id, section);
            }

            return(parsedSections);
        }