private void LoadScreenAsm(BinaryReader reader) { LevelIndex level = LevelIndex.None; int screen = 0; string asm = null; try { level = (LevelIndex)(int)reader.ReadByte(); screen = reader.ReadByte(); asm = reader.ReadString(); } catch (IOException ex) { throw new ProjectLoadException("An error was encountered in the project file.", ex); } try { var levelData = rom.Levels[level]; if (screen < levelData.Screens.Count) { levelData.Screens[screen].ScreenLoadASM = asm; return; } } catch (System.Collections.Generic.KeyNotFoundException ex) { // eat it up // (Invalid level value) } var unused = new UnusedScreenLoadASM(); unused.ASM = asm; unused.Level = level; unused.ScreenIndex = screen; unusedAsm.Add(unused); }
private void LoadSpecialFile(BinaryReader reader) { try { string name = reader.ReadString(); switch (name) { case declaresFilename: DefinesFile = reader.ReadString(); break; case generalCodeFilename: GeneralCodeFile = reader.ReadString(); break; case expansionCodeFilename: ExpansionFile = reader.ReadString(); break; case ChrAnimationNamesFilename: ChrAnimationNameList = reader.ReadString(); break; default: // special file that is not recognized (presumably a future version) string code = reader.ReadString(); UnusedScreenLoadASM orphaned = new UnusedScreenLoadASM(); orphaned.Level = LevelIndex.None; orphaned.ScreenIndex = 0; orphaned.ASM = Environment.NewLine + "; Orphaned file - " + name + Environment.NewLine + Environment.NewLine + code; unusedAsm.Add(orphaned); break; } } catch (IOException ex) { throw new ProjectLoadException("An error was encountered in the project file.", ex); } }