public static void LoadUserConfig() { try { if (File.Exists(UserConfigFilePath)) { UserConfig = UserConfig.Load(UserConfigFilePath); Logger.Information("User config loaded from {@Path}", UserConfigFilePath); } else { Logger.Information("No user config loaded, path {@Path} does not exist", UserConfigFilePath); } } catch (Exception ex) { Logger.Error(ex, ex.Message); } }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var mutex = new Mutex(true, AppName, out bool createdNew); //Only one instance if (!createdNew) { MsgBox.ShowMessage( $@"""Celeste Fan Project Launcher"" v{ Assembly.GetEntryAssembly()?.GetName().Version } already running!", "Celeste Fan Project", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); //Load UserConfig try { if (File.Exists(UserConfigFilePath)) { UserConfig = UserConfig.Load(UserConfigFilePath); } } catch (Exception) { // } try { if (string.IsNullOrWhiteSpace(UserConfig.GameFilesPath)) { UserConfig.GameFilesPath = GameScannerManager.GetGameFilesRootPath(); } } catch (Exception) { // } //Check if Steam Version try { UserConfig.IsSteamVersion = Assembly.GetEntryAssembly()?.Location .EndsWith("AOEOnline.exe", StringComparison.OrdinalIgnoreCase) ?? false; } catch (Exception) { // } //SslFix (invalid cert) InternetUtils.SslFix(); //Init WebSocketApi WebSocketApi = new WebSocketApi(UserConfig.ServerUri); //Start Gui Application.Run(new MainForm()); GC.KeepAlive(mutex); }
public static void InitializeLegacyComponents() { Logger.Information("Initializing bootstrapper"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // TODO: Move this to app.xaml.cs var mutex = new Mutex(true, AppName, out bool createdNew); //Only one instance if (!createdNew) { Logger.Information("Launcher is already started, will exit"); GenericMessageDialog.Show(Properties.Resources.LauncherAlreadyRunningMessage, DialogIcon.Warning, DialogOptions.Ok); return; } // Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); //Load UserConfig try { if (File.Exists(UserConfigFilePath)) { UserConfig = UserConfig.Load(UserConfigFilePath); Logger.Information("User config loaded from {@Path}", UserConfigFilePath); } else { Logger.Information("No user config loaded, path {@Path} does not exist", UserConfigFilePath); } } catch (Exception ex) { Logger.Error(ex, ex.Message); } try { if (string.IsNullOrWhiteSpace(UserConfig.GameFilesPath)) { UserConfig.GameFilesPath = GameScannerManager.GetGameFilesRootPath(); Logger.Information("Game path set to {@Path}", UserConfigFilePath); } else { Logger.Information("No game path is set"); } } catch (Exception ex) { Logger.Error(ex, ex.Message); } //Check if Steam Version try { UserConfig.IsSteamVersion = Assembly.GetEntryAssembly().Location .EndsWith("AOEOnline.exe", StringComparison.OrdinalIgnoreCase); Logger.Information("IsSteamVersion: {@IsSteamVersion}", UserConfig.IsSteamVersion); } catch (Exception ex) { Logger.Error(ex, ex.Message); } //Init WebSocketApi WebSocketApi = new WebSocketApi(UserConfig.ServerUri); Logger.Information("Initialized web socket"); GC.KeepAlive(mutex); Logger.Information("Initializing fingerprint provider"); FingerPrintProvider.Initialize(); SetUILanguage(); Logger.Information("Bootstrapper initialized"); }
public static void InitializeLegacyComponents() { if (!FileSystem.IsWritableDirectory(AppDomain.CurrentDomain.BaseDirectory)) { MessageBox.Show(string.Format(Properties.Resources.InstallationPathForbidden, AppDomain.CurrentDomain.BaseDirectory), "Celeste Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error); System.Windows.Application.Current.Shutdown(); return; } Logger.Information("Initializing bootstrapper"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // TODO: Move this to app.xaml.cs var mutex = new Mutex(true, AppName, out bool createdNew); //Only one instance if (!createdNew) { Logger.Information("Launcher is already started, will exit"); GenericMessageDialog.Show(Properties.Resources.LauncherAlreadyRunningMessage, DialogIcon.Warning, DialogOptions.Ok); return; } Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); LoadUserConfig(); try { if (string.IsNullOrWhiteSpace(UserConfig.GameFilesPath)) { UserConfig.GameFilesPath = GameScannerManager.GetGameFilesRootPath(); Logger.Information("Game path set to {@Path}", UserConfigFilePath); } else { Logger.Information("No game path is set"); } } catch (Exception ex) { Logger.Error(ex, ex.Message); } //Check if Steam Version try { var isSteamVersion = Assembly.GetEntryAssembly().Location .EndsWith("AOEOnline.exe", StringComparison.OrdinalIgnoreCase); if (UserConfig.IsSteamVersion != isSteamVersion) { UserConfig.IsSteamVersion = isSteamVersion; UserConfig.Save(UserConfigFilePath); } Logger.Information("IsSteamVersion: {@IsSteamVersion}", UserConfig.IsSteamVersion); } catch (Exception ex) { Logger.Error(ex, ex.Message); } //Init WebSocketApi WebSocketApi = new WebSocketApi(UserConfig.ServerUri); Logger.Information("Initialized web socket"); GC.KeepAlive(mutex); Logger.Information("Initializing fingerprint provider"); FingerPrintProvider.Initialize(); SetUILanguage(); Logger.Information("Bootstrapper initialized"); }