static void Main(string[] args) { string pathToInput = args.First(); Outputer.SetPath(args[1]); Transliterator.start(pathToInput); }
public static void start(string path) { bool isOK = true; if (!File.Exists(path)) { Console.WriteLine("Входной файл не найден"); System.Environment.Exit(1); } string[] allText = File.ReadAllLines(path); //Получаем все строки int row = 0; //Номер строки foreach (string str in allText) //Идём по каждой строке { row++; string[] line; string str1; str1 = str; if (str.Contains('{') && str.Contains('}')) { string[] comment = str.Split(new[] { '{', '}' }, StringSplitOptions.RemoveEmptyEntries); string comment1 = String.Join(" ", comment); str1 = str.Replace(comment1, " "); } if (str1.Split(' ').Count() > 1) { line = str1.Split(' '); } //Получаем все слова ПЕРЕДЕЛАТЬ, ГОВНОКОДИЩЕ!!! else { line = new[] { str }; } foreach (string word in line) { if (word == "") { continue; } if (isRead(word)) { Outputer.WriteToFile(row, word, "Reading"); continue; } if (isWrite(word)) { Outputer.WriteToFile(row, word, "Writing"); continue; } if (isAdd(word)) { Outputer.WriteToFile(row, word, "Adding"); continue; } if (isDiv(word)) { Outputer.WriteToFile(row, word, "Dividing"); continue; } if (isMul(word)) { Outputer.WriteToFile(row, word, "Multiplying"); continue; } if (isMod(word)) { Outputer.WriteToFile(row, word, "division with remainder"); continue; } if (isEqual(word)) { Outputer.WriteToFile(row, word, "equal"); continue; } if (isLet(word)) { Outputer.WriteToFile(row, word, "equating"); continue; } if (isNot(word)) { Outputer.WriteToFile(row, word, "Not_equal"); continue; } if (isRRB(word)) { Outputer.WriteToFile(row, word, "}"); continue; } if (isLRB(word)) { Outputer.WriteToFile(row, word, "Left_R_Brace}"); continue; } if (isDecimal(word)) { Outputer.WriteToFile(row, word, "Decimal"); continue; } if (isBin(word)) { Outputer.WriteToFile(row, word, "Bin"); continue; } if (isOctal(word)) { Outputer.WriteToFile(row, word, "Octal"); continue; } if (isHex(word)) { Outputer.WriteToFile(row, word, "Hex"); continue; } if (isLCB(word)) { Outputer.WriteToFile(row, word, "LCB"); continue; } if (isRCB(word)) { Outputer.WriteToFile(row, word, "RCB"); continue; } Outputer.WriteToFile(row, word, "Error"); isOK = false; Console.WriteLine("Error:" + "row " + row + "word-" + word + ":Unknown word"); } } if (isOK) { Console.WriteLine("Ok"); } }