Browse Source

Updated to 4.4

hellzerg 6 years ago
parent
commit
f49b8861b8

+ 6 - 2
CHANGELOG.md

@@ -2,6 +2,10 @@
 
 All notable changes to this project will be documented in this file.
 
+## [4.4] - 2018-09-21
+- Improved: Disable Automatic Updates (Windows 10)
+- Added: Make HOSTS file read-only
+
 ## [4.3] - 2018-09-17
 - Added: Disable SmartScreen
 
@@ -78,7 +82,7 @@ All notable changes to this project will be documented in this file.
 ## [2.7] - 2017-04-04
 - Compatible with Windows 10 Creators Update
 - Added option to enable/disable Sensor Services
-- Added option to block domain in Hosts editor
+- Added option to block domain in HOSTS editor
 
 ## [2.6] - 2017-03-14
 - Minor visual fixes
@@ -120,7 +124,7 @@ All notable changes to this project will be documented in this file.
 - Major bug fixes
 
 ## [1.4] - 2016-09-12
-- Added Hosts editor
+- Added HOSTS editor
 - Added Integrator tool
 - Added theme option
 - Performance improvements

+ 1 - 1
Optimizer/App.config

@@ -2,5 +2,5 @@
 <configuration>
     <startup> 
         
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup>
 </configuration>

+ 5 - 0
Optimizer/HostsEditorForm.cs

@@ -18,6 +18,11 @@ namespace Optimizer
         {
             InitializeComponent();
             Options.ApplyTheme(this);
+
+            if (HostsHelper.GetReadOnly())
+            {
+                savebtn.Enabled = false;
+            }
         }
 
         private void HostsEditor_Load(object sender, EventArgs e)

+ 11 - 0
Optimizer/HostsHelper.cs

@@ -104,5 +104,16 @@ namespace Optimizer
             // remove multiple white spaces and keep only one
             return Regex.Replace(entry, @"\s{2,}", " ");
         }
+
+        internal static bool GetReadOnly()
+        {
+            return new FileInfo(HostsFile).IsReadOnly;
+        }
+
+        internal static void ReadOnly(bool enable)
+        {
+            FileInfo fi = new FileInfo(HostsFile);
+            fi.IsReadOnly = enable;
+        }
     }
 }

File diff suppressed because it is too large
+ 2563 - 2533
Optimizer/MainForm.Designer.cs


+ 27 - 0
Optimizer/MainForm.cs

@@ -479,6 +479,17 @@ namespace Optimizer
                     listHostEntries.Items.Add(_hostsEntries[i]);
                 }
             }
+
+            chkReadOnly.Checked = HostsHelper.GetReadOnly();
+
+            button47.Enabled = !chkReadOnly.Checked;
+            button46.Enabled = !chkReadOnly.Checked;
+            button42.Enabled = !chkReadOnly.Checked;
+            button41.Enabled = !chkReadOnly.Checked;
+            linkLabel4.Enabled = !chkReadOnly.Checked;
+            chkBlock.Enabled = !chkReadOnly.Checked;
+            txtDomain.Enabled = !chkReadOnly.Checked;
+            txtIP.Enabled = !chkReadOnly.Checked;
         }
 
         private void GetStartupItems()
@@ -1831,5 +1842,21 @@ namespace Optimizer
                 MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
+
+        private void chkReadOnly_CheckedChanged(object sender, EventArgs e)
+        {
+            HostsHelper.ReadOnly(chkReadOnly.Checked);
+
+            button47.Enabled = !chkReadOnly.Checked;
+            button46.Enabled = !chkReadOnly.Checked;
+            button42.Enabled = !chkReadOnly.Checked;
+            button41.Enabled = !chkReadOnly.Checked;
+            linkLabel4.Enabled = !chkReadOnly.Checked;
+            chkBlock.Enabled = !chkReadOnly.Checked;
+            txtDomain.Enabled = !chkReadOnly.Checked;
+            txtIP.Enabled = !chkReadOnly.Checked;
+
+            txtIP.Focus();
+        }
     }
 }

+ 3 - 2
Optimizer/Optimize.cs

@@ -459,6 +459,7 @@ namespace Optimizer
 
         internal static void DisableAutomaticUpdates()
         {
+            Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", "0", RegistryValueKind.DWord);
             Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions", "2", RegistryValueKind.DWord);
             Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoRebootWithLoggedOnUsers", "1", RegistryValueKind.DWord);
             Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config", "DODownloadMode", "0", RegistryValueKind.DWord);
@@ -466,10 +467,10 @@ namespace Optimizer
 
         internal static void EnableAutomaticUpdates()
         {
-            Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "AUOptions", "5", RegistryValueKind.DWord);
+            Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", true).DeleteValue("AUOptions", false);
+            Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", true).DeleteValue("NoAutoUpdate", false);
             Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoRebootWithLoggedOnUsers", "0", RegistryValueKind.DWord);
             Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config", "DODownloadMode", "1", RegistryValueKind.DWord);
-            Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU", "NoAutoUpdate", "0", RegistryValueKind.DWord);
         }
 
         // no longer useful

+ 1 - 1
Optimizer/Optimizer.csproj

@@ -9,7 +9,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Optimizer</RootNamespace>
     <AssemblyName>Optimizer</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     <IsWebBootstrapper>false</IsWebBootstrapper>

+ 1 - 1
Optimizer/Program.cs

@@ -18,7 +18,7 @@ namespace Optimizer
 
         // Enter current version here
         internal readonly static float Major = 4;
-        internal readonly static float Minor = 3;
+        internal readonly static float Minor = 4;
 
         internal static string GetCurrentVersionTostring()
         {

+ 1 - 1
Optimizer/Properties/Settings.Designer.cs

@@ -12,7 +12,7 @@ namespace Optimizer.Properties {
     
     
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
         
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

+ 2 - 2
README.md

@@ -37,5 +37,5 @@ https://github.com/hellzerg/optimizer/blob/master/IMAGES.md
 
 ## Details: ##
 
-* Latest version: 4.3
-* Released: September 17, 2018
+* Latest version: 4.4
+* Released: September 21, 2018

+ 1 - 1
version.txt

@@ -1 +1 @@
-4.3
+4.4

Some files were not shown because too many files changed in this diff