private void DetectSystem() { var si = new SYSTEM_INFO(); GetNativeSystemInfo(ref si); switch (si.wProcessorArchitecture) { case PROC_ARCH_INTEL: Arch = ProcessorArchitecture.X86; MAX_BUS_WIDTH = 4; break; case PROC_ARCH_IA64: Arch = ProcessorArchitecture.IA64; MAX_BUS_WIDTH = 8; break; case PROC_ARCH_AMD64: Arch = ProcessorArchitecture.Amd64; MAX_BUS_WIDTH = 8; break; case PROC_ARCH_ARM: Arch = ProcessorArchitecture.Arm; MAX_BUS_WIDTH = 8; break; default: ErrorReporter.GetInstance().Add( $"Unrecognized CPU family: {si.wProcessorArchitecture}", ErrorCode.UnrecognizedInstructionFamily); break; } }
public void AddDependency(string uri) { if (string.IsNullOrEmpty(uri)) { return; } if (!DependencyList.Contains(uri)) { DependencyList.Add(uri); } ErrorReporter.GetInstance().Add("Import redefinition of " + uri + " in " + Uri, ErrorCode.ImportRedefine); }
public void AddMacro(string alias, string symbol) { var errorReporter = ErrorReporter.GetInstance(); foreach (var macro in Macros) { if (macro.Alias != alias) { continue; } errorReporter.Add("Macro " + alias + "already defined", ErrorCode.MacroRedefine); return; } Macros.Add(new Macro(alias, symbol)); }
private void DetectPlatform() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { OS = OS.Windows; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { OS = OS.Linux; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { OS = OS.OSX; ErrorReporter.GetInstance().Add("MacOS has no planned support", ErrorCode.UnsupportedOS); } else { OS = OS.NA; ErrorReporter.GetInstance().Add("Operating system can not be recognized: " + $"{RuntimeInformation.OSDescription}", ErrorCode.UnrecognizedOS); } }
public PageInfo LoadFile(string path) { if (path.Length == 0) { return(null); } PageInfo page = null; try { page = new PageInfo(path); _pages.Add(page); } catch (FileNotFoundException e) { ErrorReporter.GetInstance().Add( e.ToString(), ErrorCode.FileNotFound); } return(page); }