/// <summary> /// Handles user input. /// </summary> /// <param name="str"></param> public static void Command(string str) { ArrayManipulators <string> arrman = new ArrayManipulators <string>(); string[] args = arrman.RemoveEmptyEntries(str.RemoveWhiteSpace().Split(Convert.ToChar(" "))); Config.Save(); Logger.SaveLog(); if (Config.ConsoleEnabled) { bool flag = false; if (args.Count() >= 1) { foreach (Command cmd in Commands.HalcyonCommands) { if (cmd.Name.ToLower() == (args[0].Length == 1 || args[0].Length == 0 ? "" : args[0].Substring(1).ToLower())) { cmd.Callback(args); flag = true; break; } } if (!flag) { foreach (Command cmd in Commands.ExtensionCommands) { if (cmd.Name.ToLower() == (args[0].Length == 1 || args[0].Length == 0 ? "" : args[0].Substring(1).ToLower())) { cmd.Callback(args); flag = true; break; } } } if (!flag) { GeneralUtils.printHelp(); } } } if (LoopConsole) { if (Program.Mode != HalcyonMode.None) { Referencer.DeInitialize(); Program.Mode = HalcyonMode.None; } Console.Write("Halcyon:"); Console.Title = "Halcyon Compiler"; HalcyonConsole.Command(Console.ReadLine()); } }
public static void Preprocessor_OnPreprocessCompleted(object sender, HandledEventArgs e) { if (!e.Handled) { Logger.TalkyLog("Post-preprocessor actions started"); if (Program.Mode == HalcyonMode.Preprocess) { Logger.TalkyLog("Writing file " + Path.GetFileNameWithoutExtension(Preprocessor.FilePath) + ".halp"); System.IO.StreamWriter output = new System.IO.StreamWriter(Path.Combine(Environment.CurrentDirectory, Path.GetFileNameWithoutExtension(Preprocessor.FilePath) + ".halp")); output.Write(Preprocessor.PreprocessedFile + "\n"); output.Close(); Logger.SaveLog(); } else { Logger.TalkyLog("Preprocessing completed. Procceeding to Assembly information parsing"); Referencer.Initialize(Program.Path); ParserSwitch.Start(Preprocessor.PreprocessedFile.ToString()); } } }