private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { // var pname = Process.GetProcessesByName("spartan"); if (pname.Length > 0) { SkinHelper.ShowMessage(@"Game already runing! Close it first."); return; } } catch (Exception) { // } try { //Only one instance if (AlreadyRunning()) { return; } } catch (Exception) { // } //Load UserConfig try { if (File.Exists(UserConfigFilePath)) { UserConfig = UserConfig.Load(UserConfigFilePath); string lang = UserConfig.GameLanguage.ToString(); lang = $"{lang.Substring(0, 2)}-{lang.Substring(2)}"; System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(lang); } } catch (Exception) { // } //Start Gui Application.Run(new MainForm()); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { // var pname = Process.GetProcessesByName("spartan"); if (pname.Length > 0) { SkinHelper.ShowMessage(@"Game already runing! Close it first."); return; } } catch (Exception) { // } try { //Only one instance if (AlreadyRunning()) { return; } } catch (Exception) { // } //Load UserConfig try { if (File.Exists(UserConfigFilePath)) { UserConfig = UserConfig.Load(UserConfigFilePath); } } catch (Exception) { // } //Start Gui Application.Run(new MainForm()); }
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"); }