diff --git a/AdvancedInstaller/wu10man.aip b/AdvancedInstaller/wu10man.aip
index 3181707..f5887d8 100644
--- a/AdvancedInstaller/wu10man.aip
+++ b/AdvancedInstaller/wu10man.aip
@@ -16,10 +16,10 @@
-
+
-
+
@@ -49,6 +49,11 @@
+
+
+
+
+
@@ -66,6 +71,11 @@
+
+
+
+
+
@@ -147,6 +157,11 @@
+
+
+
+
+
diff --git a/README.md b/README.md
index 5e29392..e776ac6 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,8 @@ There was a fair amount of research that went into this, but a couple sites stoo
- [Windows Update Server List](https://www.tenforums.com/windows-updates-activation/38771-windows-updates-white-list-proxy-server.html)
- [Windows Service Authorization](https://stackoverflow.com/questions/17031552/how-do-you-take-file-ownership-with-powershell/17047190#17047190)
- [Change Windows Service Password](https://stackoverflow.com/questions/3876787/change-windows-service-password/3877268#3877268)
+- [Windows 10, version 1709 basic level Windows diagnostic events and fields](https://docs.microsoft.com/en-us/windows/privacy/basic-level-windows-diagnostic-events-and-fields-1709)
+-
### Downloads
https://github.com/WereDev/Wu10Man/releases
diff --git a/Wu10Man/App.config b/Wu10Man/App.config
index 9693cb7..062aa13 100644
--- a/Wu10Man/App.config
+++ b/Wu10Man/App.config
@@ -1,34 +1,9 @@
-
-
-
-
-
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Wu10Man/App.xaml.cs b/Wu10Man/App.xaml.cs
index da32b1d..3d1bb49 100644
--- a/Wu10Man/App.xaml.cs
+++ b/Wu10Man/App.xaml.cs
@@ -1,7 +1,8 @@
using System;
using System.Windows;
using WereDev.Utils.Wu10Man.Helpers;
-
+using WereDev.Utils.Wu10Man.UserWindows;
+
namespace WereDev.Utils.Wu10Man
{
///
@@ -14,11 +15,11 @@ public App() : base()
Wu10Logger.LogInfo("Application starting");
try
{
- var version = this.GetType().Assembly.GetName().Version;
- Wu10Logger.LogInfo($"Application version: v{version.ToString()}");
+ WriteStartupLogs();
this.Dispatcher.UnhandledException += OnDispatcherUnhandledException;
this.MainWindow = new MainWindow();
this.MainWindow.Show();
+
Wu10Logger.LogInfo("Application started");
}
catch (Exception ex)
@@ -42,5 +43,13 @@ void OnDispatcherUnhandledException(object sender, System.Windows.Threading.Disp
MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
}
+
+ void WriteStartupLogs()
+ {
+ var appVersion = this.GetType().Assembly.GetName().Version;
+ Wu10Logger.LogInfo($"Application version: v{appVersion.ToString()}");
+ Wu10Logger.LogInfo(EnvironmentVersionHelper.GetWindowsVersion());
+ Wu10Logger.LogInfo($".Net Framework: {EnvironmentVersionHelper.GetDotNetFrameworkBuild()}");
+ }
}
}
diff --git a/Wu10Man/Editors/HostsEditor.cs b/Wu10Man/Editors/HostsEditor.cs
index 931f985..0bd92a6 100644
--- a/Wu10Man/Editors/HostsEditor.cs
+++ b/Wu10Man/Editors/HostsEditor.cs
@@ -43,13 +43,16 @@ public string[] GetHostsInFile()
private string[] GetHostsFromLines(IEnumerable lines)
{
- var hosts = lines.Select(x => GetHostFromLine(x));
- return hosts.ToArray();
+ var hosts = lines.Select(x => GetHostFromLine(x))
+ .Where(x => !string.IsNullOrEmpty(x))
+ .ToArray();
+ return hosts;
}
private string GetHostFromLine(string line)
{
line = line.Trim();
+ if (line == string.Empty) return line;
var split = line.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
return split[1];
}
diff --git a/Wu10Man/Helpers/EnvironmentVersionHelper.cs b/Wu10Man/Helpers/EnvironmentVersionHelper.cs
new file mode 100644
index 0000000..8c1ea51
--- /dev/null
+++ b/Wu10Man/Helpers/EnvironmentVersionHelper.cs
@@ -0,0 +1,47 @@
+namespace WereDev.Utils.Wu10Man.Helpers
+{
+ public static class EnvironmentVersionHelper
+ {
+ private const string WindowsVersionRegistryKey = @"SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion";
+ private const string DotNetVersionRegistryKey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full";
+ public static string GetDotNetFrameworkBuild()
+ {
+ var release = Editors.RegistryEditor.ReadLocalMachineRegistryValue(DotNetVersionRegistryKey, "Release");
+ int.TryParse(release, out var releaseInt);
+
+ if (releaseInt >= 528040)
+ return $"{release} / 4.8 or later";
+ else if (releaseInt >= 461808)
+ return $"{release} / 4.7.2";
+ else if (releaseInt >= 461308)
+ return $"{release} / 4.7.1";
+ else if (releaseInt >= 460798)
+ return $"{release} / 4.7";
+ else if (releaseInt >= 394802)
+ return $"{release} / 4.6.2";
+ else if (releaseInt >= 394254)
+ return $"{release} / 4.6.1";
+ else if (releaseInt >= 393295)
+ return $"{release} / 4.6";
+ else if (releaseInt >= 393273)
+ return $"{release} / 4.6 RC";
+ else if ((releaseInt >= 379893))
+ return $"{release} / 4.5.2";
+ else if ((releaseInt >= 378675))
+ return $"{release} / 4.5.1";
+ else if ((releaseInt >= 378389))
+ return $"{release} / 4.5";
+ else
+ return $"{release} / No 4.5 or later version detected";
+ }
+
+ public static string GetWindowsVersion()
+ {
+ var windowsProduct = Editors.RegistryEditor.ReadLocalMachineRegistryValue(WindowsVersionRegistryKey, "ProductName");
+ var windowsRelease = Editors.RegistryEditor.ReadLocalMachineRegistryValue(WindowsVersionRegistryKey, "ReleaseId");
+ var windowsBuild = Editors.RegistryEditor.ReadLocalMachineRegistryValue(WindowsVersionRegistryKey, "CurrentBuild");
+ var windowsBuildRevision = Editors.RegistryEditor.ReadLocalMachineRegistryValue(WindowsVersionRegistryKey, "BaseBuildRevisionNumber");
+ return $"{windowsProduct} Version {windowsRelease} Build {windowsBuild}.{windowsBuildRevision}";
+ }
+ }
+}
diff --git a/Wu10Man/Properties/AssemblyInfo.cs b/Wu10Man/Properties/AssemblyInfo.cs
index 1e87a7e..6b4c67d 100644
--- a/Wu10Man/Properties/AssemblyInfo.cs
+++ b/Wu10Man/Properties/AssemblyInfo.cs
@@ -50,7 +50,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.1.3.0")]
-[assembly: AssemblyFileVersion("2.1.3.0")]
+[assembly: AssemblyVersion("3.0.0.0")]
+[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: NeutralResourcesLanguage("en-US")]
diff --git a/Wu10Man/Properties/Settings.Designer.cs b/Wu10Man/Properties/Settings.Designer.cs
deleted file mode 100644
index 01bfde4..0000000
--- a/Wu10Man/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace WereDev.Utils.Wu10Man.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
- public bool ShowAdvanced {
- get {
- return ((bool)(this["ShowAdvanced"]));
- }
- set {
- this["ShowAdvanced"] = value;
- }
- }
- }
-}
diff --git a/Wu10Man/Properties/Settings.settings b/Wu10Man/Properties/Settings.settings
deleted file mode 100644
index 72059c4..0000000
--- a/Wu10Man/Properties/Settings.settings
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
- False
-
-
-
\ No newline at end of file
diff --git a/Wu10Man/UserControls/AdvancedOptions.xaml b/Wu10Man/UserControls/AdvancedOptions.xaml
deleted file mode 100644
index 6fa9880..0000000
--- a/Wu10Man/UserControls/AdvancedOptions.xaml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Wu10Man/UserControls/AdvancedOptions.xaml.cs b/Wu10Man/UserControls/AdvancedOptions.xaml.cs
deleted file mode 100644
index c9b7c6e..0000000
--- a/Wu10Man/UserControls/AdvancedOptions.xaml.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Windows.Controls;
-using WereDev.Utils.Wu10Man.Helpers;
-
-namespace WereDev.Utils.Wu10Man.UserControls
-{
- ///
- /// Interaction logic for AdvancedOptions.xaml
- ///
- public partial class AdvancedOptions : UserControl
- {
- public AdvancedOptions()
- {
- Wu10Logger.LogInfo("Advanced control initializing.");
- InitializeComponent();
- Wu10Logger.LogInfo("Advanced control initialized.");
- }
- }
-}
diff --git a/Wu10Man/UserControls/BasicOptions.xaml b/Wu10Man/UserControls/BasicOptions.xaml
deleted file mode 100644
index ee7acb8..0000000
--- a/Wu10Man/UserControls/BasicOptions.xaml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
diff --git a/Wu10Man/UserControls/BasicOptions.xaml.cs b/Wu10Man/UserControls/BasicOptions.xaml.cs
deleted file mode 100644
index a486858..0000000
--- a/Wu10Man/UserControls/BasicOptions.xaml.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Windows.Controls;
-using WereDev.Utils.Wu10Man.Helpers;
-
-namespace WereDev.Utils.Wu10Man.UserControls
-{
- ///
- /// Interaction logic for BasicOptions.xaml
- ///
- public partial class BasicOptions : UserControl
- {
- public BasicOptions()
- {
- Wu10Logger.LogInfo("Basic control initializing.");
- InitializeComponent();
- Wu10Logger.LogInfo("Basic control initialized.");
- }
- }
-}
diff --git a/Wu10Man/UserControls/GroupPolicyControl.xaml b/Wu10Man/UserControls/GroupPolicyControl.xaml
index a1b5ffa..8591892 100644
--- a/Wu10Man/UserControls/GroupPolicyControl.xaml
+++ b/Wu10Man/UserControls/GroupPolicyControl.xaml
@@ -1,16 +1,43 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wu10Man/UserControls/GroupPolicyControl.xaml.cs b/Wu10Man/UserControls/GroupPolicyControl.xaml.cs
index 073309f..33d1f41 100644
--- a/Wu10Man/UserControls/GroupPolicyControl.xaml.cs
+++ b/Wu10Man/UserControls/GroupPolicyControl.xaml.cs
@@ -1,135 +1,137 @@
-using Microsoft.Win32;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Windows.Controls;
-using WereDev.Utils.Wu10Man.Editors;
-using WereDev.Utils.Wu10Man.Helpers;
-
-namespace WereDev.Utils.Wu10Man.UserControls
-{
- ///
- /// Interaction logic for GroupPolicyControl.xaml
- ///
- public partial class GroupPolicyControl : UserControl
- {
- const string ENABLE = "ENABLE";
- const string DISABLE = "DISABLE";
- const string NOTIFY_DOWNLOAD = "NOTIFY_DOWNLOAD";
- const string NOTIFY_INSTALL = "NOTIFY_INSTALL";
- const string SCHEDULE_INSTALL = "SCHEDULE_INSTALL";
-
- const string AUOPTION_NOTIFY_DOWNLOAD = "2";
- const string AUOPTION_NOTIFY_INSTALL = "3";
- const string AUOPTION_SCHEDULE_INSTALL = "4";
-
- const string NOUPDATE_ENABLE = "0";
- const string NOUPDATE_DISABLE = "1";
-
- const string REGISTRY_ROOT = @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU";
- const string REGISTRY_AUOPTION = "AuOptions";
- const string REGISTRY_NOUPDATE = "NoAutoUpdate";
-
- public ObservableCollection> PolicyOptions { get; set; }
- public KeyValuePair SelectedPolicyOption { get; set; }
-
- public GroupPolicyControl()
- {
- Wu10Logger.LogInfo("Group Policy Control initializing.");
- CreatePolicyOptions();
- GetCurrentStatus();
- InitializeComponent();
- Wu10Logger.LogInfo("Group Policy Control initialized.");
- }
-
- private void CreatePolicyOptions()
- {
- var options = new ObservableCollection>()
- {
- new KeyValuePair( ENABLE, "Enable Automatic Updates" ),
- new KeyValuePair( DISABLE, "Disable Automatic Updates" ),
- new KeyValuePair( NOTIFY_DOWNLOAD, "Notify of Download and Installation" ),
- new KeyValuePair( NOTIFY_INSTALL, "Automatic Download, Notify of Installation" ),
-
- //TODO: Implement scheduling config to get this working.
- //new KeyValuePair( SCHEDULE_INSTALL, "Automatic Download, Schedule Install")
- };
-
- PolicyOptions = options;
- }
-
- private void GetCurrentStatus()
- {
- var status = GetNoUpdateStatus();
- if (status == ENABLE)
- status = GetAuOptionStatus();
-
- SelectedPolicyOption = PolicyOptions.FirstOrDefault(x => x.Key == status);
- }
-
- private string GetNoUpdateStatus()
- {
- var nauValue = RegistryEditor.ReadLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
- switch (nauValue)
- {
- case NOUPDATE_ENABLE:
- return DISABLE;
- case NOUPDATE_DISABLE:
- default:
- return ENABLE;
- }
- }
-
- private string GetAuOptionStatus()
- {
- var auValue = RegistryEditor.ReadLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION);
-
- switch (auValue)
- {
- case AUOPTION_NOTIFY_DOWNLOAD:
- return NOTIFY_DOWNLOAD;
- case AUOPTION_NOTIFY_INSTALL:
- return NOTIFY_INSTALL;
- case AUOPTION_SCHEDULE_INSTALL:
- return SCHEDULE_INSTALL;
- default:
- return ENABLE;
- }
- }
-
- private void GroupPoliciesSelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- SelectedPolicyOption = (KeyValuePair)e.AddedItems[0];
- }
-
- private void SetGroupPolicy(object sender, System.Windows.RoutedEventArgs e)
- {
- switch (SelectedPolicyOption.Key)
- {
- case ENABLE:
- RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION);
- RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
- break;
- case DISABLE:
- RegistryEditor.WriteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE, NOUPDATE_ENABLE, RegistryValueKind.DWord);
- RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION);
- break;
- case NOTIFY_DOWNLOAD:
- RegistryEditor.WriteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION, AUOPTION_NOTIFY_DOWNLOAD, RegistryValueKind.DWord);
- RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
- break;
- case NOTIFY_INSTALL:
- RegistryEditor.WriteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION, AUOPTION_NOTIFY_INSTALL, RegistryValueKind.DWord);
- RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
- break;
- case SCHEDULE_INSTALL:
- RegistryEditor.WriteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION, AUOPTION_SCHEDULE_INSTALL, RegistryValueKind.DWord);
- RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
- break;
- }
-
- Wu10Logger.LogInfo(string.Format("Group Policy set: {0}", SelectedPolicyOption.Value));
- System.Windows.MessageBox.Show("Registry settings udpated.", "Group Policies", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
- }
- }
-}
+using Microsoft.Win32;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Imaging;
+using WereDev.Utils.Wu10Man.Editors;
+using WereDev.Utils.Wu10Man.Helpers;
+
+namespace WereDev.Utils.Wu10Man.UserControls
+{
+ ///
+ /// Interaction logic for GroupPolicyControl.xaml
+ ///
+ public partial class GroupPolicyControl : UserControl
+ {
+ const string ENABLE = "ENABLE";
+ const string DISABLE = "DISABLE";
+ const string NOTIFY_DOWNLOAD = "NOTIFY_DOWNLOAD";
+ const string NOTIFY_INSTALL = "NOTIFY_INSTALL";
+ const string SCHEDULE_INSTALL = "SCHEDULE_INSTALL";
+
+ const string AUOPTION_NOTIFY_DOWNLOAD = "2";
+ const string AUOPTION_NOTIFY_INSTALL = "3";
+ const string AUOPTION_SCHEDULE_INSTALL = "4";
+
+ const string NOUPDATE_ENABLE = "0";
+ const string NOUPDATE_DISABLE = "1";
+
+ const string REGISTRY_ROOT = @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU";
+ const string REGISTRY_AUOPTION = "AuOptions";
+ const string REGISTRY_NOUPDATE = "NoAutoUpdate";
+
+ public ObservableCollection> PolicyOptions { get; set; }
+ public KeyValuePair SelectedPolicyOption { get; set; }
+
+ public GroupPolicyControl()
+ {
+ Wu10Logger.LogInfo("Group Policy Control initializing.");
+ CreatePolicyOptions();
+ GetCurrentStatus();
+ InitializeComponent();
+ Wu10Logger.LogInfo("Group Policy Control initialized.");
+ }
+
+ private void CreatePolicyOptions()
+ {
+ var options = new ObservableCollection>()
+ {
+ new KeyValuePair( ENABLE, "Enable Automatic Updates" ),
+ new KeyValuePair( DISABLE, "Disable Automatic Updates" ),
+ new KeyValuePair( NOTIFY_DOWNLOAD, "Notify of Download and Installation" ),
+ new KeyValuePair( NOTIFY_INSTALL, "Automatic Download, Notify of Installation" ),
+
+ //TODO: Implement scheduling config to get this working.
+ //new KeyValuePair( SCHEDULE_INSTALL, "Automatic Download, Schedule Install")
+ };
+
+ PolicyOptions = options;
+ }
+
+ private void GetCurrentStatus()
+ {
+ var status = GetNoUpdateStatus();
+ if (status == ENABLE)
+ status = GetAuOptionStatus();
+
+ SelectedPolicyOption = PolicyOptions.FirstOrDefault(x => x.Key == status);
+ }
+
+ private string GetNoUpdateStatus()
+ {
+ var nauValue = RegistryEditor.ReadLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
+ switch (nauValue)
+ {
+ case NOUPDATE_ENABLE:
+ return DISABLE;
+ case NOUPDATE_DISABLE:
+ default:
+ return ENABLE;
+ }
+ }
+
+ private string GetAuOptionStatus()
+ {
+ var auValue = RegistryEditor.ReadLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION);
+
+ switch (auValue)
+ {
+ case AUOPTION_NOTIFY_DOWNLOAD:
+ return NOTIFY_DOWNLOAD;
+ case AUOPTION_NOTIFY_INSTALL:
+ return NOTIFY_INSTALL;
+ case AUOPTION_SCHEDULE_INSTALL:
+ return SCHEDULE_INSTALL;
+ default:
+ return ENABLE;
+ }
+ }
+
+ private void GroupPoliciesSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ SelectedPolicyOption = (KeyValuePair)e.AddedItems[0];
+ }
+
+ private void SetGroupPolicy(object sender, System.Windows.RoutedEventArgs e)
+ {
+ switch (SelectedPolicyOption.Key)
+ {
+ case ENABLE:
+ RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION);
+ RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
+ break;
+ case DISABLE:
+ RegistryEditor.WriteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE, NOUPDATE_ENABLE, RegistryValueKind.DWord);
+ RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION);
+ break;
+ case NOTIFY_DOWNLOAD:
+ RegistryEditor.WriteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION, AUOPTION_NOTIFY_DOWNLOAD, RegistryValueKind.DWord);
+ RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
+ break;
+ case NOTIFY_INSTALL:
+ RegistryEditor.WriteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION, AUOPTION_NOTIFY_INSTALL, RegistryValueKind.DWord);
+ RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
+ break;
+ case SCHEDULE_INSTALL:
+ RegistryEditor.WriteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_AUOPTION, AUOPTION_SCHEDULE_INSTALL, RegistryValueKind.DWord);
+ RegistryEditor.DeleteLocalMachineRegistryValue(REGISTRY_ROOT, REGISTRY_NOUPDATE);
+ break;
+ }
+
+ Wu10Logger.LogInfo(string.Format("Group Policy set: {0}", SelectedPolicyOption.Value));
+ System.Windows.MessageBox.Show("Registry settings updated.", "Group Policies", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
+ }
+ }
+}
diff --git a/Wu10Man/UserControls/HostsFileControl.xaml b/Wu10Man/UserControls/HostsFileControl.xaml
index 4bb3be9..61e338f 100644
--- a/Wu10Man/UserControls/HostsFileControl.xaml
+++ b/Wu10Man/UserControls/HostsFileControl.xaml
@@ -5,22 +5,40 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wpfspark="clr-namespace:WPFSpark;assembly=WPFSpark"
mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="350" >
+ d:DesignHeight="363"
+ d:DesignWidth="578">
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wu10Man/UserControls/HostsFileControl.xaml.cs b/Wu10Man/UserControls/HostsFileControl.xaml.cs
index d51d8a8..a50ed87 100644
--- a/Wu10Man/UserControls/HostsFileControl.xaml.cs
+++ b/Wu10Man/UserControls/HostsFileControl.xaml.cs
@@ -79,7 +79,7 @@ private void BlockAllHosts_Click(object sender, System.Windows.RoutedEventArgs e
private void ShowUpdateNotice()
{
- System.Windows.MessageBox.Show("Hosts file udpated.", "Hosts File", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
+ System.Windows.MessageBox.Show("Hosts file updated.", "Hosts File", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
}
}
}
diff --git a/Wu10Man/UserControls/Models/PauseUpdatesModel.cs b/Wu10Man/UserControls/Models/PauseUpdatesModel.cs
new file mode 100644
index 0000000..35d74de
--- /dev/null
+++ b/Wu10Man/UserControls/Models/PauseUpdatesModel.cs
@@ -0,0 +1,64 @@
+using System;
+
+namespace WereDev.Utils.Wu10Man.UserControls.Models
+{
+ class PauseUpdatesModel : ModelBase
+ {
+ private DateTime? _featureUpdatePauseDate = null;
+ public DateTime? FeatureUpdatePauseDate
+ {
+ get
+ {
+ return _featureUpdatePauseDate;
+ }
+ set
+ {
+ _featureUpdatePauseDate = value;
+ OnPropertyChanged(nameof(FeatureUpdatePauseDate));
+ }
+ }
+
+ private int _featureUpdateDelayDays = 0;
+ public int FeatureUpdateDelayDays
+ {
+ get
+ {
+ return _featureUpdateDelayDays;
+ }
+ set
+ {
+ _featureUpdateDelayDays = value;
+ OnPropertyChanged(nameof(FeatureUpdateDelayDays));
+ }
+ }
+
+ private DateTime? _qualityUpdatePauseDate = null;
+ public DateTime? QualityUpdatePauseDate
+ {
+ get
+ {
+ return _qualityUpdatePauseDate;
+ }
+ set
+ {
+ _qualityUpdatePauseDate = value;
+ OnPropertyChanged(nameof(QualityUpdatePauseDate));
+ }
+ }
+
+ private int _qualityUpdateDelayDays = 0;
+ public int QualityUpdateDelayDays
+ {
+ get
+ {
+ return _qualityUpdateDelayDays;
+ }
+ set
+ {
+ _qualityUpdateDelayDays = value;
+ OnPropertyChanged(nameof(QualityUpdateDelayDays));
+ }
+ }
+
+ }
+}
diff --git a/Wu10Man/UserControls/PauseUpdatesControl.xaml b/Wu10Man/UserControls/PauseUpdatesControl.xaml
new file mode 100644
index 0000000..910d456
--- /dev/null
+++ b/Wu10Man/UserControls/PauseUpdatesControl.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wu10Man/UserControls/PauseUpdatesControl.xaml.cs b/Wu10Man/UserControls/PauseUpdatesControl.xaml.cs
new file mode 100644
index 0000000..7d9c1a8
--- /dev/null
+++ b/Wu10Man/UserControls/PauseUpdatesControl.xaml.cs
@@ -0,0 +1,177 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using WereDev.Utils.Wu10Man.Editors;
+using WereDev.Utils.Wu10Man.Helpers;
+using WereDev.Utils.Wu10Man.UserControls.Models;
+
+namespace WereDev.Utils.Wu10Man.UserControls
+{
+ ///
+ /// Interaction logic for PauseUpdates.xaml
+ ///
+ public partial class PauseUpdatesControl : UserControl
+ {
+ private readonly Regex _numberOnlyRegex = new Regex("[^0-9]+");
+ private readonly PauseUpdatesModel _model = new PauseUpdatesModel();
+ private const string UXRegistryKey = @"SOFTWARE\Microsoft\WindowsUpdate\UX\Settings";
+ private const string DeferFeatureUpdatesPeriodInDays = "DeferFeatureUpdatesPeriodInDays";
+ private const string PauseFeatureUpdatesStartTime = "PauseFeatureUpdatesStartTime";
+ private const string PauseFeatureUpdatesEndTime = "PauseFeatureUpdatesEndTime";
+ private const string DeferQualityUpdatesPeriodInDays = "DeferQualityUpdatesPeriodInDays";
+ private const string PauseQualityUpdatesStartTime = "PauseQualityUpdatesStartTime";
+ private const string PauseQualityUpdatesEndTime = "PauseQualityUpdatesEndTime";
+ private const string PauseUpdatesExpiryTime = "PauseUpdatesExpiryTime";
+ private const string PendingRebootStartTime = "PendingRebootStartTime";
+
+ public PauseUpdatesControl()
+ {
+ Wu10Logger.LogInfo("Pause and Defer initializing.");
+ DataContext = _model;
+ InitializeComponent();
+ ReadCurrentSettings();
+ Wu10Logger.LogInfo("Pause and Defer initialized.");
+ }
+
+ private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
+ {
+ e.Handled = _numberOnlyRegex.IsMatch(e.Text);
+ }
+
+ private void ReadCurrentSettings()
+ {
+ _model.FeatureUpdateDelayDays = GetIntFromRegistryValue(DeferFeatureUpdatesPeriodInDays);
+ _model.FeatureUpdatePauseDate = GetDateFromRegistryValue(PauseFeatureUpdatesEndTime);
+ _model.QualityUpdateDelayDays = GetIntFromRegistryValue(DeferQualityUpdatesPeriodInDays);
+ _model.QualityUpdatePauseDate = GetDateFromRegistryValue(PauseQualityUpdatesEndTime);
+ }
+
+ private DateTime? GetDateFromRegistryValue(string registryName)
+ {
+ var registryValue = RegistryEditor.ReadLocalMachineRegistryValue(UXRegistryKey, registryName);
+ if (DateTime.TryParse(registryValue, out var parsedValue))
+ return parsedValue;
+ else
+ return null;
+ }
+
+ private int GetIntFromRegistryValue(string registryName)
+ {
+ var registryValue = RegistryEditor.ReadLocalMachineRegistryValue(UXRegistryKey, registryName);
+ if (int.TryParse(registryValue, out var parsedValue))
+ return parsedValue;
+ else
+ return 0;
+ }
+
+ private void SaveChanges(object sender, System.Windows.RoutedEventArgs e)
+ {
+ WriteChanges();
+ }
+
+ private void ResetChanges(object sender, System.Windows.RoutedEventArgs e)
+ {
+ ReadCurrentSettings();
+ }
+
+ private void ClearValues(object sender, System.Windows.RoutedEventArgs e)
+ {
+ _model.FeatureUpdateDelayDays = 0;
+ _model.FeatureUpdatePauseDate = null;
+ _model.QualityUpdateDelayDays = 0;
+ _model.QualityUpdatePauseDate = null;
+ WriteChanges();
+ }
+
+ private void WriteChanges()
+ {
+ var nowString = GetDateString(DateTime.Now);
+ if (_model.FeatureUpdatePauseDate.HasValue)
+ {
+ var pauseDateString = GetDateString(_model.FeatureUpdatePauseDate.Value);
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, PauseFeatureUpdatesStartTime, nowString, RegistryValueKind.String);
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, PauseFeatureUpdatesEndTime, pauseDateString, RegistryValueKind.String);
+ Wu10Logger.LogInfo($"Saving Feature Pause Date: {pauseDateString}");
+ }
+ else
+ {
+ RegistryEditor.DeleteLocalMachineRegistryValue(UXRegistryKey, PauseFeatureUpdatesStartTime);
+ RegistryEditor.DeleteLocalMachineRegistryValue(UXRegistryKey, PauseFeatureUpdatesEndTime);
+ Wu10Logger.LogInfo("Removing Feature Pause Date");
+ }
+
+ if (_model.FeatureUpdateDelayDays > 0)
+ {
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, DeferFeatureUpdatesPeriodInDays, _model.FeatureUpdateDelayDays.ToString(), RegistryValueKind.DWord);
+ Wu10Logger.LogInfo($"Saving Feature Deferal Days: {_model.FeatureUpdateDelayDays}");
+ }
+ else
+ {
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, DeferFeatureUpdatesPeriodInDays, "0", RegistryValueKind.DWord);
+ Wu10Logger.LogInfo($"Saving Feature Deferal Days: 0");
+ }
+
+ if (_model.QualityUpdatePauseDate.HasValue)
+ {
+ var pauseDateString = GetDateString(_model.QualityUpdatePauseDate.Value);
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, PauseQualityUpdatesStartTime, nowString, RegistryValueKind.String);
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, PauseQualityUpdatesEndTime, pauseDateString, RegistryValueKind.String);
+ Wu10Logger.LogInfo($"Saving Quality Pause Date: {pauseDateString}");
+ }
+ else
+ {
+ RegistryEditor.DeleteLocalMachineRegistryValue(UXRegistryKey, PauseQualityUpdatesStartTime);
+ RegistryEditor.DeleteLocalMachineRegistryValue(UXRegistryKey, PauseQualityUpdatesEndTime);
+ Wu10Logger.LogInfo("Removing Quality Pause Date");
+ }
+
+ if (_model.QualityUpdateDelayDays > 0)
+ {
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, DeferQualityUpdatesPeriodInDays, _model.QualityUpdateDelayDays.ToString(), RegistryValueKind.DWord);
+ Wu10Logger.LogInfo($"Saving Quality Deferal Days: {_model.QualityUpdateDelayDays}");
+ }
+ else
+ {
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, DeferQualityUpdatesPeriodInDays, "0", RegistryValueKind.DWord);
+ Wu10Logger.LogInfo($"Saving Quality Deferal Days: {_model.FeatureUpdateDelayDays}");
+ }
+
+ var latestDate = Math.Max(_model.FeatureUpdatePauseDate?.Ticks ?? 0, _model.QualityUpdatePauseDate?.Ticks ?? 0);
+ if (latestDate > 0)
+ {
+ var pauseDateString = GetDateString(new DateTime(latestDate));
+ RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, PauseUpdatesExpiryTime, GetDateString(new DateTime(latestDate)), RegistryValueKind.String);
+ //RegistryEditor.WriteLocalMachineRegistryValue(UXRegistryKey, PendingRebootStartTime, now.ToString(dateFormat), RegistryValueKind.String);
+ Wu10Logger.LogInfo($"Saving Pause Date Expiry: {pauseDateString}");
+ }
+ else
+ {
+ RegistryEditor.DeleteLocalMachineRegistryValue(UXRegistryKey, PauseUpdatesExpiryTime);
+ Wu10Logger.LogInfo($"Removing Pause Date Expiry");
+ }
+
+ MessageBox.Show($"Windows Update pause dates and deferal period have been saved.", "Pause and Defer", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
+ }
+
+ private string GetDateString(DateTime datetime)
+ {
+ var utc = datetime.Date.ToUniversalTime();
+ var currentTime = DateTime.Now - DateTime.Today;
+ var utcPlusTime = utc.Add(currentTime);
+ return utcPlusTime.ToString("yyyy-MM-ddTHH:mm:ssZ");
+ }
+ }
+}
diff --git a/Wu10Man/UserControls/WindowsServicesControl.xaml b/Wu10Man/UserControls/WindowsServicesControl.xaml
index b9ba759..693282f 100644
--- a/Wu10Man/UserControls/WindowsServicesControl.xaml
+++ b/Wu10Man/UserControls/WindowsServicesControl.xaml
@@ -5,26 +5,60 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wpfspark="clr-namespace:WPFSpark;assembly=WPFSpark"
mc:Ignorable="d"
- d:DesignHeight="450"
- d:DesignWidth="300"
+ d:DesignHeight="363"
+ d:DesignWidth="578"
>
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wu10Man/About.xaml b/Wu10Man/UserWindows/About.xaml
similarity index 85%
rename from Wu10Man/About.xaml
rename to Wu10Man/UserWindows/About.xaml
index 6aaffaa..1505a00 100644
--- a/Wu10Man/About.xaml
+++ b/Wu10Man/UserWindows/About.xaml
@@ -1,16 +1,15 @@
-
-
-
+
+
https://github.com/WereDev/Wu10Man/
diff --git a/Wu10Man/About.xaml.cs b/Wu10Man/UserWindows/About.xaml.cs
similarity index 94%
rename from Wu10Man/About.xaml.cs
rename to Wu10Man/UserWindows/About.xaml.cs
index 4dd39cd..c37934e 100644
--- a/Wu10Man/About.xaml.cs
+++ b/Wu10Man/UserWindows/About.xaml.cs
@@ -3,7 +3,7 @@
using System.Windows.Documents;
using System.Windows.Navigation;
-namespace WereDev.Utils.Wu10Man
+namespace WereDev.Utils.Wu10Man.UserWindows
{
///
/// Interaction logic for About.xaml
diff --git a/Wu10Man/MainWindow.xaml b/Wu10Man/UserWindows/MainWindow.xaml
similarity index 50%
rename from Wu10Man/MainWindow.xaml
rename to Wu10Man/UserWindows/MainWindow.xaml
index 4d5f3c4..26fc784 100644
--- a/Wu10Man/MainWindow.xaml
+++ b/Wu10Man/UserWindows/MainWindow.xaml
@@ -1,14 +1,13 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wu10Man/MainWindow.xaml.cs b/Wu10Man/UserWindows/MainWindow.xaml.cs
similarity index 60%
rename from Wu10Man/MainWindow.xaml.cs
rename to Wu10Man/UserWindows/MainWindow.xaml.cs
index e5f7739..8671a92 100644
--- a/Wu10Man/MainWindow.xaml.cs
+++ b/Wu10Man/UserWindows/MainWindow.xaml.cs
@@ -2,7 +2,7 @@
using System.Windows;
using WereDev.Utils.Wu10Man.Helpers;
-namespace WereDev.Utils.Wu10Man
+namespace WereDev.Utils.Wu10Man.UserWindows
{
///
/// Interaction logic for MainWindow.xaml
@@ -13,10 +13,7 @@ public MainWindow()
{
Wu10Logger.LogInfo("Main window initializing.");
InitializeComponent();
- //ShowAdvancedItem.IsChecked = Properties.Settings.Default.ShowAdvanced;
- //SetMainScreenView(Properties.Settings.Default.ShowAdvanced);
- SetMainScreenView(true);
- Wu10Logger.LogInfo("Main window initialized.");
+ Wu10Logger.LogInfo("Main window initialized.");
}
protected override void OnClosed(EventArgs e)
@@ -41,20 +38,12 @@ private void AboutItem_Click(object sender, RoutedEventArgs e)
private void LogFilesItem_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start(Wu10Logger.LogFolder);
- }
-
- private void ShowAdvancedItem_Click(object sender, RoutedEventArgs e)
- {
- Properties.Settings.Default.ShowAdvanced = !Properties.Settings.Default.ShowAdvanced;
- Properties.Settings.Default.Save();
- SetMainScreenView(Properties.Settings.Default.ShowAdvanced);
- }
-
- private void SetMainScreenView(bool showAdvanced)
- {
- this.AdvancedControl.Visibility = showAdvanced ? Visibility.Visible : Visibility.Hidden;
- this.BasicOptions.Visibility = showAdvanced ? Visibility.Hidden : Visibility.Visible;
- }
+ }
+
+ private void ReadmeItem_Click(object sender, RoutedEventArgs e)
+ {
+ System.Diagnostics.Process.Start("https://github.com/WereDev/Wu10Man/blob/master/README.md");
+ }
}
}
diff --git a/Wu10Man/Wu10Man.csproj b/Wu10Man/Wu10Man.csproj
index 9ba5300..04b13f4 100644
--- a/Wu10Man/Wu10Man.csproj
+++ b/Wu10Man/Wu10Man.csproj
@@ -27,7 +27,7 @@
false
true
0
- 2.1.3.0
+ 3.0.0.0
false
true
true
@@ -86,17 +86,35 @@
..\packages\WPFSpark.1.4.0\lib\net461\Microsoft.Expression.Interactions.dll
- ..\packages\NLog.4.5.6\lib\net45\NLog.dll
+ ..\packages\NLog.4.6.5\lib\net45\NLog.dll
+
+
+ ..\packages\System.Diagnostics.EventLog.4.5.0\lib\net461\System.Diagnostics.EventLog.dll
+
+
+
+
+ ..\packages\System.Security.AccessControl.4.5.0\lib\net461\System.Security.AccessControl.dll
+
+
+ ..\packages\System.Security.Permissions.4.5.0\lib\net461\System.Security.Permissions.dll
+
+
+ ..\packages\System.Security.Principal.Windows.4.5.1\lib\net461\System.Security.Principal.Windows.dll
+
+
+ ..\packages\System.ServiceProcess.ServiceController.4.5.0\lib\net461\System.ServiceProcess.ServiceController.dll
+
@@ -123,7 +141,8 @@
MSBuild:Compile
Designer
-
+
+
About.xaml
@@ -137,15 +156,9 @@
-
+
MainWindow.xaml
-
- AdvancedOptions.xaml
-
-
- BasicOptions.xaml
-
GroupPolicyControl.xaml
@@ -155,12 +168,16 @@
+
+
+ PauseUpdatesControl.xaml
+
WindowsServicesControl.xaml
-
+
Designer
MSBuild:Compile
@@ -169,23 +186,19 @@
Code
-
+
MSBuild:Compile
Designer
-
- Designer
- MSBuild:Compile
-
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
@@ -198,20 +211,11 @@
Code
-
- True
- Settings.settings
- True
-
Always
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
@@ -232,6 +236,12 @@
false
+
+
+
+
+
+
diff --git a/Wu10Man/packages.config b/Wu10Man/packages.config
index 4858171..f995c0a 100644
--- a/Wu10Man/packages.config
+++ b/Wu10Man/packages.config
@@ -1,6 +1,10 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Wu10Man/question.png b/Wu10Man/question.png
new file mode 100644
index 0000000..c02ce4a
Binary files /dev/null and b/Wu10Man/question.png differ
diff --git a/Wu10Man/warning.png b/Wu10Man/warning.png
new file mode 100644
index 0000000..243a15d
Binary files /dev/null and b/Wu10Man/warning.png differ