protected override void ParseLine(string line) { var keyword = ParseKeyword(ref line); switch (keyword) { case Keyword.TEXDICTION: TXDs.Add(new TxdFile(line.ToLower())); break; case Keyword.IDE: IDEs.Add(new IdeFile(line)); break; case Keyword.MAPZONE: case Keyword.IPL: IPLs.Add(new IplFile(line, Version)); break; case Keyword.IMG: IMGs.Add(new ImgFile(line, Version)); break; default: Log.Message("Ignoring line with keyword {0}", keyword); break; } }
public IIDE NewIDE(IVirtualMachine machine, ICodeEditor codeEditor , IInputPort inputPort = null, int withInputPortIndex = -1 , IOutputPort outputPort = null, int withOutputPortIndex = -1 , bool withConsole = false) { if (!IsInitialized) { throw new InvalidOperationException(); } (codeEditor as Form).MdiParent = MainForm as Form; IIDE newIde = new IDE(machine, codeEditor); newIde.ParentWorkplace = this; newIde.ShowingMessage += MainSymbolService.ShowMessage; newIde.AskingUser += MainSymbolService.AskUser; newIde.OpeningFileByUser += MainSymbolService.OpenFileByUser; newIde.SavingFileByUser += MainSymbolService.SaveFileByUser; if (inputPort != null && withInputPortIndex >= -1) { newIde.MachineInsertInputPort(withInputPortIndex, inputPort); } if (outputPort != null && withOutputPortIndex >= -1) { newIde.MachineInsertOutputPort(withOutputPortIndex, outputPort); } if (withConsole && (inputPort != null || outputPort != null)) { IInputDevice newConsoleAsInputDevice; IOutputDevice newConsoleAsOutputDevice = null; if (inputPort != null) { InputDeviceTypeInfo consoleDeviceTypeInfo = InputDeviceBuilder.RegisteredTypes.Find(i => i.TypeFullName == typeof(ConsoleDevice).FullName); if (consoleDeviceTypeInfo != null) { NewInputDevice(consoleDeviceTypeInfo, out newConsoleAsInputDevice); newConsoleAsOutputDevice = newConsoleAsInputDevice as IOutputDevice; newIde.MachineSetInputDevice(inputPort, newConsoleAsInputDevice); } } if (outputPort != null) { if (newConsoleAsOutputDevice != null) { newIde.MachineSetOutputDevice(outputPort, newConsoleAsOutputDevice); } else { OutputDeviceTypeInfo consoleDeviceTypeInfo = OutputDeviceBuilder.RegisteredTypes.Find(i => i.TypeFullName == typeof(ConsoleDevice).FullName); if (consoleDeviceTypeInfo != null) { NewOutputDevice(consoleDeviceTypeInfo, out newConsoleAsOutputDevice); newIde.MachineSetOutputDevice(outputPort, newConsoleAsOutputDevice); } } } } newIde.Machine.Id = MachinesIdCounter++; newIde.Machine.CustomName = newIde.Machine.ToString(); newIde.Id = IdeIdCounter++; newIde.ProgramFile.ShortFileName = GetNewProgramFileShortName(newIde); newIde.Title = GetNewIDEtitle(newIde); newIde.ConfigFile.ShortFileName = newIde.Title; IDEs.Add(newIde); OnGotUpdated(); return(newIde); }