async void MainWindow_Loaded(object sender, RoutedEventArgs e) { HelperStructs.LauncherFuncs.ReadInfoValues(HelperStructs.GlobalVars.LauncherInfoFile); ConsolePrint("RBXLegacy version " + HelperStructs.GlobalVars.LauncherInfo.Version + " loaded."); if (!Directory.Exists(HelperStructs.GlobalVars.ClientFolder)) { Directory.CreateDirectory(HelperStructs.GlobalVars.ClientFolder); } if (!Directory.Exists(HelperStructs.GlobalVars.MapFolder)) { Directory.CreateDirectory(HelperStructs.GlobalVars.MapFolder); } if (!Directory.Exists(HelperStructs.GlobalVars.DataFolder)) { Directory.CreateDirectory(HelperStructs.GlobalVars.DataFolder); } if (File.Exists(HelperStructs.GlobalVars.ChangelogFile)) { Changelog.AppendText(File.ReadAllText(HelperStructs.GlobalVars.ChangelogFile), "White"); } else { ConsolePrint("Error - " + HelperStructs.GlobalVars.ChangelogFile + " not found."); } if (!File.Exists(HelperStructs.GlobalVars.LauncherConfigFile)) { ConsolePrint("Warning - " + HelperStructs.GlobalVars.LauncherConfigFile + " not found. Creating one with default values."); HelperStructs.LauncherFuncs.ResetConfigValues(); WriteConfigValues(); ReadConfigValues(); } else { ReadConfigValues(); } if (!File.Exists(HelperStructs.GlobalVars.ServerListFile)) { ConsolePrint("Warning - " + HelperStructs.GlobalVars.ServerListFile + " not found. Creating empty file."); File.Create(HelperStructs.GlobalVars.ServerListFile).Dispose(); } //init discord rpc handlers = new HelperStructs.DiscordRpc.EventHandlers(); handlers.readyCallback = ReadyCallback; handlers.disconnectedCallback += DisconnectedCallback; handlers.errorCallback += ErrorCallback; handlers.joinCallback += JoinCallback; handlers.spectateCallback += SpectateCallback; handlers.requestCallback += RequestCallback; HelperStructs.DiscordRpc.Initialize(HelperStructs.GlobalVars.appid, ref handlers, true, ""); try { await Task.Run(() => { for (;;) { HelperStructs.DiscordRpc.RunCallbacks(); } }); } catch (Exception) { } HelperStructs.GlobalVars.presence.largeImageKey = HelperStructs.GlobalVars.imagekey_large; HelperStructs.GlobalVars.presence.state = "In Launcher"; HelperStructs.GlobalVars.presence.largeImageText = "RBXLegacy | " + HelperStructs.GlobalVars.presence.state; HelperStructs.DiscordRpc.UpdatePresence(ref HelperStructs.GlobalVars.presence); }