private void AddToModBulkThreaded(string[] files) { RunThreaded(() => { DisableUI(); }, () => { try { AddToModBulk(files, UpdateProgress); } catch (Archive2RequirementsException exc) { MsgBox.ShowID("archive2InstallRequirements", MessageBoxIcon.Error); return(false); } catch (Archive2Exception exc) { MsgBox.ShowID("archive2Error", MessageBoxIcon.Error); return(false); } catch (Exception exc) { MsgBox.Get("failed").FormatText(exc.Message).Show(MessageBoxIcon.Error); return(false); } return(true); }, (success) => { EnableUI(); UpdateSidePanel(); }); }
public void ApplyChanges() { // Add custom lines to *.ini files: try { IniFile addF76 = new IniFile(Path.Combine(IniFiles.ParentPath, $"{game.IniPrefix}.add.ini")); addF76.Load(); IniFiles.F76.Merge(addF76); IniFile addF76Prefs = new IniFile(Path.Combine(IniFiles.ParentPath, $"{game.IniPrefix}Prefs.add.ini")); addF76Prefs.Load(); IniFiles.F76Prefs.Merge(addF76Prefs); IniFile addF76Custom = new IniFile(Path.Combine(IniFiles.ParentPath, $"{game.IniPrefix}Custom.add.ini")); addF76Custom.Load(); IniFiles.F76Custom.Merge(addF76Custom); } catch (IniParsingException exc) { MsgBox.Get("customIniFilesParsingError").FormatText(exc.Message).Show(MessageBoxIcon.Error); } // Save changes: IniFiles.Save(); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { bool ok = false; if (galleryContextMenuItems.Count == 1) { String fileName = Path.GetFileName(galleryImagePaths[galleryContextMenuItems[0]]); ok = MsgBox.Get("galleryDeleteScreenshot").FormatTitle(fileName).FormatText(fileName).Show(MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; } else { ok = MsgBox.Get("galleryDeleteScreenshots").FormatTitle(galleryContextMenuItems.Count.ToString()).FormatText(galleryContextMenuItems.Count.ToString()).Show(MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; } if (ok) { foreach (int index in galleryContextMenuItems) { String path = galleryImagePaths[index]; if (File.Exists(path)) { File.Delete(path); } } UpdateScreenShotGalleryThreaded(); } }
private void backgroundWorkerRetrieveModInfo_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.UpdateModList(); this.ProgressBarContinuous(100); this.DisplayAllDone(); this.backgroundWorkerRetrieveProfileInfo.RunWorkerAsync(); MsgBox.Get("nexusModsRemoteInfoRefreshedSuccess").Popup(); }
private void buttonNMDeleteModInfo_Click(object sender, EventArgs e) { if (MsgBox.Get("nexusModsRemoveRemoteInfo").Show(MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { NexusMods.ClearRemoteInfo(); this.UpdateModList(); MsgBox.Get("nexusModsRemoveRemoteInfoSuccess").Popup(MessageBoxIcon.Information); } }
public void Update() { // Make API request: APIRequest request = new APIRequest("https://api.nexusmods.com/v1/users/validate.json"); request.Headers["apikey"] = this.APIKey; request.Execute(); if (request.Success && request.StatusCode == 200) { JObject json = request.GetJSON(); this.UserName = json["name"].ToString(); this.ProfilePictureURL = json["profile_url"].ToString(); if (json["is_premium"].Value <bool>() || json["is_premium?"].Value <bool>()) { this.Status = Membership.Premium; } else if (json["is_supporter"].Value <bool>() || json["is_supporter?"].Value <bool>()) { this.Status = Membership.Supporter; } else { this.Status = Membership.Basic; } this.DailyRateLimit = Convert.ToInt32(request.ResponseHeaders["x-rl-daily-remaining"]); this.DailyRateLimitResetString = request.ResponseHeaders["x-rl-daily-reset"]; ParseDailyRateLimitReset(); DownloadProfilePicture(); /* * Unused values: * - "user_id" * - "key" * - "email" */ ValidKey = true; } else { if (request.Success) { MsgBox.Get("nexusModsProfileRefreshFailed").FormatText($"Server returned: HTTP {request.StatusCode}\n{request.GetJSON()["message"].ToString()}").Show(MessageBoxIcon.Error); } else { MsgBox.Get("nexusModsProfileRefreshFailed").FormatText($"WebException: {request.Exception.Message}").Show(MessageBoxIcon.Error); } ValidKey = false; } }
private void buttonNMRemoveAll_Click(object sender, EventArgs e) { if (MsgBox.Get("nexusModsRemoveProfile").Show(MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.pictureBoxNMProfilePicture.Image = Resources.user_white; this.textBoxAPIKey.Text = ""; NexusMods.Profile.Remove(); UpdateNMProfile(); MsgBox.Get("nexusModsRemoveProfileSuccess").Popup(MessageBoxIcon.Information); } }
// Delete folder contents private void linkLabelModDeleteFolderContents_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (MsgBox.Get("areYouSure").FormatText("Are you sure, you want to delete the folder contents?").Show(MessageBoxButtons.YesNo) == DialogResult.Yes) { if (Directory.Exists(editedMod.ManagedFolderPath)) { Directory.Delete(editedMod.ManagedFolderPath, true); } Directory.CreateDirectory(editedMod.ManagedFolderPath); UpdateProgress(Progress.Done("Deleted files.")); } }
private void backgroundWorkerDownloadLanguages_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (errorMessageDownloadLanguages != null) { MsgBox.Get("downloadLanguagesFailed").FormatText(errorMessageDownloadLanguages).Popup(MessageBoxIcon.Error); } else { MsgBox.Get("downloadLanguagesFinished").FormatText(messageDownloadLanguages).Popup(MessageBoxIcon.Information); } this.buttonDownloadLanguages.Enabled = true; this.pictureBoxSpinnerDownloadLanguages.Visible = false; Localization.LookupLanguages(); }
// Check, if *.ini files have been changed: private void timerCheckFiles_Tick(object sender, EventArgs e) { // TODO: Give an option to reload the *.ini files. // Check every 5 seconds, if files have been modified: if (IniFiles.FilesHaveBeenModified()) { IniFiles.UpdateLastModifiedDates(); // Don't prompt, if Fallout 76 is running... if (!Utils.IsProcessRunning("Project76") && // !Utils.IsProcessRunning("Project76_GamePass") && !Utils.IsProcessRunning("Fallout76")) { MsgBox.Get("iniFilesModified").Popup(MessageBoxIcon.Warning); } } }
private void buttonNMDeleteThumbnails_Click(object sender, EventArgs e) { if (MsgBox.Get("nexusModsDeleteThumbnails").Show(MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { String path = Path.Combine(Shared.GamePath, "Mods", "_thumbs"); if (Directory.Exists(path)) { Directory.Delete(path, true); } MsgBox.Get("nexusModsDeleteThumbnailsSuccess").Popup(MessageBoxIcon.Information); } catch { MsgBox.Get("nexusModsDeleteThumbnailsFailed").Popup(MessageBoxIcon.Error); } } }
private void AddFolderToModThreaded(string folderPath) { RunThreaded(() => { DisableUI(); }, () => { try { ModInstallations.AddFolder(editedMod, folderPath, false, UpdateProgress); } catch (Exception exc) { MsgBox.Get("failed").FormatText(exc.Message).Show(MessageBoxIcon.Error); return(false); } return(true); }, (success) => { EnableUI(); UpdateSidePanel(); }); }
public void Update() { List <Exception> exceptions = new List <Exception>(); foreach (OnLoadUIFunction func in OnLoadUI) { try { func(); } catch (Exception ex) { exceptions.Add(ex); } } if (exceptions.Count > 0) { MsgBox.Get("onLoadFuncException").FormatText(exceptions.Count.ToString(), exceptions[0].ToString()).Show(MessageBoxIcon.Error); } }
// "Apply" button: private void toolStripButtonApply_Click(object sender, EventArgs e) { ApplyChanges(); MsgBox.Get("changesApplied").Popup(MessageBoxIcon.Information); }
public static DialogResult ShowID(String id, MessageBoxButtons buttons) { return(MsgBox.Get(id).Show(buttons)); }
public static DialogResult ShowID(String id, MessageBoxIcon icon) { return(MsgBox.Get(id).Show(icon)); }
public static DialogResult ShowID(String id) { return(MsgBox.Get(id).Show()); }