Skip to content

Portable Tool for an Ideal Windows Setup

-update file hosts, re & added unarchiv

Greedeks02268450cb22
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index 58e2cb75..454be785 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -16,6 +16,9 @@
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <NuGetPackageImportStamp>
+ </NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -28,11 +31,8 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
- <NuGetPackageImportStamp>
- </NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
@@ -248,6 +248,7 @@
<Compile Include="Core\Model\MainModel.cs" />
<Compile Include="Utilities\BlockRunTweaker.cs" />
<Compile Include="Utilities\DisablingWinKeys.cs" />
+ <Compile Include="Utilities\Helpers\UnarchiveManager.cs" />
<Compile Include="Utilities\Helpers\BackgroundQueue.cs" />
<Compile Include="Utilities\Helpers\RegistryHelp.cs" />
<Compile Include="Utilities\Settings.cs" />
diff --git a/.Source/GTweak/Properties/Resources.Designer.cs b/.Source/GTweak/Properties/Resources.Designer.cs
index 7e77f566..eded4c78 100644
--- a/.Source/GTweak/Properties/Resources.Designer.cs
+++ b/.Source/GTweak/Properties/Resources.Designer.cs
@@ -1,5 +1,24 @@
-namespace GTweak.Properties
-{
+//------------------------------------------------------------------------------
+// <auto-generated>
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace GTweak.Properties {
+ using System;
+
+
+ /// <summary>
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ /// </summary>
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
@@ -13,6 +32,9 @@
internal Resources() {
}
+ /// <summary>
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
@@ -24,6 +46,10 @@
}
}
+ /// <summary>
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
@@ -34,6 +60,9 @@
}
}
+ /// <summary>
+ /// Поиск локализованного ресурса типа System.Byte[].
+ /// </summary>
internal static byte[] Blank {
get {
object obj = ResourceManager.GetObject("Blank", resourceCulture);
@@ -41,6 +70,9 @@
}
}
+ /// <summary>
+ /// Поиск локализованного ресурса типа System.Byte[].
+ /// </summary>
internal static byte[] GTweak {
get {
object obj = ResourceManager.GetObject("GTweak", resourceCulture);
@@ -48,6 +80,9 @@
}
}
+ /// <summary>
+ /// Поиск локализованного ресурса типа System.Byte[].
+ /// </summary>
internal static byte[] hosts {
get {
object obj = ResourceManager.GetObject("hosts", resourceCulture);
@@ -55,6 +90,9 @@
}
}
+ /// <summary>
+ /// Поиск локализованного ресурса типа System.Byte[].
+ /// </summary>
internal static byte[] Sound {
get {
object obj = ResourceManager.GetObject("Sound", resourceCulture);
@@ -62,6 +100,9 @@
}
}
+ /// <summary>
+ /// Поиск локализованного ресурса типа System.Byte[].
+ /// </summary>
internal static byte[] Ultimate_Performance_pow {
get {
object obj = ResourceManager.GetObject("Ultimate_Performance_pow", resourceCulture);
diff --git a/.Source/GTweak/Resources/hosts.gz b/.Source/GTweak/Resources/hosts.gz
index fe3f0786..142bc083 100644
Binary files a/.Source/GTweak/Resources/hosts.gz and b/.Source/GTweak/Resources/hosts.gz differ
diff --git a/.Source/GTweak/Utilities/Helpers/UnarchiveManager.cs b/.Source/GTweak/Utilities/Helpers/UnarchiveManager.cs
new file mode 100644
index 00000000..e49dfb2d
--- /dev/null
+++ b/.Source/GTweak/Utilities/Helpers/UnarchiveManager.cs
@@ -0,0 +1,21 @@
+using System.IO;
+using System.IO.Compression;
+
+namespace GTweak.Utilities.Helpers
+{
+ internal sealed class UnarchiveManager
+ {
+ internal UnarchiveManager(string path, byte[] resource)
+ {
+ byte[] fileSize = default;
+ using (MemoryStream fileOut = new MemoryStream(resource))
+ using (GZipStream gz = new GZipStream(fileOut, CompressionMode.Decompress))
+ using (MemoryStream ms = new MemoryStream())
+ {
+ gz.CopyTo(ms);
+ fileSize = ms.ToArray();
+ }
+ File.WriteAllBytes(path, fileSize);
+ }
+ }
+}
diff --git a/.Source/GTweak/Utilities/Settings.cs b/.Source/GTweak/Utilities/Settings.cs
index 743698c6..3f79df5f 100644
--- a/.Source/GTweak/Utilities/Settings.cs
+++ b/.Source/GTweak/Utilities/Settings.cs
@@ -1,4 +1,5 @@
-using GTweak.Utilities.Helpers;
+using GTweak.Properties;
+using GTweak.Utilities.Helpers;
using GTweak.Windows;
using Microsoft.Win32;
using System;
@@ -41,8 +42,16 @@ namespace GTweak.Utilities
internal readonly void RunAnalysis()
{
- new ViewNotification().CheckingTempFile();
СheckingParameters();
+
+ if (!Directory.Exists(PathTempFiles))
+ Directory.CreateDirectory(PathTempFiles);
+
+ if (!File.Exists(PathIcon))
+ new UnarchiveManager(PathIcon, Resources.GTweak);
+
+ if (!File.Exists(PathSound))
+ new UnarchiveManager(PathSound, Resources.Sound);
}
private readonly void СheckingParameters()
diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
index 1bc414c2..25a6a35e 100644
--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
@@ -1,4 +1,5 @@
-using GTweak.Utilities.Helpers;
+using GTweak.Properties;
+using GTweak.Utilities.Helpers;
using GTweak.View;
using Microsoft.Win32;
using System;
@@ -370,20 +371,10 @@ namespace GTweak.Utilities.Tweaks
{
BlockSpyDomain(true);
- try { File.Delete(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts (Default GTweak)"); }
- catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
+ try { File.Delete(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts (Default GTweak)"); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); }
File.Move(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts", Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts (Default GTweak)");
-
- byte[] _byte = default;
- using (MemoryStream fileOut = new MemoryStream(Properties.Resources.hosts))
- using (GZipStream gz = new GZipStream(fileOut, CompressionMode.Decompress))
- using (MemoryStream ms = new MemoryStream())
- {
- gz.CopyTo(ms);
- _byte = ms.ToArray();
- }
- File.WriteAllBytes(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts", _byte);
+ new UnarchiveManager(Settings.PathSystemDisk + @"\Windows\System32\drivers\etc\hosts", Resources.hosts);
}
else
{
diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
index 2a668c5b..2fe2d431 100644
--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
@@ -460,27 +460,17 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseHoverTime", "400", RegistryValueKind.String);
break;
case "TglButton11":
- Environment.SpecialFolder folderWindows = Environment.SpecialFolder.Windows;
- string pathToWinF = Environment.GetFolderPath(folderWindows);
+ string pathToWinFolder = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Blank.ico";
try
{
if (isChoose)
{
- byte[] _iconByte = default;
- using (MemoryStream fileOut = new MemoryStream(Properties.Resources.Blank))
- using (GZipStream gz = new GZipStream(fileOut, CompressionMode.Decompress))
- using (MemoryStream ms = new MemoryStream())
- {
- gz.CopyTo(ms);
- _iconByte = ms.ToArray();
- }
- File.WriteAllBytes(pathToWinF + @"\Blank.ico", _iconByte);
-
+ new UnarchiveManager(pathToWinFolder, Properties.Resources.Blank);
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons", "29", @"%systemroot%\\Blank.ico,0", RegistryValueKind.String);
}
else
{
- File.Delete(pathToWinF + @"\Blank.ico");
+ File.Delete(pathToWinFolder);
RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons");
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
index 080481a1..aee5f460 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
@@ -750,18 +750,7 @@ namespace GTweak.Utilities.Tweaks
if (string.IsNullOrEmpty(_serchScheme))
{
- byte[] _byte = default;
- using (MemoryStream fileOut = new MemoryStream(Properties.Resources.Ultimate_Performance_pow))
- using (GZipStream gz = new GZipStream(fileOut, CompressionMode.Decompress))
- using (MemoryStream ms = new MemoryStream())
- {
- gz.CopyTo(ms);
- _byte = ms.ToArray();
- }
-
- Directory.CreateDirectory(Settings.PathTempFiles);
- File.WriteAllBytes(Settings.PathTempFiles + @"\UltimatePerformance.pow", _byte);
-
+ new UnarchiveManager(Settings.PathTempFiles + @"\UltimatePerformance.pow", Properties.Resources.Ultimate_Performance_pow);
string _guid = Guid.NewGuid().ToString("D");
diff --git a/.Source/GTweak/Utilities/ViewNotification.cs b/.Source/GTweak/Utilities/ViewNotification.cs
index ec4864a5..50ef661d 100644
--- a/.Source/GTweak/Utilities/ViewNotification.cs
+++ b/.Source/GTweak/Utilities/ViewNotification.cs
@@ -1,7 +1,4 @@
-using GTweak.Properties;
-using GTweak.Windows;
-using System.IO;
-using System.IO.Compression;
+using GTweak.Windows;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
@@ -45,38 +42,5 @@ namespace GTweak.Utilities
});
}
}
-
- internal void CheckingTempFile()
- {
- if (!File.Exists(Settings.PathIcon))
- {
- byte[] _iconByte = default;
- using (MemoryStream fileOut = new MemoryStream(Resources.GTweak))
- using (GZipStream gz = new GZipStream(fileOut, CompressionMode.Decompress))
- using (MemoryStream ms = new MemoryStream())
- {
- gz.CopyTo(ms);
- _iconByte = ms.ToArray();
- }
- Directory.CreateDirectory(Settings.PathTempFiles);
- File.WriteAllBytes(Settings.PathIcon, _iconByte);
- }
-
- if (!File.Exists(Settings.PathSound))
- {
- byte[] _soundbyte = default;
- using (MemoryStream fileOut = new MemoryStream(Resources.Sound))
- using (GZipStream gz = new GZipStream(fileOut, CompressionMode.Decompress))
- using (MemoryStream ms = new MemoryStream())
- {
- gz.CopyTo(ms);
- _soundbyte = ms.ToArray();
- }
-
- Directory.CreateDirectory(Settings.PathTempFiles);
- File.WriteAllBytes(Settings.PathSound, _soundbyte);
- }
-
- }
}
}