private static void Main() { Console.WriteAscii("ETS2 Brake Sys", Color.MediumSpringGreen); Console.WriteLine($"Version: {Assembly.GetEntryAssembly().GetName().Version}", Color.LimeGreen); if (!Settings.Load("config.json")) { Report.Info("Do you wish to generate a configuration file (config.json)?"); while (true) { var response = Console.ReadLine().ToLower(); if (response == "y" || response == "yes") { try { Settings.Save("config.json"); } catch (Exception ex) { Report.Error($"Failed to save config file. {ex.Message}"); } break; } if (response == "n" || response == "n") { Report.Error("Failed loading the configuration file. Using default instead (5)"); break; } Report.Error("Sorry, type (y)es/(n)o only"); } } if (!JoystickManager.ValidateAndStart()) { return; } Report.Success("Joystick have been acquired"); JoystickManager.Reset(); HotKeyManager.Loaded += HotKeyManagerOnLoaded; ConsoleManager.Enable(); ConsoleManager.ConsoleClosing += ConsoleManagerOnConsoleClosing; UpdateManager.CheckForUpdates(); GameManager.Settings = Settings; try { Settings.Save("config.json"); } catch (Exception ex) { Report.Error($"Failed to save config file. {ex.Message}"); } if (Settings.IsIncreaseRatioEnabled) { Settings.ResetIncreaseRatioTimeSpan = new TimeSpan(0, 0, 0, 1, 0); } GameManager.HookLoop(); }
private static void ConsoleManagerOnConsoleClosing(object o, EventArgs args) { JoystickManager.Reset(); GameManager.OverlayProcess.OverlayInterface.Disconnect(); }