From eed27b41ff71d0406f8f009a0c3fbee4ddd6be23 Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Tue, 23 Oct 2018 09:09:22 +0200 Subject: [PATCH] --- CHANGELOG.md | 51 ++++- wumgr/Common/FileOps.cs | 2 +- wumgr/Common/HttpTask.cs | 2 +- wumgr/Common/MiscFunc.cs | 20 +- wumgr/GPO.cs | 331 +++++++++++++++------------ wumgr/Program.cs | 15 +- wumgr/Properties/AssemblyInfo.cs | 4 +- wumgr/Translate.cs | 168 ++++++++++++++ wumgr/UpdateInstaller.cs | 15 +- wumgr/WuAgent.cs | 46 ++-- wumgr/WuMgr.Designer.cs | 348 +++++++++++++++++------------ wumgr/WuMgr.cs | 369 ++++++++++++++++++++++--------- wumgr/wumgr.csproj | 1 + 13 files changed, 953 insertions(+), 419 deletions(-) create mode 100644 wumgr/Translate.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index be9497f..7d4468b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,55 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.8] - 2018-10-32 +### Fixed +- issue when uninstalling updates + +## [0.8c beta] - 2018-10-21 +### Added +- messge box promping for a reboot when changing update facilitator settings +- tooltips to list view for long texts + +### Changed +- some buttons are now disabled when no updates are checked + +### Fixed +- issue with supprot url's nor manualy generated mased on the kb number + + +## [0.8b beta] - 2018-10-20 +### Added +- command line parameter for scripted operation, disabling configuration options -provisioned +- added search filter ctrl+f +- addec ctrl+c to copy infos about selected updates +- added option to blacklist updates by KB using the updates ini, also collor them or pre select them + +Example: +[KB4023307] +BlackList=1 +Remove=0 +Color=#ffcccc + +[KB4343909] +Select=1 +Color=#ccffcc + +### Changed +- updates are now cached in updates.ini inside teh downloads directory, updates.ini in the working directorty is used for persistent update informations + +### Fixed +- fixed typos in transaltion thx to Carlos Detweiller and PointZero + + +## [0.8a beta] - 2018-10-19 +### Added +- translation support + +### Fixed +- crash bug in uninstall routile +- size and date columns ware out of order +- fixed some GPO related crash issues + ## [0.7] - 2018-10-05 ### Added @@ -21,8 +70,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - crash bug when firewall blocks downloads - issue client not properl abborting operations on cancesss -## [0.6b] - 2018-09-30 +## [0.6b] - 2018-09-30 ### Fixed - issues only one instance restriction - issues with list view separation diff --git a/wumgr/Common/FileOps.cs b/wumgr/Common/FileOps.cs index 67f4c3a..95041a1 100644 --- a/wumgr/Common/FileOps.cs +++ b/wumgr/Common/FileOps.cs @@ -216,7 +216,7 @@ internal static bool TakeOwn(string path) } catch (PrivilegeNotHeldException err) { - AppLog.Line("Enable SkipUAC Error {0}", err.ToString()); + AppLog.Line("Couldn't take Ownership {0}", err.ToString()); ret = false; } finally diff --git a/wumgr/Common/HttpTask.cs b/wumgr/Common/HttpTask.cs index 8581bcd..db84787 100644 --- a/wumgr/Common/HttpTask.cs +++ b/wumgr/Common/HttpTask.cs @@ -142,7 +142,7 @@ private void Finish(int Success, int ErrCode, Exception Error = null) } else if (Success == 2) { - AppLog.Line("File already dowllaoded {0}", mDlPath + @"\" + mDlName); + AppLog.Line("File already downloaded {0}", mDlPath + @"\" + mDlName); } else { diff --git a/wumgr/Common/MiscFunc.cs b/wumgr/Common/MiscFunc.cs index 9dfa5fa..44e4ea9 100644 --- a/wumgr/Common/MiscFunc.cs +++ b/wumgr/Common/MiscFunc.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Security.Principal; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -46,11 +48,25 @@ public static int parseInt(string str, int def = 0) } } - public static String fmt(string str, params object[] args) + static public Color? parseColor(string input) { - return string.Format(str, args); + ColorConverter c = new ColorConverter(); + if (Regex.IsMatch(input, "^(#[0-9A-Fa-f]{3})$|^(#[0-9A-Fa-f]{6})$")) + return (Color)c.ConvertFromString(input); + + ColorConverter.StandardValuesCollection svc = (ColorConverter.StandardValuesCollection)c.GetStandardValues(); + foreach (Color o in svc){ + if (o.Name.Equals(input, StringComparison.OrdinalIgnoreCase)) + return (Color)c.ConvertFromString(input); + } + return null; } + /*public static String fmt(string str, params object[] args) + { + return string.Format(str, args); + }*/ + public static bool IsAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); diff --git a/wumgr/GPO.cs b/wumgr/GPO.cs index 576dd36..5ec16ba 100644 --- a/wumgr/GPO.cs +++ b/wumgr/GPO.cs @@ -26,197 +26,243 @@ public enum AUOptions static public void ConfigAU(AUOptions option, int day = -1, int time = -1) { - var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO + @"\AU", true); - switch (option) + try { - case AUOptions.Default: //Automatic(default) - subKey.DeleteValue("NoAutoUpdate", false); - subKey.DeleteValue("AUOptions", false); - break; - case AUOptions.Disabled: //Disabled - subKey.SetValue("NoAutoUpdate", 1); - subKey.DeleteValue("AUOptions", false); - break; - case AUOptions.Notification: //Notification only - subKey.SetValue("NoAutoUpdate", 0); - subKey.SetValue("AUOptions", 2); - break; - case AUOptions.Download: //Download only - subKey.SetValue("NoAutoUpdate", 0); - subKey.SetValue("AUOptions", 3); - break; - case AUOptions.Scheduled: //Scheduled Installation - subKey.SetValue("NoAutoUpdate", 0); - subKey.SetValue("AUOptions", 4); - break; - case AUOptions.ManagedByAdmin: //Managed by Admin - subKey.SetValue("NoAutoUpdate", 0); - subKey.SetValue("AUOptions", 5); - break; - } + var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO + @"\AU", true); + switch (option) + { + case AUOptions.Default: //Automatic(default) + subKey.DeleteValue("NoAutoUpdate", false); + subKey.DeleteValue("AUOptions", false); + break; + case AUOptions.Disabled: //Disabled + subKey.SetValue("NoAutoUpdate", 1); + subKey.DeleteValue("AUOptions", false); + break; + case AUOptions.Notification: //Notification only + subKey.SetValue("NoAutoUpdate", 0); + subKey.SetValue("AUOptions", 2); + break; + case AUOptions.Download: //Download only + subKey.SetValue("NoAutoUpdate", 0); + subKey.SetValue("AUOptions", 3); + break; + case AUOptions.Scheduled: //Scheduled Installation + subKey.SetValue("NoAutoUpdate", 0); + subKey.SetValue("AUOptions", 4); + break; + case AUOptions.ManagedByAdmin: //Managed by Admin + subKey.SetValue("NoAutoUpdate", 0); + subKey.SetValue("AUOptions", 5); + break; + } - if (option == AUOptions.Scheduled) - { - if(day != -1) subKey.SetValue("ScheduledInstallDay", day); - if (time != -1) subKey.SetValue("ScheduledInstallTime", time); - } - else - { - subKey.DeleteValue("ScheduledInstallDay", false); - subKey.DeleteValue("ScheduledInstallTime", false); + if (option == AUOptions.Scheduled) + { + if (day != -1) subKey.SetValue("ScheduledInstallDay", day); + if (time != -1) subKey.SetValue("ScheduledInstallTime", time); + } + else + { + subKey.DeleteValue("ScheduledInstallDay", false); + subKey.DeleteValue("ScheduledInstallTime", false); + } } + catch { } } static public AUOptions GetAU(out int day, out int time) { AUOptions option = AUOptions.Default; - - var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO + @"\AU", false); - object value_no = subKey.GetValue("NoAutoUpdate"); - if (value_no == null || (int)value_no == 0) + try { - object value_au = subKey.GetValue("AUOptions"); - switch (value_au == null ? 0 : (int)value_au) + var subKey = Registry.LocalMachine.OpenSubKey(mWuGPO + @"\AU", false); + object value_no = subKey == null ? null : subKey.GetValue("NoAutoUpdate"); + if (value_no == null || (int)value_no == 0) { - case 0: option = AUOptions.Default; break; - case 2: option = AUOptions.Notification; break; - case 3: option = AUOptions.Download; break; - case 4: option = AUOptions.Scheduled; break; - case 5: option = AUOptions.ManagedByAdmin; break; + object value_au = subKey == null ? null : subKey.GetValue("AUOptions"); + switch (value_au == null ? 0 : (int)value_au) + { + case 0: option = AUOptions.Default; break; + case 2: option = AUOptions.Notification; break; + case 3: option = AUOptions.Download; break; + case 4: option = AUOptions.Scheduled; break; + case 5: option = AUOptions.ManagedByAdmin; break; + } + } + else + { + option = AUOptions.Disabled; } - } - else - { - option = AUOptions.Disabled; - } - - object value_day = subKey.GetValue("ScheduledInstallDay"); - day = value_day != null ? (int)value_day : 0; - object value_time = subKey.GetValue("ScheduledInstallTime"); - time = value_time != null ? (int)value_time : 0; + object value_day = subKey.GetValue("ScheduledInstallDay"); + day = value_day != null ? (int)value_day : 0; + object value_time = subKey.GetValue("ScheduledInstallTime"); + time = value_time != null ? (int)value_time : 0; + } + catch { day = 0; time = 0; } return option; } static public void ConfigDriverAU(int option) { - var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO, true); - switch (option) + try { - case 0: // CheckState.Unchecked: - subKey.SetValue("ExcludeWUDriversInQualityUpdate", 1); - break; - case 2: // CheckState.Indeterminate: - subKey.DeleteValue("ExcludeWUDriversInQualityUpdate", false); - break; - case 1: // CheckState.Checked: - subKey.SetValue("ExcludeWUDriversInQualityUpdate", 0); - break; + var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO, true); + switch (option) + { + case 0: // CheckState.Unchecked: + subKey.SetValue("ExcludeWUDriversInQualityUpdate", 1); + break; + case 2: // CheckState.Indeterminate: + subKey.DeleteValue("ExcludeWUDriversInQualityUpdate", false); + break; + case 1: // CheckState.Checked: + subKey.SetValue("ExcludeWUDriversInQualityUpdate", 0); + break; + } } + catch { } } static public int GetDriverAU() { - var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO, false); - object value_drv = subKey.GetValue("ExcludeWUDriversInQualityUpdate"); - - if (value_drv == null) - return 2; // CheckState.Indeterminate; - else if ((int)value_drv == 1) - return 0; // CheckState.Unchecked; - else //if ((int)value_drv == 0) - return 1; // CheckState.Checked; + try + { + var subKey = Registry.LocalMachine.OpenSubKey(mWuGPO, false); + object value_drv = subKey == null ? null : subKey.GetValue("ExcludeWUDriversInQualityUpdate"); + + if (value_drv == null) + return 2; // CheckState.Indeterminate; + else if ((int)value_drv == 1) + return 0; // CheckState.Unchecked; + else //if ((int)value_drv == 0) + return 1; // CheckState.Checked + } + catch { } + return 2; } static public void HideUpdatePage(bool hide = true) { - var subKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", true); - if (hide) - subKey.SetValue("SettingsPageVisibility", "hide:windowsupdate"); - else - subKey.DeleteValue("SettingsPageVisibility", false); + try + { + var subKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", true); + if (hide) + subKey.SetValue("SettingsPageVisibility", "hide:windowsupdate"); + else + subKey.DeleteValue("SettingsPageVisibility", false); + } + catch { } } static public bool IsUpdatePageHidden() { - var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer"); - string value = subKey == null ? null : subKey.GetValue("SettingsPageVisibility", "").ToString(); - return value.Contains("hide:windowsupdate"); + try + { + var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer"); + string value = subKey == null ? null : subKey.GetValue("SettingsPageVisibility", "").ToString(); + return value.Contains("hide:windowsupdate"); + } + catch { } + return false; } static public void BlockMS(bool block = true) { - if (block) - { - var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO, true); - subKey.SetValue("DoNotConnectToWindowsUpdateInternetLocations", 1); - subKey.SetValue("WUServer", "\" \""); - subKey.SetValue("WUStatusServer", "\" \""); - subKey.SetValue("UpdateServiceUrlAlternate", "\" \""); - - var subKey2 = Registry.LocalMachine.CreateSubKey(mWuGPO + @"\AU", true); - subKey2.SetValue("UseWUServer", 1); - } - else + try { - var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO, true); - subKey.DeleteValue("DoNotConnectToWindowsUpdateInternetLocations", false); - subKey.DeleteValue("WUServer", false); - subKey.DeleteValue("WUStatusServer", false); - subKey.DeleteValue("UpdateServiceUrlAlternate", false); - - var subKey2 = Registry.LocalMachine.CreateSubKey(mWuGPO + @"\AU", true); - subKey2.DeleteValue("UseWUServer", false); + if (block) + { + var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO, true); + subKey.SetValue("DoNotConnectToWindowsUpdateInternetLocations", 1); + subKey.SetValue("WUServer", "\" \""); + subKey.SetValue("WUStatusServer", "\" \""); + subKey.SetValue("UpdateServiceUrlAlternate", "\" \""); + + var subKey2 = Registry.LocalMachine.CreateSubKey(mWuGPO + @"\AU", true); + subKey2.SetValue("UseWUServer", 1); + } + else + { + var subKey = Registry.LocalMachine.CreateSubKey(mWuGPO, true); + subKey.DeleteValue("DoNotConnectToWindowsUpdateInternetLocations", false); + subKey.DeleteValue("WUServer", false); + subKey.DeleteValue("WUStatusServer", false); + subKey.DeleteValue("UpdateServiceUrlAlternate", false); + + var subKey2 = Registry.LocalMachine.CreateSubKey(mWuGPO + @"\AU", true); + subKey2.DeleteValue("UseWUServer", false); + } } + catch { } } static public int GetBlockMS() { - var subKey = Registry.LocalMachine.OpenSubKey(mWuGPO); + try + { + var subKey = Registry.LocalMachine.OpenSubKey(mWuGPO, false); - object value_block = subKey == null ? null : subKey.GetValue("DoNotConnectToWindowsUpdateInternetLocations"); + object value_block = subKey == null ? null : subKey.GetValue("DoNotConnectToWindowsUpdateInternetLocations"); - var subKey2 = Registry.LocalMachine.OpenSubKey(mWuGPO + @"\AU"); - object value_wsus = subKey2 == null ? null : subKey2.GetValue("UseWUServer"); + var subKey2 = Registry.LocalMachine.OpenSubKey(mWuGPO + @"\AU", false); + object value_wsus = subKey2 == null ? null : subKey2.GetValue("UseWUServer"); - if ((value_block != null && (int)value_block == 1) && (value_wsus != null && (int)value_wsus == 1)) - return 1; // CheckState.Checked; - else if ((value_block == null || (int)value_block == 0) && (value_wsus == null || (int)value_wsus == 0)) - return 0; // CheckState.Unchecked; - else - return 2; // CheckState.Indeterminate; + if ((value_block != null && (int)value_block == 1) && (value_wsus != null && (int)value_wsus == 1)) + return 1; // CheckState.Checked; + else if ((value_block == null || (int)value_block == 0) && (value_wsus == null || (int)value_wsus == 0)) + return 0; // CheckState.Unchecked; + else + return 2; // CheckState.Indeterminate; + } + catch { } + return 2; } static public void SetStoreAU(bool disable) { - var subKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\WindowsStore", true); - //var subKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate", true); - if (disable) - subKey.SetValue("AutoDownload", 2); - else - subKey.DeleteValue("AutoDownload", false); // subKey.SetValue("AutoDownload", 4); + try + { + var subKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\WindowsStore", true); + //var subKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate", true); + if (disable) + subKey.SetValue("AutoDownload", 2); + else + subKey.DeleteValue("AutoDownload", false); // subKey.SetValue("AutoDownload", 4); + } + catch { } } static public bool GetStoreAU() { - var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Policies\Microsoft\WindowsStore"); - //var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate"); - object value_block = subKey == null ? null : subKey.GetValue("AutoDownload"); - return (value_block != null && (int)value_block == 2); + try + { + var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Policies\Microsoft\WindowsStore", false); + //var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate"); + object value_block = subKey == null ? null : subKey.GetValue("AutoDownload"); + return (value_block != null && (int)value_block == 2); + } + catch { } + return false; } static public void DisableAU(bool disable) { - if (disable) - { - ConfigSvc("UsoSvc", ServiceStartMode.Disabled); // Update Orchestrator Service - ConfigSvc("WaaSMedicSvc", ServiceStartMode.Disabled); // Windows Update Medic Service - } - else + try { - ConfigSvc("UsoSvc", ServiceStartMode.Automatic); // Update Orchestrator Service - ConfigSvc("WaaSMedicSvc", ServiceStartMode.Manual); // Windows Update Medic Service + if (disable) + { + ConfigSvc("UsoSvc", ServiceStartMode.Disabled); // Update Orchestrator Service + ConfigSvc("WaaSMedicSvc", ServiceStartMode.Disabled); // Windows Update Medic Service + } + else + { + ConfigSvc("UsoSvc", ServiceStartMode.Automatic); // Update Orchestrator Service + ConfigSvc("WaaSMedicSvc", ServiceStartMode.Manual); // Windows Update Medic Service + } } + catch { } } static public void ConfigSvc(string name, ServiceStartMode mode) @@ -234,7 +280,7 @@ static public void ConfigSvc(string name, ServiceStartMode mode) // Note: for UsoSvc and for WaaSMedicSvc this call fails with an access error so we have to set the registry //ServiceHelper.ChangeStartMode(svc, mode); } - catch (Exception err) + catch { if(showErr) AppLog.Line("Error Stoping Service: {0}", name); @@ -271,8 +317,13 @@ static public bool GetDisableAU() static public bool IsSvcDisabled(string name) { - var subKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + name); - return subKey == null || (MiscFunc.parseInt(subKey.GetValue("Start", "-1").ToString()) == (int)ServiceStartMode.Disabled); + try + { + var subKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\" + name, false); + return subKey == null || (MiscFunc.parseInt(subKey.GetValue("Start", "-1").ToString()) == (int)ServiceStartMode.Disabled); + } + catch { } + return false; } public enum Respect @@ -287,7 +338,9 @@ static public Respect GetRespect() { try { - var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"); + var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + if(subKey == null) + return Respect.Unknown; //string edition = subKey.GetValue("EditionID", "").ToString(); string name = subKey.GetValue("ProductName", "").ToString(); string type = subKey.GetValue("InstallationType", "").ToString(); @@ -311,7 +364,9 @@ static public float GetWinVersion() { try { - var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"); + var subKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false); + if (subKey == null) + return 0.0f; //string Majorversion = subKey.GetValue("CurrentMajorVersionNumber", "0").ToString(); // this is 10 on 10 but not present on earlier editions string version = subKey.GetValue("CurrentVersion", "0").ToString(); float version_num = float.Parse(version, System.Globalization.CultureInfo.InvariantCulture.NumberFormat); diff --git a/wumgr/Program.cs b/wumgr/Program.cs index d509eaf..334eac8 100644 --- a/wumgr/Program.cs +++ b/wumgr/Program.cs @@ -56,12 +56,15 @@ static void Main(string[] args) Console.WriteLine("Starting..."); + appPath = Path.GetDirectoryName(Application.ExecutablePath); System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); mVersion = fvi.FileMajorPart + "." + fvi.FileMinorPart; if (fvi.FileBuildPart != 0) mVersion += (char)('a' + (fvi.FileBuildPart - 1)); + Translate.Load(); + AppLog Log = new AppLog(); AppLog.Line("{0}, Version v{1} by David Xanatos", mName, mVersion); AppLog.Line("This Tool is Open Source under the GNU General Public License, Version 3\r\n"); @@ -75,13 +78,13 @@ static void Main(string[] args) client.Send("show"); string ret = client.Read(1000); if(!ret.Equals("ok", StringComparison.CurrentCultureIgnoreCase)) - MessageBox.Show(MiscFunc.fmt("Application is already running.")); + MessageBox.Show(Translate.fmt("msg_running")); return; } if (!MiscFunc.IsAdministrator() && !MiscFunc.IsDebugging()) { - Console.WriteLine("Trying to get admin privilegs..."); + Console.WriteLine("Trying to get admin privileges..."); if (SkipUacRun()) { @@ -106,13 +109,13 @@ static void Main(string[] args) } catch { - //MessageBox.Show(MiscFunc.fmt("The {0} requirers Administrator privilegs in order to install updates", mName), mName); - AppLog.Line("Administrator privilegs are required in order to install updates."); + //MessageBox.Show(Translate.fmt("msg_admin_req", mName), mName); + AppLog.Line("Administrator privileges are required in order to install updates."); } } } - wrkPath = appPath = Path.GetDirectoryName(Application.ExecutablePath); + wrkPath = appPath; if (!FileOps.TestWrite(GetINIPath())) { @@ -130,7 +133,7 @@ static void Main(string[] args) } catch { - MessageBox.Show(MiscFunc.fmt("Can't write to working directory: {0}", wrkPath), mName); + MessageBox.Show(Translate.fmt("msg_ro_wrk_dir", wrkPath), mName); } } diff --git a/wumgr/Properties/AssemblyInfo.cs b/wumgr/Properties/AssemblyInfo.cs index 7cd3b26..0b61902 100644 --- a/wumgr/Properties/AssemblyInfo.cs +++ b/wumgr/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.7.0")] -[assembly: AssemblyFileVersion("0.7.0")] +[assembly: AssemblyVersion("0.8.0")] +[assembly: AssemblyFileVersion("0.8.0")] diff --git a/wumgr/Translate.cs b/wumgr/Translate.cs new file mode 100644 index 0000000..d7b0f36 --- /dev/null +++ b/wumgr/Translate.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace wumgr +{ + static public class Translate + { + static SortedDictionary mStrings = new SortedDictionary(); + + static public void Load(string lang = "") + { + if (lang == "") + { + CultureInfo ci = CultureInfo.InstalledUICulture; + + /*Console.WriteLine("Default Language Info:"); + Console.WriteLine("* Name: {0}", ci.Name); + Console.WriteLine("* Display Name: {0}", ci.DisplayName); + Console.WriteLine("* English Name: {0}", ci.EnglishName); + Console.WriteLine("* 2-letter ISO Name: {0}", ci.TwoLetterISOLanguageName); + Console.WriteLine("* 3-letter ISO Name: {0}", ci.ThreeLetterISOLanguageName); + Console.WriteLine("* 3-letter Win32 API Name: {0}", ci.ThreeLetterWindowsLanguageName);*/ + + lang = ci.TwoLetterISOLanguageName; + } + + + mStrings.Add("msg_running", "Application is already running."); + mStrings.Add("msg_admin_req", "The {0} requires Administrator privileges in order to install updates"); + mStrings.Add("msg_ro_wrk_dir", "Can't write to working directory: {0}"); + mStrings.Add("cap_chk_upd", "Please Check For Updates"); + mStrings.Add("msg_chk_upd", "{0} couldn't check for updates for {1} days, please check for updates manually and resolve possible issues"); + mStrings.Add("cap_new_upd", "New Updates found"); + mStrings.Add("msg_new_upd", "{0} has found {1} new updates, please review the updates and install them"); + mStrings.Add("lbl_fnd_upd", "Windows Update ({0})"); + mStrings.Add("lbl_inst_upd", "Installed Updates ({0})"); + mStrings.Add("lbl_block_upd", "Hidden Updates ({0})"); + mStrings.Add("lbl_old_upd", "Update History ({0})"); + mStrings.Add("msg_tool_err", "Failed to start tool"); + mStrings.Add("msg_admin_dl", "Administrator privileges are required in order to download updates using windows update services. Use 'Manual' download instead."); + mStrings.Add("msg_admin_inst", "Administrator privileges are required in order to install updates."); + mStrings.Add("msg_admin_rem", "Administrator privileges are required in order to remove updates."); + mStrings.Add("msg_dl_done", "Updates downloaded to {0}, ready to be installed by the user."); + mStrings.Add("msg_dl_err", "Updates downloaded to {0}, some updates failed to download."); + mStrings.Add("msg_inst_done", "Updates successfully installed, however, a reboot is required."); + mStrings.Add("msg_inst_err", "Installation of some Updates has failed, also a reboot is required."); + mStrings.Add("err_admin", "Required privileges are not available"); + mStrings.Add("err_busy", "Another operation is already in progress"); + mStrings.Add("err_dl", "Download failed"); + mStrings.Add("err_inst", "Installation failed"); + mStrings.Add("err_no_sel", "No selected updates or no updates eligible for the operation"); + mStrings.Add("err_int", "Internal error"); + mStrings.Add("err_file", "Required file(s) could not be found"); + mStrings.Add("msg_err", "{0} failed: {1}."); + mStrings.Add("msg_wuau", "Windows Update Service is not available, try to start it?"); + mStrings.Add("menu_tools", "&Tools"); + mStrings.Add("menu_about", "&About"); + mStrings.Add("menu_exit", "E&xit"); + mStrings.Add("stat_not_start", "Not Started"); + mStrings.Add("stat_in_prog", "In Progress"); + mStrings.Add("stat_success", "Succeeded"); + mStrings.Add("stat_success_2", "Succeeded with Errors"); + mStrings.Add("stat_failed", "Failed"); + mStrings.Add("stat_abbort", "Aborted"); + mStrings.Add("stat_beta", "Beta"); + mStrings.Add("stat_install", "Installed"); + mStrings.Add("stat_rem", "Removable"); + mStrings.Add("stat_block", "Hidden"); + mStrings.Add("stat_dl", "Downloaded"); + mStrings.Add("stat_pending", "Pending"); + mStrings.Add("stat_sel", "(!)"); + mStrings.Add("stat_mand", "Mandatory"); + mStrings.Add("stat_excl", "Exclusive"); + mStrings.Add("stat_reboot", "Needs Reboot"); + mStrings.Add("menu_wuau", "Windows Update Service"); + mStrings.Add("menu_refresh", "&Refresh"); + mStrings.Add("op_check", "Checking for Updates"); + mStrings.Add("op_prep", "Preparing Check"); + mStrings.Add("op_dl", "Downloading Updates"); + mStrings.Add("op_inst", "Installing Updates"); + mStrings.Add("op_rem", "Removing Updates"); + mStrings.Add("op_cancel", "Cancelling Operation"); + mStrings.Add("op_unk", "Unknown Operation"); + mStrings.Add("msg_gpo", "Your version of Windows does not respect the standard GPO's, to keep automatic Windows updates blocked, update facilitation services must be disabled."); + mStrings.Add("col_title", "Title"); + mStrings.Add("col_cat", "Category"); + mStrings.Add("col_kb", "KB Article"); + mStrings.Add("col_date", "Date"); + mStrings.Add("col_site", "Size"); + mStrings.Add("col_stat", "State"); + mStrings.Add("lbl_support", "Support Url"); + mStrings.Add("lbl_search", "Search filter:"); + mStrings.Add("tip_search", "Search"); + mStrings.Add("tip_inst", "Install"); + mStrings.Add("tip_dl", "Download"); + mStrings.Add("tip_hide", "Hide"); + mStrings.Add("tip_lnk", "Get Links"); + mStrings.Add("tip_rem", "Uninstall"); + mStrings.Add("tip_cancel", "Cancel"); + mStrings.Add("lbl_opt", "Options"); + mStrings.Add("lbl_au", "Auto Update"); + mStrings.Add("lbl_off", "Offline Mode"); + mStrings.Add("lbl_dl", "Download wsusscn2.cab"); + mStrings.Add("lbl_man", "'Manual' Download/Install"); + mStrings.Add("lbl_old", "Include superseded"); + mStrings.Add("lbl_ms", "Register Microsoft Update"); + mStrings.Add("lbl_start", "Startup"); + mStrings.Add("lbl_auto", "Run in background"); + mStrings.Add("lbl_ac_no", "No auto search for updates"); + mStrings.Add("lbl_ac_day", "Search for updates every day"); + mStrings.Add("lbl_ac_week", "Search for updates once a week"); + mStrings.Add("lbl_ac_month", "Search for updates every month"); + mStrings.Add("lbl_uac", "Always run as Administrator"); + mStrings.Add("lbl_block_ms", "Block Access to WU Servers"); + mStrings.Add("lbl_au_off", "Disable Automatic Update"); + mStrings.Add("lbl_au_dissable", "Disable Update Facilitators"); + mStrings.Add("lbl_au_notify", "Notification Only"); + mStrings.Add("lbl_au_dl", "Download Only"); + mStrings.Add("lbl_au_time", "Scheduled & Installation"); + mStrings.Add("lbl_au_def", "Automatic Update (default)"); + mStrings.Add("lbl_hide", "Hide WU Settings Page"); + mStrings.Add("lbl_store", "Disable Store Auto Update"); + mStrings.Add("lbl_drv", "Include Drivers"); + mStrings.Add("msg_disable_au", "For the new configuration to fully take effect a reboot is required."); + + string langINI = Program.appPath + @"\Translation.ini"; + + if (!File.Exists(langINI)) + { + foreach (string key in mStrings.Keys) + Program.IniWriteValue("en", key, mStrings[key], langINI); + return; + } + + if (lang != "en") + { + foreach (string key in mStrings.Keys.ToList()) + { + string str = Program.IniReadValue(lang, key, "", langINI); + if (str.Length == 0) + continue; + + mStrings.Remove(key); + mStrings.Add(key, str); + } + } + } + + static public string fmt(string id, params object[] args) + { + try + { + string str = id; + mStrings.TryGetValue(id, out str); + return string.Format(str, args); + } + catch + { + return "err on " + id; + } + } + } +} diff --git a/wumgr/UpdateInstaller.cs b/wumgr/UpdateInstaller.cs index 27de985..1760fbb 100644 --- a/wumgr/UpdateInstaller.cs +++ b/wumgr/UpdateInstaller.cs @@ -54,7 +54,7 @@ public bool UnInstall(List Updates) DoInstall = false; NextUpdate(); - return false; + return true; } public bool IsBusy() @@ -302,20 +302,19 @@ public void RunUnInstall(object parameters) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = @"%SystemRoot%\System32\wusa.exe"; - startInfo.Arguments = "/uninstall /kb:" + KB.Substring(2) + " /quiet /norestart"; + startInfo.Arguments = "/uninstall /kb:" + KB.Substring(2) + " /norestart"; // /quiet int exitCode = ExecTask(startInfo); - if (exitCode == 3010 || exitCode == 3010) - reboot = true; // reboot requires - else if (exitCode == 1641) + if (exitCode == 3010 || exitCode == 3010 || exitCode == 1641) { - AppLog.Line("Error, reboot got initiated: {0}", KB); - reboot = true; // reboot in initiated, WTF !!!! - ok = false; + reboot = true; } else if (exitCode != 1 && exitCode != 0) + { + AppLog.Line("Error, exit coded: {0}", exitCode); ok = false; // some error + } } catch (Exception e) { diff --git a/wumgr/WuAgent.cs b/wumgr/WuAgent.cs index 907ea34..996336b 100644 --- a/wumgr/WuAgent.cs +++ b/wumgr/WuAgent.cs @@ -356,10 +356,7 @@ public RetCodes SearchForUpdates(bool Download, bool IncludePotentiallySupersede download.FileName = "wsusscn2.cab"; downloads.Add(download); if(!mUpdateDownloader.Download(downloads)) - { OnFinished(RetCodes.DownloadFailed); - return RetCodes.DownloadFailed; - } return RetCodes.InProgress; } @@ -475,10 +472,7 @@ public RetCodes DownloadUpdatesManually(List Updates, bool Install = f } if (!mUpdateDownloader.Download(downloads, Updates)) - { OnFinished(RetCodes.DownloadFailed); - return RetCodes.DownloadFailed; - } return RetCodes.InProgress; } @@ -501,7 +495,7 @@ private RetCodes InstallUpdatesManually(List Updates, MultiValueDictio } - public RetCodes UnInstallUpdatesOffline(List Updates) + public RetCodes UnInstallUpdatesManually(List Updates) { if (mUpdateInstaller.IsBusy()) return RetCodes.Busy; @@ -509,12 +503,25 @@ public RetCodes UnInstallUpdatesOffline(List Updates) mCurOperation = AgentOperation.RemoveingUpdates; OnProgress(-1, 0, 0, 0); - if (!mUpdateInstaller.UnInstall(Updates)) + List FilteredUpdates = new List(); + foreach (MsUpdate Update in Updates) { - OnFinished(RetCodes.InstallFailed); - return RetCodes.InstallFailed; + if (((int)Update.Attributes & (int)MsUpdate.UpdateAttr.Uninstallable) == 0) + { + AppLog.Line("Update can not be uninstalled: {0}", Update.Title); + continue; + } + FilteredUpdates.Add(Update); + } + if (FilteredUpdates.Count == 0) + { + AppLog.Line("No updates selected or eligible for uninstallation"); + return RetCodes.NoUpdated; } + if (!mUpdateInstaller.UnInstall(FilteredUpdates)) + OnFinished(RetCodes.InstallFailed); + return RetCodes.InProgress; } @@ -609,7 +616,7 @@ void InstallFinished(object sender, UpdateInstaller.FinishedEventArgs args) // " AppLog.Line("Updates failed to (Un)Install"); if (args.Reboot) - AppLog.Line("Reboot is required for one of more updates"); + AppLog.Line("Reboot is required for one or more updates"); OnUpdatesChanged(); @@ -689,7 +696,7 @@ private RetCodes InstallUpdates(List Updates) if (mInstaller.Updates.Count == 0) { - AppLog.Line("No updates selected for instalation"); + AppLog.Line("No updates selected for installation"); return RetCodes.NoUpdated; } @@ -710,7 +717,8 @@ private RetCodes InstallUpdates(List Updates) return RetCodes.InProgress; } - public RetCodes UnInstallUpdates(List Updates) + // Note: this works _only_ for updates installed from WSUS + /*public RetCodes UnInstallUpdates(List Updates) { if (mCallback != null) return RetCodes.Busy; @@ -732,7 +740,7 @@ public RetCodes UnInstallUpdates(List Updates) } mInstaller.Updates.Add(update); } - if (mDownloader.Updates.Count == 0) + if (mInstaller.Updates.Count == 0) { AppLog.Line("No updates selected or eligible for uninstallation"); return RetCodes.NoUpdated; @@ -753,7 +761,7 @@ public RetCodes UnInstallUpdates(List Updates) return OnWuError(err); } return RetCodes.InProgress; - } + }*/ public bool RemoveFrom(List Updates, MsUpdate Update) { @@ -940,7 +948,7 @@ protected void OnInstalationCompleted(IInstallationJob installationJob, List Updates) { - string INIPath = Program.wrkPath + @"\updates.ini"; + string INIPath = dlPath + @"\updates.ini"; foreach (MsUpdate Update in Updates) { if (Update.KB.Length == 0) // sanity check @@ -1095,7 +1103,7 @@ private void StoreUpdates(List Updates) private void LoadUpdates() { - string INIPath = Program.wrkPath + @"\updates.ini"; + string INIPath = dlPath + @"\updates.ini"; foreach (string KB in Program.IniEnumSections(INIPath)) { if (KB.Length == 0) diff --git a/wumgr/WuMgr.Designer.cs b/wumgr/WuMgr.Designer.cs index 7ff3501..027ebe4 100644 --- a/wumgr/WuMgr.Designer.cs +++ b/wumgr/WuMgr.Designer.cs @@ -33,17 +33,14 @@ private void InitializeComponent() this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.chkAutoRun = new System.Windows.Forms.CheckBox(); this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); - this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); - this.logBox = new System.Windows.Forms.RichTextBox(); + this.panelList = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel7 = new System.Windows.Forms.TableLayoutPanel(); this.lblSupport = new System.Windows.Forms.LinkLabel(); - this.updateView = new wumgr.ListViewExtended(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.logBox = new System.Windows.Forms.RichTextBox(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.btnSearchOff = new System.Windows.Forms.Button(); + this.txtFilter = new System.Windows.Forms.TextBox(); + this.lblSearch = new System.Windows.Forms.Label(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); @@ -61,9 +58,9 @@ private void InitializeComponent() this.btnInstalled = new System.Windows.Forms.CheckBox(); this.btnWinUpd = new System.Windows.Forms.CheckBox(); this.lblStatus = new System.Windows.Forms.Label(); - this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabs = new System.Windows.Forms.TabControl(); this.tabOptions = new System.Windows.Forms.TabPage(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.gbStartup = new System.Windows.Forms.GroupBox(); this.chkNoUAC = new System.Windows.Forms.CheckBox(); this.dlAutoCheck = new System.Windows.Forms.ComboBox(); this.dlSource = new System.Windows.Forms.ComboBox(); @@ -72,7 +69,7 @@ private void InitializeComponent() this.chkOld = new System.Windows.Forms.CheckBox(); this.chkManual = new System.Windows.Forms.CheckBox(); this.chkDownload = new System.Windows.Forms.CheckBox(); - this.tabGPO = new System.Windows.Forms.TabPage(); + this.tabAU = new System.Windows.Forms.TabPage(); this.label1 = new System.Windows.Forms.Label(); this.chkDrivers = new System.Windows.Forms.CheckBox(); this.chkStore = new System.Windows.Forms.CheckBox(); @@ -87,16 +84,24 @@ private void InitializeComponent() this.dlShDay = new System.Windows.Forms.ComboBox(); this.dlShTime = new System.Windows.Forms.ComboBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel3.SuspendLayout(); + this.updateView = new wumgr.ListViewExtended(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.panelList.SuspendLayout(); this.tableLayoutPanel7.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.tableLayoutPanel5.SuspendLayout(); - this.tabControl1.SuspendLayout(); + this.tabs.SuspendLayout(); this.tabOptions.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.tabGPO.SuspendLayout(); + this.gbStartup.SuspendLayout(); + this.tabAU.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -120,37 +125,27 @@ private void InitializeComponent() this.notifyIcon.BalloonTipClicked += new System.EventHandler(this.notifyIcon_BalloonTipClicked); this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick); // - // tableLayoutPanel3 + // panelList // - this.tableLayoutPanel3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.panelList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel3.ColumnCount = 1; - this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel3.Controls.Add(this.logBox, 0, 2); - this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel7, 0, 0); - this.tableLayoutPanel3.Controls.Add(this.updateView, 0, 1); - this.tableLayoutPanel3.Location = new System.Drawing.Point(188, 0); - this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(0); - this.tableLayoutPanel3.Name = "tableLayoutPanel3"; - this.tableLayoutPanel3.RowCount = 3; - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 100F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(495, 443); - this.tableLayoutPanel3.TabIndex = 1; - // - // logBox - // - this.logBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.logBox.Location = new System.Drawing.Point(3, 346); - this.logBox.Name = "logBox"; - this.logBox.ReadOnly = true; - this.logBox.Size = new System.Drawing.Size(489, 94); - this.logBox.TabIndex = 4; - this.logBox.Text = ""; + this.panelList.ColumnCount = 1; + this.panelList.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.panelList.Controls.Add(this.tableLayoutPanel7, 0, 0); + this.panelList.Controls.Add(this.updateView, 0, 1); + this.panelList.Controls.Add(this.logBox, 0, 3); + this.panelList.Controls.Add(this.tableLayoutPanel3, 0, 2); + this.panelList.Location = new System.Drawing.Point(188, 0); + this.panelList.Margin = new System.Windows.Forms.Padding(0); + this.panelList.Name = "panelList"; + this.panelList.RowCount = 4; + this.panelList.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.panelList.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.panelList.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.panelList.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 100F)); + this.panelList.Size = new System.Drawing.Size(495, 443); + this.panelList.TabIndex = 1; // // tableLayoutPanel7 // @@ -182,56 +177,68 @@ private void InitializeComponent() this.lblSupport.Visible = false; this.lblSupport.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblSupport_LinkClicked); // - // updateView + // logBox // - this.updateView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.logBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.updateView.CheckBoxes = true; - this.updateView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1, - this.columnHeader2, - this.columnHeader3, - this.columnHeader4, - this.columnHeader5, - this.columnHeader6}); - this.updateView.Location = new System.Drawing.Point(3, 23); - this.updateView.Name = "updateView"; - this.updateView.Size = new System.Drawing.Size(489, 317); - this.updateView.TabIndex = 2; - this.updateView.UseCompatibleStateImageBehavior = false; - this.updateView.View = System.Windows.Forms.View.Details; - this.updateView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.updateView_ColumnClick); - this.updateView.SelectedIndexChanged += new System.EventHandler(this.updateView_SelectedIndexChanged); - // - // columnHeader1 - // - this.columnHeader1.Text = "Title"; - this.columnHeader1.Width = 260; - // - // columnHeader2 - // - this.columnHeader2.Text = "Category"; - this.columnHeader2.Width = 100; - // - // columnHeader3 - // - this.columnHeader3.Text = "KB Article"; - this.columnHeader3.Width = 80; + this.logBox.Location = new System.Drawing.Point(3, 346); + this.logBox.Name = "logBox"; + this.logBox.ReadOnly = true; + this.logBox.Size = new System.Drawing.Size(489, 94); + this.logBox.TabIndex = 4; + this.logBox.Text = ""; // - // columnHeader4 + // tableLayoutPanel3 // - this.columnHeader4.Text = "Date"; - this.columnHeader4.Width = 70; + this.tableLayoutPanel3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanel3.ColumnCount = 3; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel3.Controls.Add(this.btnSearchOff, 2, 0); + this.tableLayoutPanel3.Controls.Add(this.txtFilter, 1, 0); + this.tableLayoutPanel3.Controls.Add(this.lblSearch, 0, 0); + this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 318); + this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 1; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(495, 25); + this.tableLayoutPanel3.TabIndex = 6; // - // columnHeader5 + // btnSearchOff // - this.columnHeader5.Text = "Size"; + this.btnSearchOff.Location = new System.Drawing.Point(473, 3); + this.btnSearchOff.Name = "btnSearchOff"; + this.btnSearchOff.Size = new System.Drawing.Size(19, 19); + this.btnSearchOff.TabIndex = 0; + this.btnSearchOff.Text = "X"; + this.btnSearchOff.UseVisualStyleBackColor = true; + this.btnSearchOff.Click += new System.EventHandler(this.btnSearchOff_Click); // - // columnHeader6 + // txtFilter // - this.columnHeader6.Text = "State"; - this.columnHeader6.Width = 80; + this.txtFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtFilter.Location = new System.Drawing.Point(103, 3); + this.txtFilter.Name = "txtFilter"; + this.txtFilter.Size = new System.Drawing.Size(364, 20); + this.txtFilter.TabIndex = 1; + this.txtFilter.TextChanged += new System.EventHandler(this.txtFilter_TextChanged); + // + // lblSearch + // + this.lblSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.lblSearch.AutoSize = true; + this.lblSearch.Location = new System.Drawing.Point(3, 6); + this.lblSearch.Name = "lblSearch"; + this.lblSearch.Size = new System.Drawing.Size(94, 13); + this.lblSearch.TabIndex = 2; + this.lblSearch.Text = "Search Filter:"; // // tableLayoutPanel2 // @@ -241,7 +248,7 @@ private void InitializeComponent() this.tableLayoutPanel2.ColumnCount = 1; this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel4, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.tabControl1, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.tabs, 0, 1); this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; @@ -452,21 +459,21 @@ private void InitializeComponent() this.lblStatus.Size = new System.Drawing.Size(180, 13); this.lblStatus.TabIndex = 9; // - // tabControl1 + // tabs // - this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl1.Controls.Add(this.tabOptions); - this.tabControl1.Controls.Add(this.tabGPO); - this.tabControl1.Location = new System.Drawing.Point(3, 213); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(182, 227); - this.tabControl1.TabIndex = 1; + this.tabs.Controls.Add(this.tabOptions); + this.tabs.Controls.Add(this.tabAU); + this.tabs.Location = new System.Drawing.Point(3, 213); + this.tabs.Name = "tabs"; + this.tabs.SelectedIndex = 0; + this.tabs.Size = new System.Drawing.Size(182, 227); + this.tabs.TabIndex = 1; // // tabOptions // - this.tabOptions.Controls.Add(this.groupBox1); + this.tabOptions.Controls.Add(this.gbStartup); this.tabOptions.Controls.Add(this.dlSource); this.tabOptions.Controls.Add(this.chkOffline); this.tabOptions.Controls.Add(this.chkMsUpd); @@ -481,17 +488,17 @@ private void InitializeComponent() this.tabOptions.Text = "Options"; this.tabOptions.UseVisualStyleBackColor = true; // - // groupBox1 + // gbStartup // - this.groupBox1.Controls.Add(this.chkAutoRun); - this.groupBox1.Controls.Add(this.chkNoUAC); - this.groupBox1.Controls.Add(this.dlAutoCheck); - this.groupBox1.Location = new System.Drawing.Point(1, 125); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(170, 75); - this.groupBox1.TabIndex = 8; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Startup"; + this.gbStartup.Controls.Add(this.chkAutoRun); + this.gbStartup.Controls.Add(this.chkNoUAC); + this.gbStartup.Controls.Add(this.dlAutoCheck); + this.gbStartup.Location = new System.Drawing.Point(1, 125); + this.gbStartup.Name = "gbStartup"; + this.gbStartup.Size = new System.Drawing.Size(170, 75); + this.gbStartup.TabIndex = 8; + this.gbStartup.TabStop = false; + this.gbStartup.Text = "Startup"; // // chkNoUAC // @@ -590,28 +597,28 @@ private void InitializeComponent() this.chkDownload.UseVisualStyleBackColor = true; this.chkDownload.CheckedChanged += new System.EventHandler(this.chkDownload_CheckedChanged); // - // tabGPO - // - this.tabGPO.Controls.Add(this.label1); - this.tabGPO.Controls.Add(this.chkDrivers); - this.tabGPO.Controls.Add(this.chkStore); - this.tabGPO.Controls.Add(this.chkHideWU); - this.tabGPO.Controls.Add(this.chkDisableAU); - this.tabGPO.Controls.Add(this.radDefault); - this.tabGPO.Controls.Add(this.radSchedule); - this.tabGPO.Controls.Add(this.radDownload); - this.tabGPO.Controls.Add(this.chkBlockMS); - this.tabGPO.Controls.Add(this.radNotify); - this.tabGPO.Controls.Add(this.radDisable); - this.tabGPO.Controls.Add(this.dlShDay); - this.tabGPO.Controls.Add(this.dlShTime); - this.tabGPO.Location = new System.Drawing.Point(4, 22); - this.tabGPO.Name = "tabGPO"; - this.tabGPO.Padding = new System.Windows.Forms.Padding(3); - this.tabGPO.Size = new System.Drawing.Size(174, 201); - this.tabGPO.TabIndex = 1; - this.tabGPO.Text = "Auto Update"; - this.tabGPO.UseVisualStyleBackColor = true; + // tabAU + // + this.tabAU.Controls.Add(this.label1); + this.tabAU.Controls.Add(this.chkDrivers); + this.tabAU.Controls.Add(this.chkStore); + this.tabAU.Controls.Add(this.chkHideWU); + this.tabAU.Controls.Add(this.chkDisableAU); + this.tabAU.Controls.Add(this.radDefault); + this.tabAU.Controls.Add(this.radSchedule); + this.tabAU.Controls.Add(this.radDownload); + this.tabAU.Controls.Add(this.chkBlockMS); + this.tabAU.Controls.Add(this.radNotify); + this.tabAU.Controls.Add(this.radDisable); + this.tabAU.Controls.Add(this.dlShDay); + this.tabAU.Controls.Add(this.dlShTime); + this.tabAU.Location = new System.Drawing.Point(4, 22); + this.tabAU.Name = "tabAU"; + this.tabAU.Padding = new System.Windows.Forms.Padding(3); + this.tabAU.Size = new System.Drawing.Size(174, 201); + this.tabAU.TabIndex = 1; + this.tabAU.Text = "Auto Update"; + this.tabAU.UseVisualStyleBackColor = true; // // label1 // @@ -682,10 +689,10 @@ private void InitializeComponent() this.radSchedule.AutoSize = true; this.radSchedule.Location = new System.Drawing.Point(4, 91); this.radSchedule.Name = "radSchedule"; - this.radSchedule.Size = new System.Drawing.Size(121, 17); + this.radSchedule.Size = new System.Drawing.Size(132, 17); this.radSchedule.TabIndex = 18; this.radSchedule.TabStop = true; - this.radSchedule.Text = "Sheduled Instalation"; + this.radSchedule.Text = "Scheduled & Installation"; this.radSchedule.UseVisualStyleBackColor = true; this.radSchedule.CheckedChanged += new System.EventHandler(this.radGPO_CheckedChanged); // @@ -801,7 +808,7 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.panelList, 1, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(1, 2); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; @@ -810,6 +817,59 @@ private void InitializeComponent() this.tableLayoutPanel1.Size = new System.Drawing.Size(683, 443); this.tableLayoutPanel1.TabIndex = 1; // + // updateView + // + this.updateView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.updateView.CheckBoxes = true; + this.updateView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2, + this.columnHeader3, + this.columnHeader4, + this.columnHeader5, + this.columnHeader6}); + this.updateView.Location = new System.Drawing.Point(3, 23); + this.updateView.Name = "updateView"; + this.updateView.ShowItemToolTips = true; + this.updateView.Size = new System.Drawing.Size(489, 292); + this.updateView.TabIndex = 2; + this.updateView.UseCompatibleStateImageBehavior = false; + this.updateView.View = System.Windows.Forms.View.Details; + this.updateView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.updateView_ColumnClick); + this.updateView.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.updateView_ItemCheck); + this.updateView.SelectedIndexChanged += new System.EventHandler(this.updateView_SelectedIndexChanged); + // + // columnHeader1 + // + this.columnHeader1.Text = "Title"; + this.columnHeader1.Width = 260; + // + // columnHeader2 + // + this.columnHeader2.Text = "Category"; + this.columnHeader2.Width = 100; + // + // columnHeader3 + // + this.columnHeader3.Text = "KB Article"; + this.columnHeader3.Width = 80; + // + // columnHeader4 + // + this.columnHeader4.Text = "Date"; + this.columnHeader4.Width = 70; + // + // columnHeader5 + // + this.columnHeader5.Text = "Size"; + // + // columnHeader6 + // + this.columnHeader6.Text = "State"; + this.columnHeader6.Width = 80; + // // WuMgr // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -822,21 +882,23 @@ private void InitializeComponent() this.Text = "Update Manager for Windows"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.WuMgr_FormClosing); this.Load += new System.EventHandler(this.WuMgr_Load); - this.tableLayoutPanel3.ResumeLayout(false); + this.panelList.ResumeLayout(false); this.tableLayoutPanel7.ResumeLayout(false); this.tableLayoutPanel7.PerformLayout(); + this.tableLayoutPanel3.ResumeLayout(false); + this.tableLayoutPanel3.PerformLayout(); this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel4.ResumeLayout(false); this.tableLayoutPanel4.PerformLayout(); this.flowLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel5.ResumeLayout(false); - this.tabControl1.ResumeLayout(false); + this.tabs.ResumeLayout(false); this.tabOptions.ResumeLayout(false); this.tabOptions.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.tabGPO.ResumeLayout(false); - this.tabGPO.PerformLayout(); + this.gbStartup.ResumeLayout(false); + this.gbStartup.PerformLayout(); + this.tabAU.ResumeLayout(false); + this.tabAU.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); @@ -845,7 +907,7 @@ private void InitializeComponent() #endregion private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.NotifyIcon notifyIcon; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.TableLayoutPanel panelList; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; @@ -886,11 +948,11 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader columnHeader4; private System.Windows.Forms.ColumnHeader columnHeader5; private System.Windows.Forms.ColumnHeader columnHeader6; - private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabControl tabs; private System.Windows.Forms.TabPage tabOptions; private System.Windows.Forms.ComboBox dlAutoCheck; private System.Windows.Forms.CheckBox chkAutoRun; - private System.Windows.Forms.TabPage tabGPO; + private System.Windows.Forms.TabPage tabAU; private System.Windows.Forms.CheckBox chkStore; private System.Windows.Forms.CheckBox chkDisableAU; private System.Windows.Forms.RadioButton radDefault; @@ -898,8 +960,12 @@ private void InitializeComponent() private System.Windows.Forms.RadioButton radDownload; private System.Windows.Forms.RadioButton radNotify; private System.Windows.Forms.RadioButton radDisable; - private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox gbStartup; private System.Windows.Forms.Label label1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.Button btnSearchOff; + private System.Windows.Forms.TextBox txtFilter; + private System.Windows.Forms.Label lblSearch; } } diff --git a/wumgr/WuMgr.cs b/wumgr/WuMgr.cs index b88035d..0194481 100644 --- a/wumgr/WuMgr.cs +++ b/wumgr/WuMgr.cs @@ -87,7 +87,6 @@ protected override void SetVisibleCore(bool value) GPO.Respect mGPORespect = GPO.Respect.Unknown; float mWinVersion = 0.0f; - enum AutoUpdateOptions { No = 0, @@ -100,6 +99,10 @@ enum AutoUpdateOptions int IdleDelay = 0; DateTime LastCheck = DateTime.MaxValue; + float mSearchBoxHeight = 0.0f; + string mSearchFilter = null; + bool bUpdateList = false; + public WuMgr() { InitializeComponent(); @@ -114,15 +117,9 @@ public WuMgr() } if(!MiscFunc.IsRunningAsUwp()) - this.Text = MiscFunc.fmt("{0} v{1} by David Xanatos", Program.mName, Program.mVersion); + this.Text = string.Format("{0} v{1} by David Xanatos", Program.mName, Program.mVersion); - toolTip.SetToolTip(btnSearch, "Search"); - toolTip.SetToolTip(btnInstall, "Install"); - toolTip.SetToolTip(btnDownload, "Download"); - toolTip.SetToolTip(btnHide, "Hide"); - toolTip.SetToolTip(btnGetLink, "Get Links"); - toolTip.SetToolTip(btnUnInstall, "Uninstall"); - toolTip.SetToolTip(btnCancel, "Cancel"); + Localize(); btnSearch.Image = (Image)(new Bitmap(global::wumgr.Properties.Resources.icons8_available_updates_32, new Size(25, 25))); btnInstall.Image = (Image)(new Bitmap(global::wumgr.Properties.Resources.icons8_software_installer_32, new Size(25, 25))); @@ -146,7 +143,7 @@ public WuMgr() if (!agent.IsActive()) { - if (MessageBox.Show("Windows Update Service is not available, try to start it?", Program.mName, MessageBoxButtons.YesNo) == DialogResult.Yes) + if (MessageBox.Show(Translate.fmt("msg_wuau"), Program.mName, MessageBoxButtons.YesNo) == DialogResult.Yes) { agent.EnableWuAuServ(); agent.Init(); @@ -220,7 +217,7 @@ public WuMgr() // Note: when running in the UWP sandbox we cant write the real registry even as admins if (!MiscFunc.IsAdministrator() || MiscFunc.IsRunningAsUwp()) { - foreach (Control ctl in tabGPO.Controls) + foreach (Control ctl in tabAU.Controls) ctl.Enabled = false; } @@ -255,21 +252,29 @@ public WuMgr() LoadProviders(source); + mSearchBoxHeight = this.panelList.RowStyles[2].Height; + this.panelList.RowStyles[2].Height = 0; + mSuspendUpdate = false; + + if (Program.TestArg("-provisioned")) + tabs.Enabled = false; + + mToolsMenu = new MenuItem(); - mToolsMenu.Text = "&Tools"; + mToolsMenu.Text = Translate.fmt("menu_tools"); BuildToolsMenu(); notifyIcon.ContextMenu = new ContextMenu(); MenuItem menuAbout = new MenuItem(); - menuAbout.Text = "&About"; + menuAbout.Text = Translate.fmt("menu_about"); menuAbout.Click += new System.EventHandler(menuAbout_Click); MenuItem menuExit = new MenuItem(); - menuExit.Text = "E&xit"; + menuExit.Text = Translate.fmt("menu_exit"); menuExit.Click += new System.EventHandler(menuExit_Click); notifyIcon.ContextMenu.MenuItems.AddRange(new MenuItem[] { mToolsMenu, menuAbout, new MenuItem("-"), menuExit }); @@ -277,8 +282,8 @@ public WuMgr() IntPtr MenuHandle = GetSystemMenu(this.Handle, false); // Note: to restore default set true InsertMenu(MenuHandle, 5, MF_BYPOSITION | MF_SEPARATOR, 0, string.Empty); // <-- Add a menu seperator - InsertMenu(MenuHandle, 6, MF_BYPOSITION | MF_POPUP, (int)mToolsMenu.Handle, "Tools"); - InsertMenu(MenuHandle, 7, MF_BYPOSITION, MYMENU_ABOUT, "&About"); + InsertMenu(MenuHandle, 6, MF_BYPOSITION | MF_POPUP, (int)mToolsMenu.Handle, mToolsMenu.Text); + InsertMenu(MenuHandle, 7, MF_BYPOSITION, MYMENU_ABOUT, menuAbout.Text); UpdateCounts(); @@ -287,7 +292,7 @@ public WuMgr() doUpdte = Program.TestArg("-update"); mTimer = new Timer(); - mTimer.Interval = 1000; // once epr second + mTimer.Interval = 250; // 4 times per second mTimer.Tick += OnTimedEvent; mTimer.Enabled = true; @@ -332,8 +337,7 @@ private void OnTimedEvent(Object source, EventArgs e) if (LastBaloon < DateTime.Now.AddHours(-4)) { LastBaloon = DateTime.Now; - notifyIcon.ShowBalloonTip(int.MaxValue, MiscFunc.fmt("Please Check For Updates"), - MiscFunc.fmt("WuMgr couldn't check for updates for {0} days, please check for updates manually and resolve possible issues", daysDue), ToolTipIcon.Warning); + notifyIcon.ShowBalloonTip(int.MaxValue, Translate.fmt("cap_chk_upd"), Translate.fmt("msg_chk_upd", Program.mName, daysDue), ToolTipIcon.Warning); } } } @@ -343,8 +347,7 @@ private void OnTimedEvent(Object source, EventArgs e) if (LastBaloon < DateTime.Now.AddHours(-4)) { LastBaloon = DateTime.Now; - notifyIcon.ShowBalloonTip(int.MaxValue, MiscFunc.fmt("New Updates found"), - MiscFunc.fmt("WuMgr has found {0} new updates, please review the upates and install them", agent.mPendingUpdates), ToolTipIcon.Info); + notifyIcon.ShowBalloonTip(int.MaxValue, Translate.fmt("cap_new_upd"), Translate.fmt("msg_new_upd", Program.mName, agent.mPendingUpdates), ToolTipIcon.Info); } } } @@ -357,6 +360,15 @@ private void OnTimedEvent(Object source, EventArgs e) else agent.SearchForUpdates(dlSource.Text, chkOld.Checked); } + + if (bUpdateList) + { + bUpdateList = false; + LoadList(); + } + + if (checkChecks) + UpdateState(); } private void WuMgr_Load(object sender, EventArgs e) @@ -431,14 +443,10 @@ private void LoadProviders(string source = null) void UpdateCounts() { - if (agent.mPendingUpdates != null) - btnWinUpd.Text = MiscFunc.fmt("Windows Update ({0})", agent.mPendingUpdates.Count); - if (agent.mInstalledUpdates != null) - btnInstalled.Text = MiscFunc.fmt("Installed Updates ({0})", agent.mInstalledUpdates.Count); - if (agent.mHiddenUpdates != null) - btnHidden.Text = MiscFunc.fmt("Hidden Updates ({0})", agent.mHiddenUpdates.Count); - if (agent.mUpdateHistory != null) - btnHistory.Text = MiscFunc.fmt("Update History ({0})", agent.mUpdateHistory.Count); + btnWinUpd.Text = Translate.fmt("lbl_fnd_upd", agent.mPendingUpdates.Count); + btnInstalled.Text = Translate.fmt("lbl_inst_upd", agent.mInstalledUpdates.Count); + btnHidden.Text = Translate.fmt("lbl_block_upd", agent.mHiddenUpdates.Count); + btnHistory.Text = Translate.fmt("lbl_old_upd", agent.mUpdateHistory.Count); } void LoadList() @@ -457,8 +465,10 @@ void LoadList() void LoadList(List List) { + string INIPath = Program.wrkPath + @"\Updates.ini"; + updateView.Items.Clear(); - ListViewItem[] items = new ListViewItem[List.Count]; + List items = new List(); for (int i = 0; i < List.Count; i++) { MsUpdate Update = List[i]; @@ -468,61 +478,100 @@ void LoadList(List List) case MsUpdate.UpdateState.History: switch ((OperationResultCode)Update.ResultCode) { - case OperationResultCode.orcNotStarted: State = "Not Started"; break; - case OperationResultCode.orcInProgress: State = "In Progress"; break; - case OperationResultCode.orcSucceeded: State = "Succeeded"; break; - case OperationResultCode.orcSucceededWithErrors: State = "Succeeded with Errors"; break; - case OperationResultCode.orcFailed: State = "Failed"; break; - case OperationResultCode.orcAborted: State = "Aborted"; break; + case OperationResultCode.orcNotStarted: State = Translate.fmt("stat_not_start"); break; + case OperationResultCode.orcInProgress: State = Translate.fmt("stat_in_prog"); break; + case OperationResultCode.orcSucceeded: State = Translate.fmt("stat_success"); break; + case OperationResultCode.orcSucceededWithErrors: State = Translate.fmt("stat_success_2"); break; + case OperationResultCode.orcFailed: State = Translate.fmt("stat_failed"); break; + case OperationResultCode.orcAborted: State = Translate.fmt("stat_abbort"); break; } State += " (0x" + String.Format("{0:X8}", Update.HResult) + ")"; break; default: if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Beta) != 0) - State = "Beta "; + State = Translate.fmt("stat_beta" + " "); if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Installed) != 0) { - State += "Installed"; + State += Translate.fmt("stat_install"); if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Uninstallable) != 0) - State += " Removable"; + State += " " + Translate.fmt("stat_rem"); } else if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Hidden) != 0) { - State += "Hidden"; + State += Translate.fmt("stat_block"); if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Downloaded) != 0) - State += " Downloaded"; + State += " " + Translate.fmt("stat_dl"); } else { if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Downloaded) != 0) - State += "Downloaded"; + State += Translate.fmt("stat_dl"); else - State += "Pending"; + State += Translate.fmt("stat_pending"); if ((Update.Attributes & (int)MsUpdate.UpdateAttr.AutoSelect) != 0) - State += " (!)"; + State += " " + Translate.fmt("stat_sel"); if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Mandatory) != 0) - State += " Manatory"; + State += " " + Translate.fmt("stat_mand"); } if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Exclusive) != 0) - State += ", Exclusive"; + State += ", " + Translate.fmt("stat_excl"); if ((Update.Attributes & (int)MsUpdate.UpdateAttr.Reboot) != 0) - State += ", Needs Reboot"; + State += ", " + Translate.fmt("stat_reboot"); break; } - items[i] = new ListViewItem(new string[] { + + string[] strings = new string[] { Update.Title, Update.Category, Update.KB, Update.Date.ToString("dd.MM.yyyy"), FileOps.FormatSize(Update.Size), - State}); + State}; - items[i].Tag = Update; + if (mSearchFilter != null) + { + bool match = false; + foreach (string str in strings) + { + if (str.IndexOf(mSearchFilter, StringComparison.CurrentCultureIgnoreCase) != -1) + { + match = true; + break; + } + } + if (!match) + continue; + } + + ListViewItem item = new ListViewItem(strings); + + item.Tag = Update; + + if (CurrentList == UpdateLists.PendingUpdates) + { + if (MiscFunc.parseInt(Program.IniReadValue(Update.KB, "BlackList", "0", INIPath)) != 0) + item.Font = new Font(item.Font.FontFamily, item.Font.Size, FontStyle.Strikeout); + else if (MiscFunc.parseInt(Program.IniReadValue(Update.KB, "Select", "0", INIPath)) != 0) + item.Checked = true; + } + else if (CurrentList == UpdateLists.InstaledUpdates) + { + if (MiscFunc.parseInt(Program.IniReadValue(Update.KB, "Remove", "0", INIPath)) != 0) + item.Checked = true; + } + + string colorStr = Program.IniReadValue(Update.KB, "Color", "", INIPath); + if (colorStr.Length > 0) + { + Color? color = MiscFunc.parseColor(colorStr); + if (color != null) + item.BackColor = (Color)color; + } ListViewGroup lvg = updateView.Groups[Update.Category]; if (lvg == null) @@ -530,9 +579,10 @@ void LoadList(List List) lvg = updateView.Groups.Add(Update.Category, Update.Category); ListViewExtended.setGrpState(lvg, ListViewGroupState.Collapsible); } - items[i].Group = lvg; + item.Group = lvg; + items.Add(item); } - updateView.Items.AddRange(items); + updateView.Items.AddRange(items.ToArray()); // Note: this has caused issues in the past //updateView.SetGroupState(ListViewGroupState.Collapsible); @@ -579,6 +629,10 @@ void SwitchList(UpdateLists List) private void UpdateState() { + checkChecks = false; + + bool isChecked = updateView.CheckedItems.Count > 0; + bool busy = agent.IsBusy(); btnCancel.Visible = busy; progTotal.Visible = busy; @@ -591,11 +645,11 @@ private void UpdateState() bool enable = agent.IsActive() && !busy; btnSearch.Enabled = enable; - btnDownload.Enabled = enable && isValid2 && (CurrentList == UpdateLists.PendingUpdates); - btnInstall.Enabled = admin && enable && isValid2 && (CurrentList == UpdateLists.PendingUpdates); - btnUnInstall.Enabled = admin && enable && isValid2 && (CurrentList == UpdateLists.InstaledUpdates); - btnHide.Enabled = enable && isValid && (CurrentList == UpdateLists.PendingUpdates || CurrentList == UpdateLists.HiddenUpdates); - btnGetLink.Enabled = CurrentList != UpdateLists.UpdateHistory; + btnDownload.Enabled = isChecked && enable && isValid2 && (CurrentList == UpdateLists.PendingUpdates); + btnInstall.Enabled = isChecked && admin && enable && isValid2 && (CurrentList == UpdateLists.PendingUpdates); + btnUnInstall.Enabled = isChecked && admin && enable && (CurrentList == UpdateLists.InstaledUpdates); + btnHide.Enabled = isChecked && enable && isValid && (CurrentList == UpdateLists.PendingUpdates || CurrentList == UpdateLists.HiddenUpdates); + btnGetLink.Enabled = isChecked && CurrentList != UpdateLists.UpdateHistory; } private MenuItem mToolsMenu = null; @@ -604,7 +658,7 @@ private void UpdateState() private void BuildToolsMenu() { wuauMenu = new MenuItem(); - wuauMenu.Text = "Windows Update Service"; + wuauMenu.Text = Translate.fmt("menu_wuau"); wuauMenu.Checked = agent.TestWuAuServ(); wuauMenu.Click += new System.EventHandler(menuWuAu_Click); mToolsMenu.MenuItems.Add(wuauMenu); @@ -655,7 +709,7 @@ private void BuildToolsMenu() } MenuItem refreshMenu = new MenuItem(); - refreshMenu.Text = "&Refresh"; + refreshMenu.Text = Translate.fmt("menu_refresh"); refreshMenu.Click += new System.EventHandler(menuRefresh_Click); mToolsMenu.MenuItems.Add(refreshMenu); } @@ -665,7 +719,7 @@ private void menuExec_Click(object Sender, EventArgs e, string exec, string dir, ProcessStartInfo startInfo = Program.PrepExec(exec, silent); startInfo.WorkingDirectory = dir; if(!Program.DoExec(startInfo)) - MessageBox.Show(MiscFunc.fmt("Filed to start tool"), Program.mName); + MessageBox.Show(Translate.fmt("msg_tool_err"), Program.mName); } private void menuExit_Click(object Sender, EventArgs e) @@ -676,9 +730,9 @@ private void menuExit_Click(object Sender, EventArgs e) private void menuAbout_Click(object Sender, EventArgs e) { string About = ""; - About += MiscFunc.fmt("Author: \tDavid Xanatos\r\n"); - About += MiscFunc.fmt("Licence: \tGNU General Public License v3\r\n"); - About += MiscFunc.fmt("Version: \t{0}\r\n", Program.mVersion); + About += "Author: \tDavid Xanatos\r\n"; + About += "Licence: \tGNU General Public License v3\r\n"; + About += string.Format("Version: \t{0}\r\n", Program.mVersion); About += "\r\n"; About += "Icons from: https://icons8.com/"; MessageBox.Show(About, Program.mName); @@ -706,7 +760,7 @@ private void menuRefresh_Click(object Sender, EventArgs e) RemoveMenu(MenuHandle, 6, MF_BYPOSITION); mToolsMenu.MenuItems.Clear(); BuildToolsMenu(); - InsertMenu(MenuHandle, 6, MF_BYPOSITION | MF_POPUP, (int)mToolsMenu.Handle, "Tools"); + InsertMenu(MenuHandle, 6, MF_BYPOSITION | MF_POPUP, (int)mToolsMenu.Handle, Translate.fmt("menu_tools")); } private void btnWinUpd_CheckedChanged(object sender, EventArgs e) @@ -747,7 +801,7 @@ private void btnDownload_Click(object sender, EventArgs e) { if (!chkManual.Checked && !MiscFunc.IsAdministrator()) { - MessageBox.Show(MiscFunc.fmt("Administrator privilegs are required in order to download updates using windows update services. Use 'Manual' download instead."), Program.mName); + MessageBox.Show(Translate.fmt("msg_admin_dl"), Program.mName); return; } @@ -765,7 +819,7 @@ private void btnInstall_Click(object sender, EventArgs e) { if (!MiscFunc.IsAdministrator()) { - MessageBox.Show(MiscFunc.fmt("Administrator privilegs are required in order to install updates."), Program.mName); + MessageBox.Show(Translate.fmt("msg_admin_inst"), Program.mName); return; } @@ -783,17 +837,14 @@ private void btnUnInstall_Click(object sender, EventArgs e) { if (!MiscFunc.IsAdministrator()) { - MessageBox.Show(MiscFunc.fmt("Administrator privilegs are required in order to remove updates."), Program.mName); + MessageBox.Show(Translate.fmt("msg_admin_rem"), Program.mName); return; } if (!agent.IsActive() || agent.IsBusy()) return; WuAgent.RetCodes ret = WuAgent.RetCodes.Undefined; - if (chkManual.Checked) - ret = agent.UnInstallUpdatesOffline(GetUpdates()); - else - ret = agent.UnInstallUpdates(GetUpdates()); + ret = agent.UnInstallUpdatesManually(GetUpdates()); ShowResult(WuAgent.AgentOperation.RemoveingUpdates, ret); } @@ -825,7 +876,7 @@ private void btnGetLink_Click(object sender, EventArgs e) AppLog.Line("Update Download Links copyed to clipboard"); } else - AppLog.Line("No updates sellected"); + AppLog.Line("No updates selected"); } private void btnCancel_Click(object sender, EventArgs e) @@ -837,15 +888,15 @@ string GetOpStr(WuAgent.AgentOperation op) { switch (op) { - case WuAgent.AgentOperation.CheckingUpdates: return "Checking for Updates"; - case WuAgent.AgentOperation.PreparingCheck: return "Preparing Check"; + case WuAgent.AgentOperation.CheckingUpdates: return Translate.fmt("op_check"); + case WuAgent.AgentOperation.PreparingCheck: return Translate.fmt("op_prep"); case WuAgent.AgentOperation.PreparingUpdates: - case WuAgent.AgentOperation.DownloadingUpdates: return "Downloading Updates"; - case WuAgent.AgentOperation.InstallingUpdates: return "Installing Updates"; - case WuAgent.AgentOperation.RemoveingUpdates: return "Removing Updates"; - case WuAgent.AgentOperation.CancelingOperation: return "Canceling Operation"; + case WuAgent.AgentOperation.DownloadingUpdates: return Translate.fmt("op_dl"); + case WuAgent.AgentOperation.InstallingUpdates: return Translate.fmt("op_inst"); + case WuAgent.AgentOperation.RemoveingUpdates: return Translate.fmt("op_rem"); + case WuAgent.AgentOperation.CancelingOperation: return Translate.fmt("op_cancel"); } - return "Unknown Operation"; + return Translate.fmt("op_unk"); } void OnProgress(object sender, WuAgent.ProgressArgs args) @@ -910,12 +961,12 @@ private void ShowResult(WuAgent.AgentOperation op, WuAgent.RetCodes ret, bool re { if (ret == WuAgent.RetCodes.Success) { - MessageBox.Show(MiscFunc.fmt("Updates downloaded to {0}, \r\nready to be installed by the user.", agent.dlPath), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show(Translate.fmt("msg_dl_done", agent.dlPath), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (ret == WuAgent.RetCodes.DownloadFailed) { - MessageBox.Show(MiscFunc.fmt("Updates downloaded to {0}, \r\nsome updates failed to download.", agent.dlPath), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + MessageBox.Show(Translate.fmt("msg_dl_err", agent.dlPath), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } @@ -924,12 +975,12 @@ private void ShowResult(WuAgent.AgentOperation op, WuAgent.RetCodes ret, bool re { if (ret == WuAgent.RetCodes.Success) { - MessageBox.Show(MiscFunc.fmt("Updates successfully installed, howeever a reboot is required.", agent.dlPath), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show(Translate.fmt("msg_inst_done", agent.dlPath), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (ret == WuAgent.RetCodes.DownloadFailed) { - MessageBox.Show(MiscFunc.fmt("Instalation of some Updates has failed, also a reboot is required.", agent.dlPath), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + MessageBox.Show(Translate.fmt("msg_inst_err", agent.dlPath), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } @@ -940,18 +991,18 @@ private void ShowResult(WuAgent.AgentOperation op, WuAgent.RetCodes ret, bool re case WuAgent.RetCodes.Success: case WuAgent.RetCodes.Abborted: case WuAgent.RetCodes.InProgress: return; - case WuAgent.RetCodes.AccessError: status = MiscFunc.fmt("Required privilegs are not available"); break; - case WuAgent.RetCodes.Busy: status = MiscFunc.fmt("Anotehr operation is already in progress"); break; - case WuAgent.RetCodes.DownloadFailed: status = MiscFunc.fmt("Download failed"); break; - case WuAgent.RetCodes.InstallFailed: status = MiscFunc.fmt("Instalation failed"); break; - case WuAgent.RetCodes.NoUpdated: status = MiscFunc.fmt("No selected updates or no updates eligible for the operation"); break; - case WuAgent.RetCodes.InternalError: status = MiscFunc.fmt("Inernal error"); break; - case WuAgent.RetCodes.FileNotFound: status = MiscFunc.fmt("Required file(s) could not be found"); break; + case WuAgent.RetCodes.AccessError: status = Translate.fmt("err_admin"); break; + case WuAgent.RetCodes.Busy: status = Translate.fmt("err_busy"); break; + case WuAgent.RetCodes.DownloadFailed: status = Translate.fmt("err_dl"); break; + case WuAgent.RetCodes.InstallFailed: status = Translate.fmt("err_inst"); break; + case WuAgent.RetCodes.NoUpdated: status = Translate.fmt("err_no_sel"); break; + case WuAgent.RetCodes.InternalError: status = Translate.fmt("err_int"); break; + case WuAgent.RetCodes.FileNotFound: status = Translate.fmt("err_file"); break; } string action = GetOpStr(op); - MessageBox.Show(MiscFunc.fmt("{0} failed: {1}.", action, status), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(Translate.fmt("msg_err", action, status), Program.mName, MessageBoxButtons.OK, MessageBoxIcon.Error); } private void dlSource_SelectedIndexChanged(object sender, EventArgs e) @@ -1030,8 +1081,13 @@ private void radGPO_CheckedChanged(object sender, EventArgs e) if (radDisable.Checked) { - if(chkDisableAU.Checked) + if (chkDisableAU.Checked) + { + bool test = GPO.GetDisableAU(); GPO.DisableAU(true); + if(!test) + MessageBox.Show(Translate.fmt("msg_disable_au")); + } GPO.ConfigAU(GPO.AUOptions.Disabled); } @@ -1065,7 +1121,7 @@ private void chkBlockMS_CheckedChanged(object sender, EventArgs e) { if (!chkDisableAU.Checked) { - switch (MessageBox.Show("Your version of Windows does not respect the standard GPO's, to keep autoamtic windows update disabled update facilitation services must be disabled.", Program.mName, MessageBoxButtons.YesNoCancel)) + switch (MessageBox.Show(Translate.fmt("msg_gpo"), Program.mName, MessageBoxButtons.YesNoCancel)) { case DialogResult.Yes: chkDisableAU.Checked = true; // Note: this triggers chkDisableAU_CheckedChanged @@ -1099,7 +1155,10 @@ private void chkDisableAU_CheckedChanged(object sender, EventArgs e) if (mSuspendUpdate) return; + bool test = GPO.GetDisableAU(); GPO.DisableAU(chkDisableAU.Checked); + if(test != chkDisableAU.Checked) + MessageBox.Show(Translate.fmt("msg_disable_au")); } private void chkAutoRun_CheckedChanged(object sender, EventArgs e) @@ -1169,16 +1228,18 @@ private void chkStore_CheckedChanged(object sender, EventArgs e) private void updateView_SelectedIndexChanged(object sender, EventArgs e) { - if(updateView.SelectedItems.Count == 1) + lblSupport.Visible = false; + if (updateView.SelectedItems.Count == 1) { MsUpdate Update = (MsUpdate)updateView.SelectedItems[0].Tag; - lblSupport.Links[0].LinkData = Update.SupportUrl; - lblSupport.Links[0].Visited = false; - lblSupport.Visible = true; - toolTip.SetToolTip(lblSupport, Update.SupportUrl); + if (Update.KB != null && Update.KB.Length > 2) + { + lblSupport.Links[0].LinkData = "https://support.microsoft.com/help/" + Update.KB.Substring(2); + lblSupport.Links[0].Visited = false; + lblSupport.Visible = true; + toolTip.SetToolTip(lblSupport, lblSupport.Links[0].LinkData.ToString()); + } } - else - lblSupport.Visible = false; } private void lblSupport_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -1242,5 +1303,113 @@ public int Compare(object x, object y) return String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text); } } + + + private void Localize() + { + + btnWinUpd.Text = Translate.fmt("lbl_fnd_upd", 0); + btnInstalled.Text = Translate.fmt("lbl_inst_upd", 0); + btnHidden.Text = Translate.fmt("lbl_block_upd", 0); + btnHistory.Text = Translate.fmt("lbl_old_upd", 0); + + toolTip.SetToolTip(btnSearch, Translate.fmt("tip_search")); + toolTip.SetToolTip(btnInstall, Translate.fmt("tip_inst")); + toolTip.SetToolTip(btnDownload, Translate.fmt("tip_dl")); + toolTip.SetToolTip(btnHide, Translate.fmt("tip_hide")); + toolTip.SetToolTip(btnGetLink, Translate.fmt("tip_lnk")); + toolTip.SetToolTip(btnUnInstall, Translate.fmt("tip_rem")); + toolTip.SetToolTip(btnCancel, Translate.fmt("tip_cancel")); + + updateView.Columns[0].Text = Translate.fmt("col_title"); + updateView.Columns[1].Text = Translate.fmt("col_cat"); + updateView.Columns[2].Text = Translate.fmt("col_kb"); + updateView.Columns[3].Text = Translate.fmt("col_date"); + updateView.Columns[4].Text = Translate.fmt("col_site"); + updateView.Columns[5].Text = Translate.fmt("col_stat"); + + lblSupport.Text = Translate.fmt("lbl_support"); + + lblSearch.Text = Translate.fmt("lbl_search"); + + tabOptions.Text = Translate.fmt("lbl_opt"); + + chkOffline.Text = Translate.fmt("lbl_off"); + chkDownload.Text = Translate.fmt("lbl_dl"); + chkManual.Text = Translate.fmt("lbl_man"); + chkOld.Text = Translate.fmt("lbl_old"); + chkMsUpd.Text = Translate.fmt("lbl_ms"); + + gbStartup.Text = Translate.fmt("lbl_start"); + chkAutoRun.Text = Translate.fmt("lbl_auto"); + dlAutoCheck.Items.Clear(); + dlAutoCheck.Items.Add(Translate.fmt("lbl_ac_no")); + dlAutoCheck.Items.Add(Translate.fmt("lbl_ac_day")); + dlAutoCheck.Items.Add(Translate.fmt("lbl_ac_week")); + dlAutoCheck.Items.Add(Translate.fmt("lbl_ac_month")); + chkNoUAC.Text = Translate.fmt("lbl_uac"); + + + tabAU.Text = Translate.fmt("lbl_au"); + + chkBlockMS.Text = Translate.fmt("lbl_block_ms"); + radDisable.Text = Translate.fmt("lbl_au_off"); + chkDisableAU.Text = Translate.fmt("lbl_au_dissable"); + radNotify.Text = Translate.fmt("lbl_au_notify"); + radDownload.Text = Translate.fmt("lbl_au_dl"); + radSchedule.Text = Translate.fmt("lbl_au_time"); + radDefault.Text = Translate.fmt("lbl_au_def"); + chkHideWU.Text = Translate.fmt("lbl_hide"); + chkStore.Text = Translate.fmt("lbl_store"); + chkDrivers.Text = Translate.fmt("lbl_drv"); + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == (Keys.Control | Keys.F)) + { + this.panelList.RowStyles[2].Height = mSearchBoxHeight; + return true; + } + + if (keyData == (Keys.Control | Keys.C)) + { + string Info = ""; + foreach (ListViewItem item in updateView.SelectedItems) + { + if(Info.Length != 0) + Info += "\r\n"; + Info += item.Text; + for(int i=1; i < item.SubItems.Count; i++) + Info += "; " + item.SubItems[i].Text; + } + + if (Info.Length != 0) + Clipboard.SetText(Info); + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + + private void btnSearchOff_Click(object sender, EventArgs e) + { + this.panelList.RowStyles[2].Height = 0; + mSearchFilter = null; + LoadList(); + } + + private void txtFilter_TextChanged(object sender, EventArgs e) + { + mSearchFilter = txtFilter.Text; + bUpdateList = true; + } + + bool checkChecks = false; + + private void updateView_ItemCheck(object sender, ItemCheckEventArgs e) + { + checkChecks = true; + } } } diff --git a/wumgr/wumgr.csproj b/wumgr/wumgr.csproj index 6388416..764ae39 100644 --- a/wumgr/wumgr.csproj +++ b/wumgr/wumgr.csproj @@ -103,6 +103,7 @@ +