// // Public members: // // Internal members: internal MainForm() { InitializeComponent(); this.Icon = Program.Icon; m_UpdateCheckNotification = new UpdateCheckNotificationTarget(this, new UpdateCheckedDelegate(OnUpdateChecked)); }
/// <summary> Eventhandler (re-)triggered when a updatecheck completed </summary> public void BeginCheckedNotification(UpdateCheckNotificationTarget target) { try { Monitor.Enter(m_Targets); m_Targets.AddLast(target); } finally { Monitor.Exit(m_Targets); } }
/// <remarks> Do not call upon notification (will cause deadlock). </remarks> public void EndCheckedNotification(UpdateCheckNotificationTarget target) { try { Monitor.Enter(m_Targets); m_Targets.Remove(target); } finally { Monitor.Exit(m_Targets); } }
// // Public members: // // Internal members: internal MainForm() { InitializeComponent(); this.Icon = Program.Icon; this.pictureBoxHelp.Image = SystemIcons.Information.ToBitmap(); this.Text = L10n._p("Main window", "Half-Life Advanced Effects"); this.fileToolStripMenuItem.Text = L10n._p("Main window | menu", "File"); this.menuLaunchCSGO.Text = L10n._p("Main window | menu | File", "Launch CS:GO"); this.launchGoldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | File", "Launch GoldSrc"); this.menuExit.Text = L10n._p("Main window | menu | File", "Exit"); this.viewToolStripMenuItem.Text = L10n._p("Main Window | menu", "View"); this.menuStatusBar.Text = L10n._p("Main window | menu | View", "Status Bar"); this.toolsToolStripMenuItem.Text = L10n._p("Main window | menu", "Tools"); this.calculatorsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Calculators"); this.menuFileSize.Text = L10n._p("Main window | menu | Tools | Calculators", "File Size"); this.menuAfxRgbaLut.Text = L10n._p("Main window | menu | Tools", "Color Lookup Tables"); this.menuVoronoi.Text = L10n._p("Main window | menu | Tools | Color Lookup Tables", "Voronoi"); this.goldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "GoldSrc"); this.demoToolsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Demo Tools"); this.skyManagerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Sky Manager"); this.developerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Developer"); this.menuCustomLoader.Text = L10n._p("Main window | menu | Tools | Developer", "Custom Loader"); this.menuGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "Own GUID to ClipBoard"); this.menuNewGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "New GUID to ClipBoard"); this.helpToolStripMenuItem.Text = L10n._p("Main window | menu", "Help"); this.checkForUpdatesToolStripMenuItem.Text = L10n._p("Main window | menu | Help", "Check for Updates"); this.menuAutoUpdateCheck.Text = L10n._p("Main window | menu | Help | Check for Updates", "Auto Check"); this.checkNowToolStripMenuItem.Text = L10n._p("Main window | menu | Help | Check for Updates", "Check Now"); this.menuAdvancedFxOrg.Text = L10n._p("Main window | menu | Help", "Official Website"); this.donateToolStripMenuItem.Text = L10n._p("Main window | menu", "Donate"); this.checkUpdatesLabel.Text = L10n._p("Main window | check updates strip", "Check for updates automatically?"); this.statusLabelAutoYes.Text = L10n._p("Main window | check updates strip", "Yes"); this.statusLabelAutoNo.Text = L10n._p("Main window | check updates strip", "No"); this.statusLabelIgnore.Text = L10n._p("Main window | update status strip", "Ignore"); this.statusLabelHide.Text = L10n._p("Main window | update status strip", "OK"); this.statusLabelUpdate.Text = L10n._p("Main window | update status strip | label", "Update status unknown"); this.menuContact.Text = L10n._("Contact / Privacy Policy / Imprint (advancedfx.org)"); this.groupBoxHelp.Text = L10n._("Help"); this.labelHelpLanguage.Text = L10n._("Language:"); this.labelHelpSelection.Text = L10n._("Selection:"); { HelpEntry officialEnglishSupportPage = new HelpEntry(L10n._("Official support page (English)"), "https://www.advancedfx.org/support/"); HelpEntry chinesePage = new HelpEntry(L10n._("HLAE Chinese Station"), "https://hlae.site/"); helpLanguages = new HelpLanguage[] { new HelpLanguage("en", L10n._p("Language", "English (en)"), new HelpEntry[] { officialEnglishSupportPage }), new HelpLanguage("zh-CN", L10n._p("Language", "Chinese (zh-CN)"), new HelpEntry[] { chinesePage }) }; this.comboBoxHelpLanguage.Items.AddRange(helpLanguages); string ietfLanguageTag = System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag; string twoLetterIsoLanguageName = System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; // Select a default language: int selectIndex = -1; int curIndex = 0; foreach (HelpLanguage helpLanguage in helpLanguages) { if (helpLanguage.Code.Equals(ietfLanguageTag)) { selectIndex = curIndex; break; } ++curIndex; } if (selectIndex == -1) { curIndex = 0; foreach (HelpLanguage helpLanguage in helpLanguages) { if (helpLanguage.Code.Equals(twoLetterIsoLanguageName)) { selectIndex = curIndex; break; } ++curIndex; } } if (selectIndex == -1 && 0 < helpLanguages.Length) { selectIndex = 0; } if (selectIndex != -1) { comboBoxHelpLanguage.SelectedIndex = selectIndex; } } m_UpdateCheckNotification = new UpdateCheckNotificationTarget(this, new UpdateCheckedDelegate(OnUpdateChecked)); }
// // Public members: // // Internal members: internal MainForm() { InitializeComponent(); this.Icon = Program.Icon; this.pictureBoxHelp.Image = SystemIcons.Information.ToBitmap(); this.pictureBoxPathError.Image = SystemIcons.Warning.ToBitmap(); this.Text = L10n._p("Window title, args: {0} - version", "Half-Life Advanced Effects {0}", System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion); this.fileToolStripMenuItem.Text = L10n._p("Main window | menu", "File"); this.menuLaunchCSGO.Text = L10n._p("Main window | menu | File", "Launch CS:GO"); this.launchGoldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | File", "Launch GoldSrc"); this.menuExit.Text = L10n._p("Main window | menu | File", "Exit"); this.viewToolStripMenuItem.Text = L10n._p("Main Window | menu", "View"); this.menuStatusBar.Text = L10n._p("Main window | menu | View", "Status Bar"); this.toolsToolStripMenuItem.Text = L10n._p("Main window | menu", "Tools"); this.calculatorsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Calculators"); this.menuFileSize.Text = L10n._p("Main window | menu | Tools | Calculators", "File Size"); this.menuAfxRgbaLut.Text = L10n._p("Main window | menu | Tools", "Color Lookup Tables"); this.menuVoronoi.Text = L10n._p("Main window | menu | Tools | Color Lookup Tables", "Voronoi"); this.goldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "GoldSrc"); this.demoToolsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Demo Tools"); this.skyManagerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Sky Manager"); this.developerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Developer"); this.menuCustomLoader.Text = L10n._p("Main window | menu | Tools | Developer", "Custom Loader"); this.menuGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "Own GUID to ClipBoard"); this.menuNewGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "New GUID to ClipBoard"); this.helpToolStripMenuItem.Text = L10n._p("Main window | menu", "Help"); this.checkForUpdatesToolStripMenuItem.Text = L10n._p("Main window | menu | Help", "Check for Updates"); this.menuAutoUpdateCheck.Text = L10n._p("Main window | menu | Help | Check for Updates", "Auto Check"); this.checkNowToolStripMenuItem.Text = L10n._p("Main window | menu | Help | Check for Updates", "Check Now"); this.menuAdvancedFxOrg.Text = L10n._p("Main window | menu | Help", "Official Website"); this.donateToolStripMenuItem.Text = L10n._p("Main window | menu", "Donate"); this.checkUpdatesLabel.Text = L10n._p("Main window | check updates strip", "Check for updates automatically?"); this.statusLabelAutoYes.Text = L10n._p("Main window | check updates strip", "Yes"); this.statusLabelAutoNo.Text = L10n._p("Main window | check updates strip", "No"); this.statusLabelIgnore.Text = L10n._p("Main window | update status strip", "Ignore"); this.statusLabelHide.Text = L10n._p("Main window | update status strip", "OK"); this.statusLabelUpdate.Text = L10n._p("Main window | update status strip | label", "Update status unknown"); this.menuContact.Text = L10n._("Contact / Privacy Policy / Imprint (advancedfx.org)"); this.groupBoxHelp.Text = L10n._("Help"); this.labelHelpLanguage.Text = L10n._("Language:"); this.labelHelpSelection.Text = L10n._("Selection:"); { HelpEntry officialEnglishSupportPage = new HelpEntry(L10n._("Official support page (English)"), "https://www.advancedfx.org/support/"); HelpEntry chinesePage = new HelpEntry(L10n._("HLAE Chinese Station"), "https://hlae.site/"); helpLanguages = new HelpLanguage[] { new HelpLanguage("en", L10n._p("Language", "English (en)"), new HelpEntry[] { officialEnglishSupportPage }), new HelpLanguage("zh-CN", L10n._p("Language", "Chinese (zh-CN)"), new HelpEntry[] { chinesePage }) }; this.comboBoxHelpLanguage.Items.AddRange(helpLanguages); string ietfLanguageTag = System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag; string twoLetterIsoLanguageName = System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; // Select a default language: int selectIndex = -1; int curIndex = 0; foreach (HelpLanguage helpLanguage in helpLanguages) { if (helpLanguage.Code.Equals(ietfLanguageTag)) { selectIndex = curIndex; break; } ++curIndex; } if (selectIndex == -1) { curIndex = 0; foreach (HelpLanguage helpLanguage in helpLanguages) { if (helpLanguage.Code.Equals(twoLetterIsoLanguageName)) { selectIndex = curIndex; break; } ++curIndex; } } if (selectIndex == -1 && 0 < helpLanguages.Length) { selectIndex = 0; } if (selectIndex != -1) { comboBoxHelpLanguage.SelectedIndex = selectIndex; } } bool bHlaePathOk = System.Text.RegularExpressions.Regex.IsMatch(Program.BaseDir, "^\\p{IsBasicLatin}*$"); this.groupBoxPathError.Visible = !bHlaePathOk; this.groupBoxPathError.Enabled = !bHlaePathOk; this.groupBoxPathError.Text = L10n._("HLAE path error"); this.labelHlaePath.Text = L10n._("HLAE path:"); this.textBoxHlaePath.Text = Program.BaseDir; this.labelHlaePathError.Text = L10n._("Warning: Your HLAE path shown above contains non-basic latin characters (meaning characters outside the 7-bit ASCII range), which will lead to multiple problems in-game if not fixed!"); m_UpdateCheckNotification = new UpdateCheckNotificationTarget(this, new UpdateCheckedDelegate(OnUpdateChecked)); }
// // Public members: // // Internal members: internal MainForm() { InitializeComponent(); this.Icon = Program.Icon; this.buttonManual.Image = SystemIcons.Information.ToBitmap(); this.Text = L10n._p("Main window", "Half-Life Advanced Effects"); this.fileToolStripMenuItem.Text = L10n._p("Main window | menu", "File"); this.menuLaunchCSGO.Text = L10n._p("Main window | menu | File", "Launch CS:GO"); this.launchGoldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | File", "Launch GoldSrc"); this.menuExit.Text = L10n._p("Main window | menu | File", "Exit"); this.viewToolStripMenuItem.Text = L10n._p("Main Window | menu", "View"); this.menuStatusBar.Text = L10n._p("Main window | menu | View", "Status Bar"); this.toolsToolStripMenuItem.Text = L10n._p("Main window | menu", "Tools"); this.calculatorsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Calculators"); this.menuFileSize.Text = L10n._p("Main window | menu | Tools | Calculators", "File Size"); this.goldSrcToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "GoldSrc"); this.demoToolsToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Demo Tools"); this.skyManagerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools | GoldSrc", "Sky Manager"); this.developerToolStripMenuItem.Text = L10n._p("Main window | menu | Tools", "Developer"); this.menuCustomLoader.Text = L10n._p("Main window | menu | Tools | Developer", "Custom Loader"); this.menuGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "Own GUID to ClipBoard"); this.menuNewGuidToClipBoard.Text = L10n._p("Main window | menu | Tools | Developer", "New GUID to ClipBoard"); string manualLanguage = L10n._p("Manual URL language (localized)", "English"); this.manualLink = L10n._p("Manual URL (localized)", "https://github.com/advancedfx/advancedfx/wiki"); // This is used for Process.Start, so better sanitize it: Uri uriResult; if (!Uri.TryCreate(this.manualLink, UriKind.Absolute, out uriResult) || !(uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)) { this.manualLink = "https://www.advancedfx.org/"; } this.helpToolStripMenuItem.Text = L10n._p("Main window | menu", "Help"); this.manualToolStripMenuItem.Text = L10n._p("Main window | menu | Help", "Online Manual ({0})", manualLanguage); this.manualToolStripMenuItem.ToolTipText = manualLink; this.checkForUpdatesToolStripMenuItem.Text = L10n._p("Main window | menu | Help", "Check for Updates"); this.menuAutoUpdateCheck.Text = L10n._p("Main window | menu | Help | Check for Updates", "Auto Check"); this.checkNowToolStripMenuItem.Text = L10n._p("Main window | menu | Help | Check for Updates", "Check Now"); this.menuAdvancedFxOrg.Text = L10n._p("Main window | menu | Help", "Official Website"); this.donateToolStripMenuItem.Text = L10n._p("Main window | menu", "Donate"); this.checkUpdatesLabel.Text = L10n._p("Main window | check updates strip", "Check for updates automatically?"); this.statusLabelAutoYes.Text = L10n._p("Main window | check updates strip", "Yes"); this.statusLabelAutoNo.Text = L10n._p("Main window | check updates strip", "No"); this.statusLabelIgnore.Text = L10n._p("Main window | update status strip", "Ignore"); this.statusLabelHide.Text = L10n._p("Main window | update status strip", "OK"); this.statusLabelUpdate.Text = L10n._p("Main window | update status strip | label", "Update status unknown"); this.buttonManual.Text = L10n._p("Main window", "Open Online Manual ({0})", manualLanguage); m_UpdateCheckNotification = new UpdateCheckNotificationTarget(this, new UpdateCheckedDelegate(OnUpdateChecked)); }