public FileManager(string filename) { this._baseFilename = Path.GetDirectoryName(Path.GetFullPath(filename)) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(filename); CleanUpFiles(); this.Listing = new OutputFile(this._baseFilename + FileManager.LIST_FILE_EXTENSION); this._echo = new OutputFile(this._baseFilename + FileManager.ECHO_FILE_EXTENSION); this.Input = new InputFile(this._baseFilename + FileManager.INPUT_FILE_EXTENSION, this._echo); }
public InputFile(string filename, OutputFile echo) { this._echo = echo; this._lineNumber = 1; this._columnNumber = 1; try { this._fileStream = File.Open(filename, FileMode.Open); this._inputStream = new StreamReader(this._fileStream); } catch (Exception ex) { Logger.FatalException(ex, "Error while opening input file"); } echo.AppendLine("Compilation listing of <{0}>", filename); echo.AppendLine("zzzzz: 11111111112222222222333333333344444444445555555555666666666677777777778"); echo.AppendLine("eeeee: 12345678901234567890123456789012345678901234567890123456789012345678901234567890"); echo.AppendLineNumber(this._lineNumber); }
public void InitializeOutputFile() { bool prologFileExists = File.Exists(FileManager.MMIX_PROLOG_FILE); if (prologFileExists) { File.Copy(FileManager.MMIX_PROLOG_FILE, this._baseFilename + FileManager.MMIX_FILE_EXTENSION); } this.Output = new OutputFile(this._baseFilename + FileManager.MMIX_FILE_EXTENSION, true); if (!prologFileExists) { this.Output.AppendLine(Macro.DefaultProlog()); } }
public void FinalizeOutputFile() { this.Output.Dispose(); this.Output = null; string cmdLine = string.Format("-b 120 -l {0} {1}", this._baseFilename + FileManager.MMIX_LISTING_FILE_EXTENSION, this._baseFilename + FileManager.MMIX_FILE_EXTENSION); System.Diagnostics.Process.Start("mmixal.exe", cmdLine); }