public static void Initialize(string[] args) { var options = LaunchArgsHandler.ParseArgs(args); ForceGraphics = options.ForceGraphics; if (options.GameJoltYaml != null) { API.GameID = options.GameJoltYaml.GameId; API.GameKey = options.GameJoltYaml.GameKey; API.Username = options.GameJoltYaml.Username; API.Token = options.GameJoltYaml.Token; var apiCall1 = new APICall(result1 => { var list1 = API.HandleData(result1); if (Convert.ToBoolean(list1[0].Value)) { API.LoggedIn = true; var apiCall2 = new APICall(result2 => { var list2 = API.HandleData(result2); foreach (var Item in list2) { if (Item.Name == "id") { API.GameJoltID = Item.Value; //set the public shared field to the GameJolt ID. if (GameController.UPDATEONLINEVERSION && GameController.IS_DEBUG_ACTIVE) { var apiCall = new APICall(); apiCall.SetStorageDataRestricted("ONLINEVERSION", GameController.GAMEVERSION); Logger.Debug("UPDATED ONLINE VERSION TO: " + GameController.GAMEVERSION); } break; // TODO: might not be correct. Was : Exit For } } }); apiCall2.FetchUserdata(API.Username); } else { API.LoggedIn = false; } }); apiCall1.VerifyUser(API.Username, API.Token); } }
private async void Button_Start_Click(object sender, EventArgs e) { bool IsOpenALInstalled() { if (OSInfo.OperatingSystemType == OperatingSystemType.Windows) { return(Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall").GetSubKeyNames() .Select(item => (string)Registry.LocalMachine.OpenSubKey($@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{item}").GetValue("DisplayName")) .Any(programName => programName == "OpenAL")); } if (OSInfo.OperatingSystemType == OperatingSystemType.Unix) { return(true); } if (OSInfo.OperatingSystemType == OperatingSystemType.MacOSX) { return(true); } return(false); } const string OpenALLink = "https://www.openal.org/downloads/"; const string DotNetLink = "https://www.microsoft.com/ru-RU/download/details.aspx?id=42643"; if (OSInfo.FrameworkVersion >= new Version(4, 0, 30319, 34000)) // 4.5.2 { if (!IsOpenALInstalled()) { if (MessageBox.Show(LocalizationUI.GetString("SomethingNotFoundError", "OpenAL 1.1", OpenALLink), LocalizationUI.GetString("SomethingNotFoundErrorTitle"), MessageBoxButtons.YesNo) == DialogResult.Yes) { Process.Start(OpenALLink); this.SafeInvoke(Close); return; } } } else { if (MessageBox.Show(LocalizationUI.GetString("SomethingNotFoundError", "Microsoft .NET Framework 4.5.2", DotNetLink), LocalizationUI.GetString("SomethingNotFoundErrorTitle"), MessageBoxButtons.YesNo) == DialogResult.Yes) { Process.Start(DotNetLink); this.SafeInvoke(Close); return; } } if (CurrentProfile.IsSupportingGameJolt && !(await GameJolt.IsSessionActiveAsync()).Success) { using (var gameJoltMessageBox = new GameJoltForm(Settings)) { switch (gameJoltMessageBox.ShowDialog()) { case DialogResult.Yes: ReloadSettings(); if (!await OpenGameJoltSessionAsync()) { return; } break; case DialogResult.Cancel: return; } } } if (Settings.GameCheckServer && CurrentProfile.ProfileType == ProfileType.Game) { new ProfileGameServerListFile(new ProfileGameSaveFolder(CurrentProfile.Folder)).CheckServers(); } if (CurrentProfile.ExecutionFile != null) { var gameJoltArgs = CurrentProfile.IsSupportingGameJolt ? LaunchArgsHandler.CreateArgs(GameJolt.GameJoltYaml, false) : ""; CurrentProfile.ExecutionFile.Start($"{gameJoltArgs} {CurrentProfile.LaunchArgs}"); this.SafeInvoke(Close); return; } else { Button_StartGame.Enabled = false; if (await DownloadCurrentProfileAsync()) { Button_Start_Click(sender, e); } else { Button_StartGame.Enabled = true; } } }