static bool ConsoleEventCallback(int eventType) { if (eventType == 2) { InputSim.ResetAllWindows(); } return(false); }
static void Main(string[] args) { InputSim.ResetAllWindows(); handler = new ConsoleEventDelegate(ConsoleEventCallback); SetConsoleCtrlHandler(handler, true); if (args.Length > 0) { if (File.Exists(args[0])) { #if DEBUG == false try { #endif Script(args[0]); #if DEBUG == false } catch (Exception ex) { Log.Write("Internal exception."); Log.Write(ex.ToString()); } #endif } else { Console.WriteLine($"Could not locate file {args[0]}"); } } else { Console.WriteLine("Drag and drop a script over the executable to parse."); ConsoleLoop.Start(); } Console.WriteLine("Done. Press enter to exit."); Console.ReadLine(); }