public void Initialize(byte[] File) { this.File = File; uint location = 0x10; Sections = new List <ISection>(); Sections.Add(new HeaderSection(File, 0)); while (location < File.Length) { ushort CurrentType = BitConverter.ToUInt16(File, (int)location); ISection section; switch (CurrentType) { case 0x02: section = new EndOfFileSection(File, (int)location); break; case 0x03: section = new EndOfImageSection(File, (int)location); break; case 0x04: section = new ImageSection(File, (int)location); break; case 0x05: section = new PaletteSection(File, (int)location); break; case 0xFF: section = new FileInfoSection(File, (int)location); break; default: throw new Exception("Invalid Section Type"); } Sections.Add(section); location += section.GetPartSize(); } }
public void Initialize( byte[] File ) { this.File = File; uint location = 0x10; Sections = new List<ISection>(); Sections.Add( new HeaderSection( File, 0 ) ); while ( location < File.Length ) { ushort CurrentType = BitConverter.ToUInt16( File, (int)location ); ISection section; switch ( CurrentType ) { case 0x02: section = new EndOfFileSection( File, (int)location ); break; case 0x03: section = new EndOfImageSection( File, (int)location ); break; case 0x04: section = new ImageSection( File, (int)location ); break; case 0x05: section = new PaletteSection( File, (int)location ); break; case 0xFF: section = new FileInfoSection( File, (int)location ); break; default: throw new Exception( "Invalid Section Type" ); } Sections.Add( section ); location += section.GetPartSize(); } }