/// <summary> /// Attempts to install the actual update and returns true if no exceptions occured. /// </summary> /// <returns>bool</returns> public static bool InstallUpdate() { if (Directory.Exists("update")) { Directory.Delete("update", true); } try { var extractionPath = VRegistry.GetSubKeyValue("Path").ToString().Replace("/", "\\"); var archive = ZipFile.OpenRead("data_" + UpdateData.Version + ".rar"); ExtractToDirectory(archive, extractionPath, true); } catch (Exception e) { MessageBox.Show("Update has failed to install.\n\nError code: " + e.Message, "An error occured"); return(false); } Analytics.TrackEvent("Update has been installed!", new Dictionary <string, string> { { "Version", UpdateData.Version } }); VRegistry.CreateSubKey("Version", UpdateData.Version); return(true); }
/// <summary> /// Checks if a new version is available by first fetching the new version number from the /// website and then comparing local version number with fetched one. /// </summary> /// <returns></returns> public static bool IsNewVersionAvailable() { FetchVersion(); if (VRegistry.GetSubKeyValue("Version").Equals(null)) { VRegistry.CreateSubKey("Version", "0.0.0"); } if (!VRegistry.GetSubKeyValue("Version").ToString().Equals(UpdateData.Version)) { return(true); } return(false); }
public static void Run() { if (VRegistry.IsFirstRun()) { var folderBrowser = new OpenFileDialog { ValidateNames = false, CheckFileExists = false, CheckPathExists = true, FileName = "Select game root path" }; if (folderBrowser.ShowDialog() == DialogResult.OK) { var folderPath = Path.GetDirectoryName(folderBrowser.FileName); if (GameCheck.IsWorkspaceValid(folderPath)) { VRegistry.CreateSubKey("Path", folderPath); SelectVRVersionForm selectVRVersionForm = new SelectVRVersionForm(); selectVRVersionForm.Show(); // TEMP FIX. } else { //Notifications.PlayErrorSound(); MaterialMessageBox.Show(null, "The selected folder does not look valid. This might happen if you've selected wrong folder.\n\n" + "Start the app once again and select proper folder. If this error still presists, contact developers.", "Important message!", MessageBoxButtons.OK); Application.Restart(); } } else { Application.Exit(); } } }
private void Form1_Load(object sender, EventArgs e) { VRegistry.CreateSubKey("Launch", ""); // create a key in case it doesn't exist. Hide(); if (VRegistry.IsFirstRun()) { SetupLogic.Run(); } BringToTop(); Focus(); MaterialSkinManager = MaterialSkinManager.Instance; MaterialSkinManager.AddFormToManage(this); SetUiTheme(MaterialSkinManager.Themes.LIGHT); if (_userSettings.Theme == "Dark") { SetUiTheme(MaterialSkinManager.Themes.DARK); themeSwitch.Checked = false; } MaterialSkinManager.ColorScheme = new ColorScheme(Primary.Green800, Primary.Grey900, Primary.Green700, Accent.Green700, TextShade.WHITE); updaterVerLbl.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString(); if (VRegistry.GetSubKeyValue("Version") != null) { versionLabel.Text += VRegistry.GetSubKeyValue("Version").ToString(); } if (_userSettings.AutoUpdate) { updateSwitch.Checked = true; } backgroundChecker.RunWorkerAsync(); }
private void ver140Btn_Click(object sender, EventArgs e) { VRegistry.CreateSubKey("Version", "1.4.0"); }
private void idkBtn_Click(object sender, EventArgs e) { VRegistry.CreateSubKey("Version", "Unknown"); Application.Restart(); }
private void optionnoEnb_Click(object sender, EventArgs e) { VRegistry.CreateSubKey("Version", "1.3.0"); Application.Restart(); }
private void changePathBtn_Click(object sender, EventArgs e) { VRegistry.CreateSubKey("Path", ""); Application.Restart(); }