public Language() { try { var LN = System.Globalization.CultureInfo.CurrentCulture.Name; FileInfo f = new FileInfo(typeof(Language).Assembly.Location); var LD = new DirectoryInfo(Path.Combine(f.Directory.FullName, "Locale", LN)); if (!LD.Exists) { LD = new DirectoryInfo(Path.Combine(f.Directory.FullName, "Locale", "en-US")); } foreach (var item in LD.EnumerateFiles()) { var contents = File.ReadAllLines(item.FullName); foreach (var line in contents) { if (line.IndexOf("=") > 0) { var key = line.Substring(0, line.IndexOf("=")); var content = line.Substring(line.IndexOf("=") + 1).Replace("\\r", "\r"); LanguagePair.Add(key, content); } } } } catch (Exception) { Console.WriteLine("Missing locale file."); } }
public Instructions() { instructions["ST"] = new ST(); instructions["LD"] = new LD(); instructions["ADD"] = new ADD(); instructions["SUB"] = new SUB(); instructions["JMP"] = new JMP(); instructions["JN"] = new JN(); instructions["JP"] = new JP(); instructions["JZ"] = new JZ(); instructions["JNZ"] = new JNZ(); instructions["HALT"] = new HALT(); //Second architecture functions. instructions["LD2"] = new LD2(); instructions["LD3"] = new LD3(); instructions["ST2"] = new ST2(); instructions["ST3"] = new ST3(); instructions["POS"] = new POS(); instructions["PXL"] = new PXL(); instructions["RND"] = new RND(); instructions["CLR"] = new CLR(); instructions["COS"] = new COS(); instructions["SIN"] = new SIN(); instructions["IN"] = new IN(); }