public SettingsForm(LauncherConfig config, bool isWin8OrHigher, string windowsVersion) { InitializeComponent(); this._config = config; this._isWin8OrHigher = isWin8OrHigher; this._windowsVersion = windowsVersion; }
public Patcher(LauncherConfig config, bool hasUpdates, bool force = false) { this._config = config; this._force = force; var patchFiles = false; foreach (var path in Patcher.PatchDirectories.Keys) { if (Directory.GetFiles(Path.Combine(this._config.InstallDir, path)).Length > 0) { patchFiles = true; break; } } if (!patchFiles && !hasUpdates) { this.Close(); return; } InitializeComponent(); Region = Region.FromHrgn(Win32Api.CreateRoundRectRgn(0, 0, Width, Height, 8, 8)); this.updateChecker.RunWorkerAsync(force); }
public ConfigManager(bool bSaveWhenValueSet) { this._bSaveWhenValueSet = bSaveWhenValueSet; this._LauncherConfig = new LauncherConfig(RegistryRoot, bSaveWhenValueSet); this._SharpLauncherConfig = new SharpLauncherConfig(launcherRoot, bSaveWhenValueSet); // Added launcherRoot this._UserConfig = new UserConfig(UserRegistryRoot, bSaveWhenValueSet); }
public Polymorphs(LauncherConfig config) { this._config = config; InitializeComponent(); this.btn_update.DialogResult = DialogResult.OK; this.lst_selected.DrawMode = DrawMode.OwnerDrawFixed; this.lst_selected.DrawItem += lst_selected_DrawItem; }
public LauncherForm() { var appLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var associatedLaunchers = Helpers.GetAssociatedLaunchers(appLocation); if (!Helpers.LauncherInLineageDirectory(appLocation)) { MessageBox.Show("The launcher must be installed in your Lineage directory!\n\n " + @"Please reinstall if you used the installer, or move this file to your lineage directory.", @"Invalid Directory", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); return; } // If no launchers are available, let's assume resurrection if (associatedLaunchers.Count == 0) { associatedLaunchers.Add("Lineage Resurrection"); } if (associatedLaunchers.Count > 1) { MessageBox.Show("More than one launcher associated with this folder! Using the first one found."); } var launcherConfig = Helpers.GetLauncherConfig(associatedLaunchers[0], appLocation); if (launcherConfig == null) { MessageBox.Show("There was an error loading the config. Please re-install the launcher."); this.Close(); return; } this._config = launcherConfig; if (this._config == null || this._config.Servers == null || this._config.Servers.Count == 0) { MessageBox.Show(@"No servers configured, contact your server admin. Closing launcher.", @"No Servers Found", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Load += (s, e) => { this.Close(); Application.Exit(); }; } this._isWin8OrHigher = Helpers.IsWin8OrHigher(out this._windowsVersion); InitializeComponent(); this.BannerBrowser.Url = this._config.NewsUrl; }
private static void LaunchGames() { if (Config.Instance.AuthInfo == null) { Console.WriteLine("Warning: You haven't logged in yet, you probably won't be able to play any games yet."); } KeyValuePair <string, string>[] games = Config.Instance.GamePaths.ToArray(); string resp; int selectedGame = 0; do { for (int i = 0; i < games.Length; ++i) { Product game = NXLDownloader.Program.GetProduct(games[i].Key); Console.WriteLine($"{i} [{games[i].Key}] - {game?.FriendlyProductName ?? "Unknown Game"}"); } resp = Console.ReadLine(); } while (!string.IsNullOrEmpty(resp) && int.TryParse(resp, out selectedGame) && selectedGame >= 0 && selectedGame < games.Length); string productId = games[selectedGame].Key; string gamePath = games[selectedGame].Value; Product gameInfo = NXLDownloader.Program.GetProduct(productId); LauncherConfig launchConfig = gameInfo.Details.LaunchConfig; string exePath = Path.Combine(gamePath, launchConfig.EXEPath); string args = string.Join(" ", ReplaceArgs(launchConfig.args, productId)); if (running.ContainsKey(productId)) { try { running[productId].Kill(); } catch (Exception) { } running.Remove(productId); } ProcessStartInfo startInfo = new ProcessStartInfo(exePath, args); startInfo.Verb = "runas"; startInfo.UseShellExecute = true; startInfo.WorkingDirectory = gamePath; Process run = Process.Start(startInfo); running.Add(productId, run); }
private void InitializeLauncher() { launcherConfig = JsonHandler.LoadLauncherConfig(); monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: null, exitCallback: GameExitCallback); serverManager = new ServerManager(); accountManager = new Account(launcherConfig); gameStarter = new GameStarter(); if (launcherConfig.Servers.Count == 0) { launcherConfig.Servers.Add("https://127.0.0.1"); JsonHandler.SaveLauncherConfig(launcherConfig); } ShowServerSelectView(); }
public static LauncherConfig GetLauncherConfig(string keyName, string appPath) { try { var config = new LauncherConfig(keyName, appPath); var configKey = Registry.CurrentUser.OpenSubKey(@"Software\" + keyName, true); var servers = configKey.GetValue("Servers").ToString().Split(','); config.Servers = new Dictionary <string, Server>(); foreach (var server in servers) { var serverInfo = server.Split(':'); config.Servers.Add(serverInfo[0].Trim(), new Server { IpOrDns = serverInfo[1], Port = int.Parse(serverInfo[2]) }); } config.UpdaterFilesRoot = new Uri(configKey.GetValue("UpdaterFilesRoot").ToString()); config.UpdaterUrl = new Uri(configKey.GetValue("UpdaterUrl").ToString()); config.VersionInfoUrl = new Uri(configKey.GetValue("VersionInfoUrl").ToString()); config.VoteUrl = new Uri(configKey.GetValue("VoteUrl").ToString()); config.WebsiteUrl = new Uri(configKey.GetValue("WebsiteUrl").ToString()); var newsUrl = configKey.GetValue("NewsUrl"); config.NewsUrl = new Uri(newsUrl == null ? "https://zelgo.net" : newsUrl.ToString()); config.PublicKey = configKey.GetValue("PublicKey").ToString(); return(config); } catch (Exception ex) { return(null); } }
public SettingsForm(LauncherConfig config, bool isWin8OrHigher) { InitializeComponent(); this._config = config; this._isWin8OrHigher = isWin8OrHigher; }
static Globals() { LauncherConfig = null; ClientConfig = null; SetPaths(Environment.CurrentDirectory); }
public static bool HasUpdates(string expectedUpdaterChecksum, long lastUpdated, LauncherConfig config) { var appDataPath = Directory.GetParent(Application.UserAppDataPath).ToString(); var updaterLocation = Path.Combine(appDataPath, "Updater.exe"); var updaterChecksum = Helpers.GetChecksum(updaterLocation); if (!File.Exists(updaterLocation) || updaterChecksum != expectedUpdaterChecksum) { return(true); } var versionInfo = Helpers.GetVersionInfo(config.VersionInfoUrl, config.PublicKey); var launcherKey = Registry.CurrentUser.OpenSubKey(@"Software\" + config.KeyName, true); var lastUpdatedCheck = launcherKey.GetValue("LastUpdated"); var updatesLastRun = (int?)lastUpdatedCheck ?? 0; if (updatesLastRun < lastUpdated) { return(true); } return(false); }
public static void SaveLauncherConfig(LauncherConfig data) { Json.Save(Path.Combine(filepath, launcherConfig), data); }
public static LauncherConfig GetLauncherConfig(string keyName, string appPath) { try { var config = new LauncherConfig(keyName, appPath); var configKey = Registry.CurrentUser.OpenSubKey(@"Software\" + keyName, true); if (configKey == null || configKey.GetValue("Servers") == null) { // if the config key is null and not equal to the default of "Lineage Resurrection" // then return null, otherwise lets try pulling it from the default URL and public key if (keyName != "Lineage Resurrection") { return(null); } else { var versionInfo = GetVersionInfo(new Uri("http://launcher.travis-smith.ca/VersionInfo.php"), "<RSAKeyValue><Modulus>l5mJTTO/MHTnaLbzkr0bfbOvY6qC9jWa39IIOtujP1mAPqhdEG2dIbtx20QEZ5P/9hg0KP16RvYj6BSwU4/Ees90mKpXV/7PzTp9uSRZuKNo+uoku7oqar4ruWmpcpPErKVGqD0i7908C/833VzSxdBxnqFqgF1nAk1iRJsnjxC8hseimjfe/E1EvO+Uk/NcA9VFR7YRPknuMLWMoLyl0EN6lJ4z5xLZKhPqGpMdIjDRmW2PdQxSFs5FIsVK9jYnqW/M6o+PiL1uj1py3EaBgIOkOMSUhEAHlgNkqdYlXHkqQ4W3HTuNkQmVLL8oZd6NXrflcF3PDEr1JtbTd+X+DQ==</Modulus><Exponent>JQ==</Exponent></RSAKeyValue>"); configKey = Registry.CurrentUser.CreateSubKey(@"Software\" + versionInfo.ServerName); UpdateConfig(versionInfo); var settingsKey = Registry.CurrentUser.OpenSubKey(@"Software\LineageLauncher", true); if (settingsKey == null) { settingsKey = Registry.CurrentUser.CreateSubKey(@"Software\LineageLauncher"); } settingsKey.SetValue(versionInfo.ServerName, appPath, RegistryValueKind.String); } } var servers = configKey.GetValue("Servers").ToString().Split(','); config.Servers = new Dictionary <string, Server>(); foreach (var server in servers) { var serverInfo = server.Split(':'); config.Servers.Add(serverInfo[0].Trim(), new Server { IpOrDns = serverInfo[1], Port = int.Parse(serverInfo[2]) }); } config.UpdaterFilesRoot = new Uri(configKey.GetValue("UpdaterFilesRoot").ToString()); config.UpdaterUrl = new Uri(configKey.GetValue("UpdaterUrl").ToString()); config.VersionInfoUrl = new Uri(configKey.GetValue("VersionInfoUrl").ToString()); config.VoteUrl = new Uri(configKey.GetValue("VoteUrl").ToString()); config.WebsiteUrl = new Uri(configKey.GetValue("WebsiteUrl").ToString()); config.PublicKey = configKey.GetValue("PublicKey").ToString(); return(config); } catch (Exception) { return(null); } }