Skip to content

Portable Tool for an Ideal Windows Setup

add editorconfig & upd assemblyInfo.tt

Greedeks251b6a4f3604
diff --git a/.Source/GTweak/.editorconfig b/.Source/GTweak/.editorconfig
new file mode 100644
index 00000000..142c249a
--- /dev/null
+++ b/.Source/GTweak/.editorconfig
@@ -0,0 +1,206 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = crlf
+insert_final_newline = false
+indent_style = space
+indent_size = 4
+tab_width = 4
+
+[*.cs]
+end_of_line = crlf
+insert_final_newline = false
+indent_style = space
+indent_size = 4
+tab_width = 4
+
+dotnet_hide_advanced_members = false
+dotnet_member_insertion_location = with_other_members_of_the_same_kind
+dotnet_property_generation_behavior = prefer_throwing_properties
+
+dotnet_search_reference_assemblies = true
+
+dotnet_separate_import_directive_groups = false
+dotnet_sort_system_directives_first = true
+file_header_template = unset
+
+dotnet_style_qualification_for_event = false
+dotnet_style_qualification_for_field = false
+dotnet_style_qualification_for_method = false
+dotnet_style_qualification_for_property = false
+
+dotnet_style_predefined_type_for_locals_parameters_members = true
+dotnet_style_predefined_type_for_member_access = true
+
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
+
+dotnet_style_require_accessibility_modifiers = for_non_interface_members
+
+dotnet_prefer_system_hash_code = true
+dotnet_style_coalesce_expression = true
+dotnet_style_collection_initializer = true
+dotnet_style_explicit_tuple_names = true
+dotnet_style_namespace_match_folder = true
+dotnet_style_null_propagation = true
+dotnet_style_object_initializer = true
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+dotnet_style_prefer_auto_properties = true
+dotnet_style_prefer_collection_expression = when_types_loosely_match
+dotnet_style_prefer_compound_assignment = true
+dotnet_style_prefer_conditional_expression_over_assignment = true
+dotnet_style_prefer_conditional_expression_over_return = true
+dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
+dotnet_style_prefer_inferred_anonymous_type_member_names = true
+dotnet_style_prefer_inferred_tuple_names = true
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true
+dotnet_style_prefer_simplified_boolean_expressions = true
+dotnet_style_prefer_simplified_interpolation = true
+
+dotnet_style_readonly_field = true
+
+dotnet_code_quality_unused_parameters = all
+
+dotnet_remove_unnecessary_suppression_exclusions = none
+
+dotnet_style_allow_multiple_blank_lines_experimental = true
+dotnet_style_allow_statement_immediately_after_block_experimental = true
+
+csharp_style_var_elsewhere = false
+csharp_style_var_for_built_in_types = false
+csharp_style_var_when_type_is_apparent = false
+
+csharp_style_expression_bodied_accessors = true
+csharp_style_expression_bodied_constructors = false
+csharp_style_expression_bodied_indexers = true
+csharp_style_expression_bodied_lambdas = true
+csharp_style_expression_bodied_local_functions = false
+csharp_style_expression_bodied_methods = false
+csharp_style_expression_bodied_operators = false
+csharp_style_expression_bodied_properties = true
+
+csharp_style_pattern_matching_over_as_with_null_check = true
+csharp_style_pattern_matching_over_is_with_cast_check = true
+csharp_style_prefer_extended_property_pattern = true
+csharp_style_prefer_not_pattern = true
+csharp_style_prefer_pattern_matching = true
+csharp_style_prefer_switch_expression = true
+
+csharp_style_conditional_delegate_call = true
+
+csharp_prefer_static_anonymous_function = true
+csharp_prefer_static_local_function = true
+csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
+csharp_style_prefer_readonly_struct = true
+csharp_style_prefer_readonly_struct_member = true
+
+csharp_prefer_braces = true:warning
+csharp_prefer_simple_using_statement = true
+csharp_prefer_system_threading_lock = true
+csharp_style_namespace_declarations = block_scoped
+csharp_style_prefer_method_group_conversion = true
+csharp_style_prefer_primary_constructors = true
+csharp_style_prefer_simple_property_accessors = true
+csharp_style_prefer_top_level_statements = true
+
+csharp_prefer_simple_default_expression = true
+csharp_style_deconstructed_variable_declaration = true
+csharp_style_implicit_object_creation_when_type_is_apparent = true
+csharp_style_inlined_variable_declaration = true
+csharp_style_prefer_implicitly_typed_lambda_expression = true
+csharp_style_prefer_index_operator = true
+csharp_style_prefer_local_over_anonymous_function = true
+csharp_style_prefer_null_check_over_type_check = true
+csharp_style_prefer_range_operator = true
+csharp_style_prefer_tuple_swap = true
+csharp_style_prefer_unbound_generic_type_in_nameof = true
+csharp_style_prefer_utf8_string_literals = true
+csharp_style_throw_expression = true
+csharp_style_unused_value_assignment_preference = discard_variable
+csharp_style_unused_value_expression_statement_preference = discard_variable
+
+csharp_using_directive_placement = outside_namespace
+
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
+csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
+csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
+csharp_style_allow_embedded_statements_on_same_line_experimental = true
+
+csharp_new_line_before_catch = true
+csharp_new_line_before_else = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true
+
+csharp_indent_block_contents = true
+csharp_indent_braces = false
+csharp_indent_case_contents = true
+csharp_indent_case_contents_when_block = true
+csharp_indent_labels = one_less_than_current
+csharp_indent_switch_labels = true
+
+csharp_space_after_cast = false
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_after_comma = true
+csharp_space_after_dot = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_after_semicolon_in_for_statement = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_around_declaration_statements = false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_before_comma = false
+csharp_space_before_dot = false
+csharp_space_before_open_square_brackets = false
+csharp_space_before_semicolon_in_for_statement = false
+csharp_space_between_empty_square_brackets = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_name_and_open_parenthesis = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_space_between_square_brackets = false
+
+csharp_preserve_single_line_blocks = true
+csharp_preserve_single_line_statements = true
+
+dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
+dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
+dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
+
+dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.types_should_be_pascal_case.symbols = types
+dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
+
+dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
+dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
+
+dotnet_naming_symbols.interface.applicable_kinds = interface
+dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.interface.required_modifiers =
+
+dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
+dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.types.required_modifiers =
+
+dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
+dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.non_field_members.required_modifiers =
+
+dotnet_naming_style.pascal_case.required_prefix =
+dotnet_naming_style.pascal_case.required_suffix =
+dotnet_naming_style.pascal_case.word_separator =
+dotnet_naming_style.pascal_case.capitalization = pascal_case
+
+dotnet_naming_style.begins_with_i.required_prefix = I
+dotnet_naming_style.begins_with_i.required_suffix =
+dotnet_naming_style.begins_with_i.word_separator =
+dotnet_naming_style.begins_with_i.capitalization = pascal_case
\ No newline at end of file
diff --git a/.Source/GTweak/App.xaml.cs b/.Source/GTweak/App.xaml.cs
index 41606fdc..6b02ad52 100644
--- a/.Source/GTweak/App.xaml.cs
+++ b/.Source/GTweak/App.xaml.cs
@@ -1,11 +1,13 @@
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Windows;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Threading;
+
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Windows;
+
using Wpf.Ui.Appearance;
namespace GTweak
@@ -58,7 +60,10 @@ namespace GTweak
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e.ExceptionObject is Exception ex)
+ {
ErrorLogging.LogWritingFile(ex);
+ }
+
Environment.Exit(0);
}
diff --git a/.Source/GTweak/Assets/UserControl/Card.xaml.cs b/.Source/GTweak/Assets/UserControl/Card.xaml.cs
index 8aedb414..205244ca 100644
--- a/.Source/GTweak/Assets/UserControl/Card.xaml.cs
+++ b/.Source/GTweak/Assets/UserControl/Card.xaml.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@@ -26,7 +26,9 @@ namespace GTweak.Assets.UserControl
CardButtonSecondary.Visibility = Visibility.Visible;
}
else
+ {
CardButtonSecondary.Visibility = Visibility.Collapsed;
+ }
}
}
@@ -42,7 +44,9 @@ namespace GTweak.Assets.UserControl
private static void OnIconStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is Card card && card.CardIcon != null)
+ {
card.CardIcon.Style = e.NewValue as Style;
+ }
}
public Card()
diff --git a/.Source/GTweak/Assets/UserControl/DescriptionBlock.xaml.cs b/.Source/GTweak/Assets/UserControl/DescriptionBlock.xaml.cs
index e65d7520..ef1199c2 100644
--- a/.Source/GTweak/Assets/UserControl/DescriptionBlock.xaml.cs
+++ b/.Source/GTweak/Assets/UserControl/DescriptionBlock.xaml.cs
@@ -1,6 +1,6 @@
-using GTweak.Utilities.Animation;
using System;
using System.Windows;
+using GTweak.Utilities.Animation;
namespace GTweak.Assets.UserControl
{
diff --git a/.Source/GTweak/Assets/UserControl/FlowColumnPanel.cs b/.Source/GTweak/Assets/UserControl/FlowColumnPanel.cs
index 61dfa3eb..7507105c 100644
--- a/.Source/GTweak/Assets/UserControl/FlowColumnPanel.cs
+++ b/.Source/GTweak/Assets/UserControl/FlowColumnPanel.cs
@@ -1,10 +1,10 @@
-using GTweak.Utilities.Animation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
+using GTweak.Utilities.Animation;
namespace GTweak.Assets.UserControl
{
@@ -59,13 +59,17 @@ namespace GTweak.Assets.UserControl
.ToList();
if (visibleChildren.Count == 0)
+ {
return new Size(0, 0);
+ }
double availableWidth = double.IsInfinity(availableSize.Width) ? 1200 : availableSize.Width;
double availableHeight = double.IsInfinity(availableSize.Height) ? 800 : availableSize.Height;
foreach (UIElement child in visibleChildren)
+ {
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
+ }
double neededHeight = CalculateNeededHeight(availableWidth, double.PositiveInfinity, visibleChildren);
@@ -80,7 +84,9 @@ namespace GTweak.Assets.UserControl
.ToList();
if (visibleChildren.Count == 0)
+ {
return new Size(0, 0);
+ }
var columns = CreateOptimalColumns(finalSize.Width, finalSize.Height, visibleChildren);
ArrangeAligned(columns, finalSize.Width);
@@ -90,7 +96,10 @@ namespace GTweak.Assets.UserControl
private void ArrangeAligned(List<ColumnInfo> columns, double availableWidth)
{
- if (columns == null || columns.Count == 0) return;
+ if (columns == null || columns.Count == 0)
+ {
+ return;
+ }
double contentWidth = columns.Sum(c => c.Width) + Math.Max(0, columns.Count - 1) * HorizontalSpacing;
double extraSpace = Math.Max(0, availableWidth - contentWidth);
@@ -121,7 +130,9 @@ namespace GTweak.Assets.UserControl
foreach (var child in column.Elements)
{
if (child.Visibility == Visibility.Collapsed)
+ {
continue;
+ }
if (!(child.RenderTransform is TranslateTransform transform))
{
@@ -150,7 +161,10 @@ namespace GTweak.Assets.UserControl
private double CalculateMaxColumnHeight(List<ColumnInfo> columns)
{
- if (columns == null || columns.Count == 0) return 0;
+ if (columns == null || columns.Count == 0)
+ {
+ return 0;
+ }
return columns.Max(column =>
{
@@ -158,7 +172,9 @@ namespace GTweak.Assets.UserControl
foreach (var child in column.Elements)
{
if (child.Visibility == Visibility.Collapsed)
+ {
continue;
+ }
h += child.DesiredSize.Height + (h > 0 ? VerticalSpacing : 0);
}
@@ -169,7 +185,9 @@ namespace GTweak.Assets.UserControl
private List<ColumnInfo> CreateOptimalColumns(double availableWidth, double availableHeight, List<UIElement> visibleChildren)
{
if (visibleChildren == null || visibleChildren.Count == 0)
+ {
return new List<ColumnInfo>();
+ }
int maxPossibleColumns = Math.Max(1, (int)(availableWidth / 100));
@@ -177,7 +195,9 @@ namespace GTweak.Assets.UserControl
{
var columns = TryDistributeToColumns(columnCount, availableHeight, visibleChildren);
if (columns != null && CalculateTotalWidth(columns) <= availableWidth)
+ {
return columns;
+ }
}
return CreateSingleColumn(visibleChildren);
@@ -198,7 +218,9 @@ namespace GTweak.Assets.UserControl
double newHeight = heights[minIndex] + (heights[minIndex] > 0 ? VerticalSpacing : 0) + h;
if (newHeight > maxHeight)
+ {
return null;
+ }
columns[minIndex].Elements.Add(child);
columns[minIndex].Width = Math.Max(columns[minIndex].Width, child.DesiredSize.Width);
diff --git a/.Source/GTweak/Assets/UserControl/ToggleButton.xaml.cs b/.Source/GTweak/Assets/UserControl/ToggleButton.xaml.cs
index a01f07f0..5584f01d 100644
--- a/.Source/GTweak/Assets/UserControl/ToggleButton.xaml.cs
+++ b/.Source/GTweak/Assets/UserControl/ToggleButton.xaml.cs
@@ -1,4 +1,3 @@
-using GTweak.Utilities.Animation;
using System;
using System.Windows;
using System.Windows.Controls;
@@ -6,6 +5,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
+using GTweak.Utilities.Animation;
namespace GTweak.Assets.UserControl
{
@@ -103,22 +103,35 @@ namespace GTweak.Assets.UserControl
{
case DynamicResourceExtension dynamicResource:
if (target != null && textProperty != null)
+ {
target.SetResourceReference(textProperty, dynamicResource.ResourceKey);
+ }
else
+ {
SetResourceReference(dp, dynamicResource.ResourceKey);
+ }
+
break;
case StaticResourceExtension staticResource:
if (target != null && textProperty != null)
+ {
target.SetResourceReference(textProperty, staticResource.ResourceKey);
+ }
else
+ {
SetResourceReference(dp, staticResource.ResourceKey);
+ }
+
break;
default:
SetValue(dp, value);
if (target is TextBlock textBlock && value is string str)
+ {
textBlock.Text = str;
+ }
+
break;
}
}
@@ -151,9 +164,13 @@ namespace GTweak.Assets.UserControl
private void UpdateToggleState(bool isState, bool isSkipAnimation = false)
{
if (isState)
+ {
AnimateToggle(_rightPosition, brushOffColor, brushOnColor, borderOffColor, borderOnColor, (Color)Application.Current.Resources["Color_ToggleDot_On"], isSkipAnimation, "TextToggle");
+ }
else
+ {
AnimateToggle(_leftPosition, brushOnColor, brushOffColor, borderOnColor, borderOffColor, (Color)Application.Current.Resources["Color_ToggleDot_Off"], isSkipAnimation, "TextInactivity");
+ }
}
private void AnimateToggle(Thickness targetPosition, Brush fromBrush, Brush toBrush, Brush fromBorder, Brush toBorder, Color dotColor, bool skipAnimation, string textStyle)
diff --git a/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs b/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
index a3d72f47..005bd872 100644
--- a/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/ConfidentialityViewModel.cs
@@ -1,9 +1,9 @@
-using GTweak.Core.Base;
+using System.Collections.Generic;
+using System.Windows;
+using GTweak.Core.Base;
using GTweak.Core.Model;
using GTweak.Utilities.Configuration;
using GTweak.Utilities.Tweaks;
-using System.Collections.Generic;
-using System.Windows;
namespace GTweak.Core.ViewModel
{
diff --git a/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs b/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
index 29be71f5..fb591654 100644
--- a/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
@@ -1,11 +1,11 @@
-using GTweak.Core.Base;
-using GTweak.Core.Model;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Media;
+using GTweak.Core.Base;
+using GTweak.Core.Model;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
namespace GTweak.Core.ViewModel
{
diff --git a/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs b/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
index 390eb912..50edaaf7 100644
--- a/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/InterfaceViewModel.cs
@@ -1,10 +1,10 @@
-using GTweak.Core.Base;
+using System.Collections.Generic;
+using System.Windows;
+using GTweak.Core.Base;
using GTweak.Core.Model;
using GTweak.Utilities.Configuration;
using GTweak.Utilities.Maintenance;
using GTweak.Utilities.Tweaks;
-using System.Collections.Generic;
-using System.Windows;
namespace GTweak.Core.ViewModel
{
diff --git a/.Source/GTweak/Core/ViewModel/MainWinViewModel.cs b/.Source/GTweak/Core/ViewModel/MainWinViewModel.cs
index a2168a7c..061f4d95 100644
--- a/.Source/GTweak/Core/ViewModel/MainWinViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/MainWinViewModel.cs
@@ -1,8 +1,3 @@
-using GTweak.Core.Base;
-using GTweak.Core.Model;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.View;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -11,6 +6,11 @@ using System.Reflection;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
+using GTweak.Core.Base;
+using GTweak.Core.Model;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
+using GTweak.View;
namespace GTweak.Core.ViewModel
{
@@ -104,7 +104,9 @@ namespace GTweak.Core.ViewModel
NavigateToDataSystemCommand = new RelayCommand(NavigateToDataSystem);
if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
+ {
Application.Current.Dispatcher.BeginInvoke(new Action(() => { FillLanguages(); }));
+ }
}
private void FillLanguages()
@@ -113,7 +115,9 @@ namespace GTweak.Core.ViewModel
ResourceDictionary dictionary = new ResourceDictionary { Source = new Uri($"Languages/LanguageCatalog.xaml", UriKind.Relative) };
foreach (string code in SettingsEngine.AvailableLangs)
+ {
Languages.Add(new MainWinModel.LanguageItem { Code = code, Display = dictionary[$"{code.Replace("-", "_")}"] as string ?? code });
+ }
SelectedLanguage = SettingsEngine.AvailableLangs.Contains(SettingsEngine.Language) ? SettingsEngine.Language : SettingsEngine.AvailableLangs.FirstOrDefault();
}
diff --git a/.Source/GTweak/Core/ViewModel/PakagesViewModel.cs b/.Source/GTweak/Core/ViewModel/PakagesViewModel.cs
index 93ac5ba9..0baad48a 100644
--- a/.Source/GTweak/Core/ViewModel/PakagesViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/PakagesViewModel.cs
@@ -1,13 +1,13 @@
-using GTweak.Core.Base;
-using GTweak.Core.Model;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Tweaks;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Threading;
+using GTweak.Core.Base;
+using GTweak.Core.Model;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Tweaks;
namespace GTweak.Core.ViewModel
{
@@ -30,7 +30,9 @@ namespace GTweak.Core.ViewModel
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
foreach (PakagesModel item in DisplayState)
+ {
UpdatePackageState(item);
+ }
}), DispatcherPriority.ApplicationIdle);
};
@@ -65,9 +67,13 @@ namespace GTweak.Core.ViewModel
if (!item.Name.Equals("OneDrive", StringComparison.OrdinalIgnoreCase))
{
if (val.Scripts != null && val.Scripts.Any())
+ {
item.Installed = val.Scripts.Any(pattern => UninstallingPakages.InstalledPackagesCache.Any(pkg => Regex.IsMatch(pkg, $"^{Regex.Escape(pattern)}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)));
+ }
else
+ {
item.Installed = false;
+ }
}
else
{
diff --git a/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs b/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
index 88424086..9b3f2f8e 100644
--- a/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/ServicesViewModel.cs
@@ -1,7 +1,7 @@
-using GTweak.Core.Base;
+using System.Collections.Generic;
+using GTweak.Core.Base;
using GTweak.Core.Model;
using GTweak.Utilities.Tweaks;
-using System.Collections.Generic;
namespace GTweak.Core.ViewModel
{
diff --git a/.Source/GTweak/Core/ViewModel/SystemViewModel.cs b/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
index ad03d620..cfb332f7 100644
--- a/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/SystemViewModel.cs
@@ -1,9 +1,9 @@
-using GTweak.Core.Base;
+using System.Collections.Generic;
+using System.Windows;
+using GTweak.Core.Base;
using GTweak.Core.Model;
using GTweak.Utilities.Configuration;
using GTweak.Utilities.Tweaks;
-using System.Collections.Generic;
-using System.Windows;
namespace GTweak.Core.ViewModel
{
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index b487dc02..3c090e44 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -429,6 +429,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
+ <None Include=".editorconfig" />
<None Include="Resources\Blank.gz" />
<None Include="Resources\hosts.gz" />
<None Include="Resources\NSudoLC.gz" />
diff --git a/.Source/GTweak/Properties/AssemblyInfo.cs b/.Source/GTweak/Properties/AssemblyInfo.cs
index 0f9ec09c..44cbf710 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.cs
+++ b/.Source/GTweak/Properties/AssemblyInfo.cs
@@ -7,13 +7,13 @@ using System.Windows;
[assembly: AssemblyProduct("GTweak")]
[assembly: AssemblyCopyright("© 2024-2025 Greedeks")]
[assembly: AssemblyTrademark("Greedeks")]
-[assembly: AssemblyInformationalVersion("Build: 5.3.5")]
-[assembly: AssemblyVersion("5.3.43.433")]
-[assembly: AssemblyFileVersion("5.3.43.433")]
+[assembly: AssemblyInformationalVersion("Build: 5.3.6")]
+[assembly: AssemblyVersion("5.3.59.887")]
+[assembly: AssemblyFileVersion("5.3.59.887")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly
-)]
\ No newline at end of file
+)]
diff --git a/.Source/GTweak/Properties/AssemblyInfo.tt b/.Source/GTweak/Properties/AssemblyInfo.tt
index e833b33b..775575b7 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.tt
+++ b/.Source/GTweak/Properties/AssemblyInfo.tt
@@ -1,6 +1,4 @@
-<#@ template hostspecific="true" language="C#" #>
-<#@ output extension=".cs" #>
-using System.Reflection;
+<#@ template hostspecific="true" language="C#" #><#@ output extension=".cs" #>using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
@@ -10,8 +8,8 @@ using System.Windows;
[assembly: AssemblyCopyright("© 2024-<#= DateTime.Now.Year #> Greedeks")]
[assembly: AssemblyTrademark("Greedeks")]
[assembly: AssemblyInformationalVersion("<#= majorVersion #>")]
-[assembly: AssemblyVersion("5.<#= GenerateVersion() #>")]
-[assembly: AssemblyFileVersion("5.<#= GenerateVersion() #>")]
+[assembly: AssemblyVersion("<#= GenerateVersion() #>")]
+[assembly: AssemblyFileVersion("<#= GenerateVersion() #>")]
[assembly: ComVisible(false)]
@@ -20,13 +18,13 @@ using System.Windows;
ResourceDictionaryLocation.SourceAssembly
)]
<#+
- private const string majorVersion = "Build: 5.3.5";
-
- private string GenerateVersion()
- {
- string subversion = majorVersion.Replace("Build: ", "").Trim().Split('.') switch { { Length: > 1 } parts => parts[1], _ => "0" };
- int build = (int)(DateTime.UtcNow - new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day)).TotalSeconds / 1000;
- int revision = (int)(DateTime.UtcNow - DateTime.Now.Date).TotalSeconds % 1000;
- return $"{subversion}.{build}.{revision}";
- }
+ private const string majorVersion = "Build: 5.3.6";
+
+ private string GenerateVersion()
+ {
+ string[] parts = majorVersion.Replace("Build:", "").Trim().Split('.');
+ int build = (int)(DateTime.UtcNow - new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day)).TotalSeconds / 1000;
+ int revision = (int)(DateTime.UtcNow - DateTime.Now.Date).TotalSeconds % 1000;
+ return $"{parts[0]}.{parts[1]}.{build}.{revision}";
+ }
#>
\ No newline at end of file
diff --git a/.Source/GTweak/Properties/Resources.Designer.cs b/.Source/GTweak/Properties/Resources.Designer.cs
index 87811714..19192c6e 100644
--- a/.Source/GTweak/Properties/Resources.Designer.cs
+++ b/.Source/GTweak/Properties/Resources.Designer.cs
@@ -1,24 +1,6 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// Этот код создан программой.
-// Исполняемая версия:4.0.30319.42000
-//
-// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
-// повторной генерации кода.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace GTweak.Properties {
+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()]
@@ -32,9 +14,6 @@ namespace GTweak.Properties {
internal Resources() {
}
- /// <summary>
- /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
- /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
@@ -46,10 +25,6 @@ namespace GTweak.Properties {
}
}
- /// <summary>
- /// Перезаписывает свойство CurrentUICulture текущего потока для всех
- /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
- /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
@@ -60,9 +35,6 @@ namespace GTweak.Properties {
}
}
- /// <summary>
- /// Поиск локализованного ресурса типа System.Byte[].
- /// </summary>
internal static byte[] Blank {
get {
object obj = ResourceManager.GetObject("Blank", resourceCulture);
@@ -70,9 +42,6 @@ namespace GTweak.Properties {
}
}
- /// <summary>
- /// Поиск локализованного ресурса типа System.Byte[].
- /// </summary>
internal static byte[] hosts {
get {
object obj = ResourceManager.GetObject("hosts", resourceCulture);
@@ -80,9 +49,6 @@ namespace GTweak.Properties {
}
}
- /// <summary>
- /// Поиск локализованного ресурса типа System.Byte[].
- /// </summary>
internal static byte[] NSudoLC {
get {
object obj = ResourceManager.GetObject("NSudoLC", resourceCulture);
@@ -90,33 +56,18 @@ namespace GTweak.Properties {
}
}
- /// <summary>
- /// Поиск локализованного ресурса типа System.IO.UnmanagedMemoryStream, аналогичного System.IO.MemoryStream.
- /// </summary>
internal static System.IO.UnmanagedMemoryStream Sound {
get {
return ResourceManager.GetStream("Sound", resourceCulture);
}
}
- /// <summary>
- /// Ищет локализованную строку, похожую на &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
- ///&lt;Tickets&gt;
- /// &lt;Ticket&gt;
- /// &lt;product&gt;KMS&lt;/product&gt;
- /// &lt;content&gt;
- /// &lt;![CDATA[
- /// &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;genuineAuthorization xmlns=&quot;http://www.microsoft.com/DRM/SL/GenuineAuthorization/1.0&quot;&gt;&lt;version&gt;1.0&lt;/version&gt;&lt;genuineProperties origin=&quot;sppclient&quot;&gt;&lt;properties&gt;OA3xOriginalProductId=;OA3xOriginalProductKey=;SessionId=TwBTAE0AYQBqAG8AcgBWAGUAcgBzAGkAbwBuAD0ANQA7AE8AUwBNAGkAbgBvAHIAVgBlAHIAcwBpAG8AbgA9ADEAOwBPAFMAUABsAGEAdABmAG8AcgBtAEkAZAA9ADIAOwBQAFAAPQAw [остаток строки не уместился]&quot;;.
- /// </summary>
internal static string Tickets {
get {
return ResourceManager.GetString("Tickets", resourceCulture);
}
}
- /// <summary>
- /// Поиск локализованного ресурса типа System.Byte[].
- /// </summary>
internal static byte[] UltPower {
get {
object obj = ResourceManager.GetObject("UltPower", resourceCulture);
diff --git a/.Source/GTweak/Properties/Settings.Designer.cs b/.Source/GTweak/Properties/Settings.Designer.cs
index c2ac00eb..8a4bb621 100644
--- a/.Source/GTweak/Properties/Settings.Designer.cs
+++ b/.Source/GTweak/Properties/Settings.Designer.cs
@@ -1,28 +1,13 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// 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.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace GTweak.Properties
-{
-
-
+namespace GTweak.Properties {
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.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
- {
+
+ public static Settings Default {
+ get {
return defaultInstance;
}
}
diff --git a/.Source/GTweak/Utilities/Animation/BrushAnimation.cs b/.Source/GTweak/Utilities/Animation/BrushAnimation.cs
index ccd3484a..a750b6a1 100644
--- a/.Source/GTweak/Utilities/Animation/BrushAnimation.cs
+++ b/.Source/GTweak/Utilities/Animation/BrushAnimation.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
@@ -31,7 +31,10 @@ namespace GTweak.Utilities.Animation
public override object GetCurrentValue(object defaultOriginValue, object defaultDestinationValue, AnimationClock animationClock)
{
- if (animationClock.CurrentProgress == null) return From ?? defaultOriginValue;
+ if (animationClock.CurrentProgress == null)
+ {
+ return From ?? defaultOriginValue;
+ }
double progress = animationClock.CurrentProgress.Value;
diff --git a/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs b/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs
index 15d3fef6..851af044 100644
--- a/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs
+++ b/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Windows;
using System.Windows.Media.Animation;
@@ -18,7 +18,9 @@ namespace GTweak.Utilities.Animation
};
if (onCompleted != null)
+ {
doubleAnim.Completed += (s, e) => onCompleted();
+ }
Timeline.SetDesiredFrameRate(doubleAnim, 120);
return doubleAnim;
@@ -29,7 +31,9 @@ namespace GTweak.Utilities.Animation
DoubleAnimation doubleAnim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(seconds));
if (onCompleted != null)
+ {
doubleAnim.Completed += (s, e) => onCompleted();
+ }
Timeline.SetDesiredFrameRate(doubleAnim, 120);
return doubleAnim;
diff --git a/.Source/GTweak/Utilities/Animation/NumberAnimation.cs b/.Source/GTweak/Utilities/Animation/NumberAnimation.cs
index daaf1c14..83aa0be2 100644
--- a/.Source/GTweak/Utilities/Animation/NumberAnimation.cs
+++ b/.Source/GTweak/Utilities/Animation/NumberAnimation.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
@@ -46,7 +46,9 @@ namespace GTweak.Utilities.Animation
private static void OnAnimatedValueChanged(DependencyObject dObject, DependencyPropertyChangedEventArgs e)
{
if (dObject is TextBlock textBlock)
+ {
textBlock.Text = string.Format(" {0}", e.NewValue.ToString());
+ }
}
}
}
diff --git a/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs b/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs
index 18810a03..55f8e1fb 100644
--- a/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs
+++ b/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@@ -13,7 +13,9 @@ namespace GTweak.Utilities.Animation
internal static void Create(in string textToAnimate, in TextBlock textBlock, in TimeSpan timeSpan)
{
if (textBlock == null || string.IsNullOrEmpty(textToAnimate))
+ {
return;
+ }
Storyboard storyboard = new Storyboard { FillBehavior = FillBehavior.HoldEnd };
diff --git a/.Source/GTweak/Utilities/Configuration/MonitoringService.cs b/.Source/GTweak/Utilities/Configuration/MonitoringService.cs
index 32e0359d..a8554550 100644
--- a/.Source/GTweak/Utilities/Configuration/MonitoringService.cs
+++ b/.Source/GTweak/Utilities/Configuration/MonitoringService.cs
@@ -1,4 +1,3 @@
-using GTweak.Utilities.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -6,6 +5,7 @@ using System.Management;
using System.Runtime.InteropServices;
using System.ServiceProcess;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
namespace GTweak.Utilities.Configuration
{
@@ -68,16 +68,23 @@ namespace GTweak.Utilities.Configuration
if (!success)
{
- if (attempt == 2) break;
+ if (attempt == 2)
+ {
+ break;
+ }
if (bytesNeeded > capacity * sizeof(uint))
+ {
capacity = bytesNeeded / sizeof(uint) + 1;
+ }
continue;
}
if (bytesNeeded < capacity * sizeof(uint))
+ {
return (bytesNeeded / sizeof(uint)).ToString();
+ }
capacity = bytesNeeded / sizeof(uint) + 1;
}
@@ -97,7 +104,9 @@ namespace GTweak.Utilities.Configuration
{
svc.Refresh();
if (svc.Status == ServiceControllerStatus.Running)
+ {
running++;
+ }
}
catch (Exception ex) { ErrorLogging.LogDebug(ex); }
});
@@ -111,7 +120,9 @@ namespace GTweak.Utilities.Configuration
{
MemoryStatus memStatus = new MemoryStatus();
if (!GlobalMemoryStatusEx(memStatus))
+ {
Memory.Usage = 0;
+ }
int totalMemory = (int)(memStatus.ullTotalPhys / 1048576);
int availableMemory = (int)(memStatus.ullAvailPhys / 1048576);
@@ -129,7 +140,9 @@ namespace GTweak.Utilities.Configuration
static ulong ConvertTimeToTicks(SystemTime systemTime) => ((ulong)systemTime.dwHighDateTime << 32) | systemTime.dwLowDateTime;
if (!GetSystemTimes(out SystemTime idleTime, out SystemTime kernelTime, out SystemTime userTime))
+ {
return;
+ }
ulong idleTicks = ConvertTimeToTicks(idleTime);
ulong totalTicks = ConvertTimeToTicks(kernelTime) + ConvertTimeToTicks(userTime);
@@ -137,7 +150,9 @@ namespace GTweak.Utilities.Configuration
await Task.Delay(1000);
if (!GetSystemTimes(out idleTime, out kernelTime, out userTime))
+ {
return;
+ }
ulong newIdleTicks = ConvertTimeToTicks(idleTime);
ulong newTotalTicks = ConvertTimeToTicks(kernelTime) + ConvertTimeToTicks(userTime);
@@ -149,7 +164,13 @@ namespace GTweak.Utilities.Configuration
}).ConfigureAwait(false);
}
catch (Exception ex) { ErrorLogging.LogDebug(ex); }
- finally { if (!success) Processor.Usage = 1; }
+ finally
+ {
+ if (!success)
+ {
+ Processor.Usage = 1;
+ }
+ }
}
internal void StartDeviceMonitoring()
diff --git a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
index 59422563..5efd099c 100644
--- a/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
+++ b/.Source/GTweak/Utilities/Configuration/SystemDiagnostics.cs
@@ -1,8 +1,3 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using Microsoft.Win32;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -18,6 +13,11 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using Microsoft.Win32;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
namespace GTweak.Utilities.Configuration
{
@@ -66,7 +66,9 @@ namespace GTweak.Utilities.Configuration
string nameProfile = string.Empty;
foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", $"select FullName from Win32_UserAccount where domain='{Environment.UserDomainName}' and name='{Environment.UserName.ToLowerInvariant()}'", new EnumerationOptions { ReturnImmediately = true }).Get())
+ {
nameProfile = managementObj["FullName"] as string;
+ }
return !string.IsNullOrWhiteSpace(nameProfile) ? nameProfile : Environment.UserName.ToLowerInvariant();
}
@@ -214,7 +216,9 @@ namespace GTweak.Utilities.Configuration
foreach (string subKeyName in baseKey.GetSubKeyNames())
{
if (subKeyName == "Properties")
+ {
continue;
+ }
using RegistryKey regKey = baseKey.OpenSubKey(subKeyName);
if (regKey != null)
@@ -256,7 +260,9 @@ namespace GTweak.Utilities.Configuration
return (true, SizeCalculationHelper(memorySize), !string.IsNullOrEmpty(driverDesc) ? driverDesc : chipType);
}
else
+ {
return (false, string.Empty, string.Empty);
+ }
}
}
}
@@ -356,7 +362,9 @@ namespace GTweak.Utilities.Configuration
string storageType = GetStorageType(mediaType);
if (storageType == "(Unspecified)" && ((ushort)managementObj["BusType"]) == 7)
+ {
storageType = "(Media-Type)";
+ }
result.AppendLine($"{SizeCalculationHelper((ulong)managementObj["Size"])} [{data}] {storageType}");
}
@@ -371,7 +379,9 @@ namespace GTweak.Utilities.Configuration
string interfaceType = managementObj["InterfaceType"] as string ?? string.Empty;
if ((storageType == "(Unspecified)" || storageType == "(HDD)") && (string.IsNullOrEmpty(interfaceType) || interfaceType.IndexOf("USB", StringComparison.OrdinalIgnoreCase) >= 0))
+ {
storageType = "(Media-Type)";
+ }
result.AppendLine($"{SizeCalculationHelper((ulong)managementObj["Size"])} [{data}] {storageType}");
}
@@ -410,7 +420,9 @@ namespace GTweak.Utilities.Configuration
if (!string.IsNullOrEmpty(valueID) && valueID.IndexOf(deviceID, StringComparison.OrdinalIgnoreCase) >= 0 && ((!string.IsNullOrEmpty(value5) && value5.IndexOf("wdma_usb.inf", StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrEmpty(value8) && value8.IndexOf(@"USB\Class_01", StringComparison.OrdinalIgnoreCase) >= 0) ||
(!string.IsNullOrEmpty(value6) && value6.IndexOf("USBAudio.inf", StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrEmpty(value24) && value24.IndexOf("usb", StringComparison.OrdinalIgnoreCase) >= 0)))
+ {
return (true, RegistryHelp.GetValue(propsPath, "{b3f8fa53-0004-438e-9003-51a46e139bfc},6", string.Empty));
+ }
}
}
}
@@ -425,9 +437,13 @@ namespace GTweak.Utilities.Configuration
(bool isUsbDevice, string data) = IsUsbAudioDevice(managementObj["DeviceID"].ToString());
if (isUsbDevice && !string.IsNullOrEmpty(data))
+ {
result.AppendLine(data);
+ }
else
+ {
result.AppendLine(new[] { "Name", "Caption", "Description" }.Select(prop => managementObj[prop] as string).FirstOrDefault(info => !string.IsNullOrEmpty(info)) ?? string.Empty);
+ }
VendorDetection.Realtek |= managementObj["PNPDeviceID"]?.ToString().IndexOf("VEN_10EC", StringComparison.OrdinalIgnoreCase) >= 0;
}
@@ -441,15 +457,25 @@ namespace GTweak.Utilities.Configuration
double totalSize = Convert.ToDouble(sizeInBytes) / (1024.0 * 1024.0);
if (Convert.ToDouble(sizeInBytes) < 1024)
+ {
return $"{Convert.ToDouble(sizeInBytes):N0} B";
+ }
else if (totalSize < 1)
+ {
return $"{Math.Round(totalSize * 1024)} KB";
+ }
else if (totalSize < 1024)
+ {
return $"{Math.Round(totalSize)} MB";
+ }
else if (totalSize < 1024 * 1024)
+ {
return $"{Math.Round(totalSize / 1024.0)} GB";
+ }
else
+ {
return $"{Math.Round(totalSize / (1024.0 * 1024.0), 2):G} TB";
+ }
}
private string GetNetworkAdapters()
@@ -457,7 +483,10 @@ namespace GTweak.Utilities.Configuration
StringBuilder result = new StringBuilder();
foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "select Name, Description, ProductName, Manufacturer from Win32_NetworkAdapter where NetConnectionStatus=2 or NetConnectionStatus=7", new EnumerationOptions { ReturnImmediately = true }).Get())
+ {
result.AppendLine(new[] { "Name", "Description", "ProductName", "Manufacturer" }.Select(prop => managementObj[prop] as string).FirstOrDefault(info => !string.IsNullOrEmpty(info)) ?? string.Empty);
+ }
+
return result.ToString().TrimEnd('\n', '\r');
}
@@ -505,7 +534,9 @@ namespace GTweak.Utilities.Configuration
});
if (!task.Wait(timeout) || task.Result == null)
+ {
return false;
+ }
return true;
}
@@ -541,7 +572,9 @@ namespace GTweak.Utilities.Configuration
break;
}
else
+ {
hadBlock = true;
+ }
}
catch { hadLimited = true; }
}
@@ -549,15 +582,23 @@ namespace GTweak.Utilities.Configuration
if (CurrentConnection != ConnectionStatus.Available)
{
if (hadLimited)
+ {
CurrentConnection = ConnectionStatus.Limited;
+ }
else if (hadBlock)
+ {
CurrentConnection = ConnectionStatus.Block;
+ }
else
+ {
CurrentConnection = ConnectionStatus.Lose;
+ }
}
}
else
+ {
CurrentConnection = ConnectionStatus.Lose;
+ }
if (new Dictionary<ConnectionStatus, string>
{
@@ -572,7 +613,9 @@ namespace GTweak.Utilities.Configuration
internal void ValidateVersionUpdates()
{
if (!SettingsEngine.IsUpdateCheckRequired || !IsNetworkAvailable())
+ {
return;
+ }
try
{
diff --git a/.Source/GTweak/Utilities/Controls/ErrorLogging.cs b/.Source/GTweak/Utilities/Controls/ErrorLogging.cs
index 5be1bba0..9f4a1533 100644
--- a/.Source/GTweak/Utilities/Controls/ErrorLogging.cs
+++ b/.Source/GTweak/Utilities/Controls/ErrorLogging.cs
@@ -1,11 +1,11 @@
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Helpers;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Helpers;
namespace GTweak.Utilities.Controls
{
@@ -27,7 +27,9 @@ namespace GTweak.Utilities.Controls
string assocTxtFile = await CommandExecutor.GetCommandOutput("/c assoc .txt", false);
if (assocTxtFile.IndexOf("=", StringComparison.OrdinalIgnoreCase) >= 0)
+ {
CommandExecutor.RunCommand($"/c assoc .log={assocTxtFile.Split('=')[1].Trim()}");
+ }
}
}
catch (Exception fileEx) { LogDebug(fileEx); }
@@ -52,7 +54,9 @@ namespace GTweak.Utilities.Controls
await writer.WriteLineAsync($"Exception Level: {exLevel}");
if (exLevel == 1)
+ {
await writer.WriteLineAsync($"Member: {memberName}");
+ }
await writer.WriteLineAsync($"Type: {currentEx.GetType().FullName}");
await writer.WriteLineAsync($"Error: {currentEx.Message}");
diff --git a/.Source/GTweak/Utilities/Controls/RunGuard.cs b/.Source/GTweak/Utilities/Controls/RunGuard.cs
index 51c04ba1..5cd658b8 100644
--- a/.Source/GTweak/Utilities/Controls/RunGuard.cs
+++ b/.Source/GTweak/Utilities/Controls/RunGuard.cs
@@ -1,5 +1,3 @@
-using GTweak.Utilities.Configuration;
-using GTweak.Windows;
using System;
using System.Diagnostics;
using System.Linq;
@@ -7,6 +5,8 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
+using GTweak.Utilities.Configuration;
+using GTweak.Windows;
namespace GTweak.Utilities.Controls
{
@@ -25,9 +25,13 @@ namespace GTweak.Utilities.Controls
using (Mutex mutex = new Mutex(false, @"Global\" + "GTweak"))
{
if (mutex.WaitOne(150, false))
+ {
Application.Current.Dispatcher.Invoke(() => { new MessageWindow().ShowDialog(); });
+ }
else
+ {
Environment.Exit(0);
+ }
}
using (Process process = Process.GetProcesses().FirstOrDefault(p => p.ProcessName == Process.GetCurrentProcess().ProcessName))
{
@@ -47,7 +51,9 @@ namespace GTweak.Utilities.Controls
await Task.Run(() => new SystemDiagnostics().GetOperatingSystemInfo());
if ((HardwareData.OS.IsWin11 || HardwareData.OS.IsWin10) && HardwareData.OS.Build.CompareTo(18362.116m) >= 0)
+ {
return;
+ }
new MessageWindow(true).ShowDialog();
}
diff --git a/.Source/GTweak/Utilities/Controls/SettingsEngine.cs b/.Source/GTweak/Utilities/Controls/SettingsEngine.cs
index e8e4bf74..8c207945 100644
--- a/.Source/GTweak/Utilities/Controls/SettingsEngine.cs
+++ b/.Source/GTweak/Utilities/Controls/SettingsEngine.cs
@@ -1,9 +1,3 @@
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Windows;
-using Microsoft.Win32;
-using Ookii.Dialogs.Wpf;
using System;
using System.Collections.Generic;
using System.IO;
@@ -11,6 +5,12 @@ using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using GTweak.Windows;
+using Microsoft.Win32;
+using Ookii.Dialogs.Wpf;
namespace GTweak.Utilities.Controls
{
@@ -67,7 +67,9 @@ namespace GTweak.Utilities.Controls
foreach (var kv in _defaultSettings)
{
if (RegistryHelp.ValueExists(PathLocator.Registry.BaseKey, kv.Key))
+ {
ChangingParameters(kv.Key, kv.Value);
+ }
else
{
_cachedSettings[kv.Key] = kv.Value is bool defaultBool ? RegistryHelp.GetValue(PathLocator.Registry.BaseKey, kv.Key, defaultBool ? 1 : 0) is int asBool ? asBool != 0 : defaultBool :
@@ -77,7 +79,9 @@ namespace GTweak.Utilities.Controls
}
if (!AvailableThemes.Contains((string)_cachedSettings["Theme"], StringComparer.OrdinalIgnoreCase))
+ {
ChangingParameters("Theme", _defaultSettings["Theme"]);
+ }
App.Language = (string)_cachedSettings["Language"];
App.Theme = (string)_cachedSettings["Theme"];
@@ -86,7 +90,9 @@ namespace GTweak.Utilities.Controls
internal static void SaveFileConfig()
{
if (INIManager.IsAllTempDictionaryEmpty)
+ {
NotificationManager.Show("info", "export_warning_noty").Perform();
+ }
else
{
VistaSaveFileDialog vistaSaveFileDialog = new VistaSaveFileDialog
@@ -97,17 +103,23 @@ namespace GTweak.Utilities.Controls
};
if (vistaSaveFileDialog.ShowDialog() != true)
+ {
return;
+ }
try
{
PathLocator.Files.Config = vistaSaveFileDialog.FileName;
if (Path.GetExtension(PathLocator.Files.Config)?.ToLower() != ".ini")
+ {
PathLocator.Files.Config = Path.ChangeExtension(PathLocator.Files.Config, ".ini");
+ }
if (File.Exists(PathLocator.Files.Config))
+ {
File.Delete(PathLocator.Files.Config);
+ }
INIManager iniManager = new INIManager(PathLocator.Files.Config);
iniManager.Write("GTweak", "Author", "Greedeks");
@@ -130,7 +142,9 @@ namespace GTweak.Utilities.Controls
};
if (vistaOpenFileDialog.ShowDialog() == false)
+ {
return;
+ }
PathLocator.Files.Config = vistaOpenFileDialog.FileName;
INIManager iniManager = new INIManager(PathLocator.Files.Config);
@@ -138,12 +152,18 @@ namespace GTweak.Utilities.Controls
if (iniManager.GetKeysOrValue("GTweak", false).Contains("Greedeks") && iniManager.GetKeysOrValue("GTweak").Contains("FormatVersion") && iniManager.GetKeysOrValue("GTweak", false).Contains("2"))
{
if (File.ReadLines(PathLocator.Files.Config).Any(line => line.Contains("TglButton")) || File.ReadLines(PathLocator.Files.Config).Any(line => line.Contains("Slider")))
+ {
new ImportWindow(Path.GetFileName(vistaOpenFileDialog.FileName)).ShowDialog();
+ }
else
+ {
NotificationManager.Show("info", "empty_import_noty").Perform();
+ }
}
else
+ {
NotificationManager.Show("info", "warn_import_noty").Perform();
+ }
}
internal static void SelfRemoval()
diff --git a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs b/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
index b28f4737..69f3a9c8 100644
--- a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
+++ b/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
@@ -1,8 +1,8 @@
-using GTweak.Utilities.Controls;
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
namespace GTweak.Utilities.Helpers
{
@@ -37,7 +37,9 @@ namespace GTweak.Utilities.Helpers
await process.WaitForExitAsync().ConfigureAwait(false);
if (process.ExitCode == 0)
+ {
return string.Join(Environment.NewLine, output.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));
+ }
else
{
Debug.WriteLine($"{process.ExitCode}: {error}");
@@ -86,7 +88,9 @@ namespace GTweak.Utilities.Helpers
internal static Task WaitForExitAsync(this Process process)
{
if (process.HasExited)
+ {
return Task.CompletedTask;
+ }
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
process.EnableRaisingEvents = true;
diff --git a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs b/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs
index 57f2b1b7..9efed2a9 100644
--- a/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs
+++ b/.Source/GTweak/Utilities/Helpers/RegistryHelp.cs
@@ -1,8 +1,8 @@
-using GTweak.Utilities.Controls;
-using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
+using Microsoft.Win32;
namespace GTweak.Utilities.Helpers
{
@@ -25,12 +25,16 @@ namespace GTweak.Utilities.Helpers
Task.Run(delegate
{
if (registrykey.OpenSubKey(subkey) == null || registrykey.OpenSubKey(subkey)?.GetValue(value, null) == null)
+ {
return;
+ }
try
{
if (isTakingOwner)
+ {
GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", SE_OBJECT_TYPE.SE_REGISTRY_KEY);
+ }
registrykey.OpenSubKey(subkey, true)?.DeleteValue(value);
}
@@ -45,7 +49,9 @@ namespace GTweak.Utilities.Helpers
try
{
if (isTakingOwner)
+ {
GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", SE_OBJECT_TYPE.SE_REGISTRY_KEY);
+ }
registrykey.CreateSubKey(subkey, true)?.SetValue(name, data, kind);
}
@@ -69,7 +75,9 @@ namespace GTweak.Utilities.Helpers
try
{
if (isTakingOwner)
+ {
GrantAdministratorsAccess($"{GeneralRegistry(registrykey)}{subkey}", SE_OBJECT_TYPE.SE_REGISTRY_KEY);
+ }
RegistryKey registryFolder = registrykey.OpenSubKey(subkey, true);
@@ -109,7 +117,9 @@ namespace GTweak.Utilities.Helpers
internal static bool CheckValueBytes(in string subkey, in string valueName, in string expectedValue)
{
if (!(Registry.GetValue(subkey, valueName, null) is byte[]))
+ {
return true;
+ }
return string.Concat((byte[])Registry.GetValue(subkey, valueName, null) ?? Array.Empty<byte>()) != expectedValue;
}
@@ -125,11 +135,17 @@ namespace GTweak.Utilities.Helpers
try
{
using RegistryKey key = baseKey.OpenSubKey(subKeyPath);
- if (key == null) return new T();
+ if (key == null)
+ {
+ return new T();
+ }
T result = new T();
foreach (var name in key.GetSubKeyNames())
+ {
result.Add(name);
+ }
+
return result;
}
catch { return new T(); }
diff --git a/.Source/GTweak/Utilities/Maintenance/ClearingMemory.cs b/.Source/GTweak/Utilities/Maintenance/ClearingMemory.cs
index b623da78..cacc3c47 100644
--- a/.Source/GTweak/Utilities/Maintenance/ClearingMemory.cs
+++ b/.Source/GTweak/Utilities/Maintenance/ClearingMemory.cs
@@ -1,6 +1,3 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -10,6 +7,9 @@ using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
namespace GTweak.Utilities.Maintenance
{
@@ -169,12 +169,16 @@ namespace GTweak.Utilities.Maintenance
newst.Attr = SE_PRIVILEGE_ENABLED;
if (!LookupPrivilegeValue(null, privilegeName, ref newst.Luid))
+ {
throw new Exception("Error in LookupPrivilegeValue: ", new Win32Exception(Marshal.GetLastWin32Error()));
+ }
int num = AdjustTokenPrivileges(current.Token, false, ref newst, 0, IntPtr.Zero, IntPtr.Zero) ? 1 : 0;
if (num == 0)
+ {
throw new Exception("Error in AdjustTokenPrivileges: ", new Win32Exception(Marshal.GetLastWin32Error()));
+ }
return num != 0;
}
diff --git a/.Source/GTweak/Utilities/Maintenance/NTFSCompressor.cs b/.Source/GTweak/Utilities/Maintenance/NTFSCompressor.cs
index f23498e6..e42dc315 100644
--- a/.Source/GTweak/Utilities/Maintenance/NTFSCompressor.cs
+++ b/.Source/GTweak/Utilities/Maintenance/NTFSCompressor.cs
@@ -1,10 +1,10 @@
-using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.Win32.SafeHandles;
namespace GTweak.Utilities.Maintenance
{
diff --git a/.Source/GTweak/Utilities/Maintenance/RegistryExporter.cs b/.Source/GTweak/Utilities/Maintenance/RegistryExporter.cs
index 4d6fd5a8..e43174d0 100644
--- a/.Source/GTweak/Utilities/Maintenance/RegistryExporter.cs
+++ b/.Source/GTweak/Utilities/Maintenance/RegistryExporter.cs
@@ -1,10 +1,10 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Managers;
-using Microsoft.Win32;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Managers;
+using Microsoft.Win32;
namespace GTweak.Utilities.Maintenance
{
@@ -49,7 +49,9 @@ namespace GTweak.Utilities.Maintenance
{
int index = fullPath.IndexOf('\\');
if (index < 0)
+ {
return false;
+ }
string hive = fullPath.Substring(0, index);
string subKey = fullPath.Substring(index + 1);
@@ -65,7 +67,9 @@ namespace GTweak.Utilities.Maintenance
};
if (baseKey == null)
+ {
return false;
+ }
try
{
@@ -87,7 +91,9 @@ namespace GTweak.Utilities.Maintenance
foreach (var path in RegistryPaths)
{
if (!RegistryKeyExists(path))
+ {
continue;
+ }
string tempFile = Path.Combine(tempDir, Path.GetRandomFileName() + ".reg");
tempFiles.Add(tempFile);
@@ -103,15 +109,27 @@ namespace GTweak.Utilities.Maintenance
StringBuilder sb = new StringBuilder();
foreach (string file in tempFiles)
+ {
sb.AppendLine(File.ReadAllText(file, Encoding.Unicode));
+ }
+
File.WriteAllText(finalRegFile, sb.ToString(), Encoding.Unicode);
}
catch { NotificationManager.Show("warn", "error_reg_exporter_noty").Perform(); }
finally
{
foreach (string file in tempFiles)
- if (File.Exists(file)) File.Delete(file);
- if (Directory.Exists(tempDir)) Directory.Delete(tempDir);
+ {
+ if (File.Exists(file))
+ {
+ File.Delete(file);
+ }
+ }
+
+ if (Directory.Exists(tempDir))
+ {
+ Directory.Delete(tempDir);
+ }
NotificationManager.Show("info", "success_reg_exporter_noty").WithDelay(500).Perform();
}
diff --git a/.Source/GTweak/Utilities/Maintenance/SystemRestoreService.cs b/.Source/GTweak/Utilities/Maintenance/SystemRestoreService.cs
index 809c121d..e14204e6 100644
--- a/.Source/GTweak/Utilities/Maintenance/SystemRestoreService.cs
+++ b/.Source/GTweak/Utilities/Maintenance/SystemRestoreService.cs
@@ -1,12 +1,12 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using Microsoft.Win32;
using System;
using System.IO;
using System.Management;
using System.Runtime.InteropServices;
using System.Windows;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using Microsoft.Win32;
namespace GTweak.Utilities.Maintenance
{
@@ -28,12 +28,16 @@ namespace GTweak.Utilities.Maintenance
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "SystemRestorePointCreationFrequency", 0, RegistryValueKind.DWord);
if (!IsPointCreationAllowed)
+ {
EnableRestorePoint();
+ }
foreach (var managementObj in new ManagementObjectSearcher(@"\\localhost\root\default", "SELECT Description, SequenceNumber FROM SystemRestore", new EnumerationOptions { ReturnImmediately = true }).Get())
{
if (managementObj["Description"].ToString().IndexOf("GTweak", StringComparison.OrdinalIgnoreCase) >= 0)
+ {
SRRemoveRestorePoint(Convert.ToInt32(managementObj["SequenceNumber"]));
+ }
}
_inParams = _restorePoint.GetMethodParameters("CreateRestorePoint");
@@ -43,9 +47,13 @@ namespace GTweak.Utilities.Maintenance
_outParams = _restorePoint.InvokeMethod("CreateRestorePoint", _inParams, null);
if ((uint)_outParams["ReturnValue"] == 0)
+ {
NotificationManager.Show("info", "success_point_noty").WithDelay(300).Perform();
+ }
else
+ {
NotificationManager.Show("warn", "error_point_noty").WithDelay(300).Perform();
+ }
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "SystemRestorePointCreationFrequency");
}
@@ -57,7 +65,10 @@ namespace GTweak.Utilities.Maintenance
try
{
if (!IsPointCreationAllowed)
+ {
EnableRestorePoint();
+ }
+
CommandExecutor.RunCommand("/c rstrui.exe");
}
catch { NotificationManager.Show("warn", "error_recovery_noty").Perform(); }
@@ -72,7 +83,9 @@ namespace GTweak.Utilities.Maintenance
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients", "{09F7EDC5-294E-4180-AF6A-FB0E6A0E9513}");
foreach (var managementObj in new ManagementObjectSearcher(@"\\localhost\root\default", "SELECT SequenceNumber FROM SystemRestore", new EnumerationOptions { ReturnImmediately = true }).Get())
+ {
SRRemoveRestorePoint(Convert.ToInt32(managementObj["SequenceNumber"].ToString()));
+ }
DisableSR(PathLocator.Folders.SystemDrive + @"\\");
}
diff --git a/.Source/GTweak/Utilities/Maintenance/WindowsLicense.cs b/.Source/GTweak/Utilities/Maintenance/WindowsLicense.cs
index ddce924f..42fd2d1d 100644
--- a/.Source/GTweak/Utilities/Maintenance/WindowsLicense.cs
+++ b/.Source/GTweak/Utilities/Maintenance/WindowsLicense.cs
@@ -1,10 +1,3 @@
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Storage;
-using GTweak.Windows;
-using Microsoft.Win32;
using System;
using System.Globalization;
using System.IO;
@@ -13,6 +6,13 @@ using System.Management;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Linq;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using GTweak.Utilities.Storage;
+using GTweak.Windows;
+using Microsoft.Win32;
namespace GTweak.Utilities.Maintenance
{
@@ -25,7 +25,9 @@ namespace GTweak.Utilities.Maintenance
internal static void LicenseStatus()
{
foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f' and LicenseStatus = 1").Get())
+ {
IsWindowsActivated = (uint)managementObj["LicenseStatus"] == 1;
+ }
}
internal static async Task StartActivation()
@@ -47,7 +49,9 @@ namespace GTweak.Utilities.Maintenance
try
{
if (HardwareData.OS.IsWin10)
+ {
await CommandExecutor.InvokeRunCommand(@"/c assoc .vbs=VBSFile & ftype VBSFile=""%SystemRoot%\System32\WScript.exe"" ""%1"" %*""");
+ }
await CommandExecutor.InvokeRunCommand($"/c slmgr.vbs //b /ipk {keyWinHWID}");
diff --git a/.Source/GTweak/Utilities/Managers/ArchiveManager.cs b/.Source/GTweak/Utilities/Managers/ArchiveManager.cs
index f87d1a1e..3d6ab0af 100644
--- a/.Source/GTweak/Utilities/Managers/ArchiveManager.cs
+++ b/.Source/GTweak/Utilities/Managers/ArchiveManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.IO.Compression;
@@ -11,7 +11,9 @@ namespace GTweak.Utilities.Managers
string folderDir = path.Remove(path.LastIndexOf(@"\", StringComparison.OrdinalIgnoreCase));
if (!Directory.Exists(folderDir))
+ {
Directory.CreateDirectory(folderDir);
+ }
using MemoryStream fileOut = new MemoryStream(resource);
using GZipStream gzipStream = new GZipStream(fileOut, CompressionMode.Decompress);
diff --git a/.Source/GTweak/Utilities/Managers/ExplorerManager.cs b/.Source/GTweak/Utilities/Managers/ExplorerManager.cs
index 5d928114..db268214 100644
--- a/.Source/GTweak/Utilities/Managers/ExplorerManager.cs
+++ b/.Source/GTweak/Utilities/Managers/ExplorerManager.cs
@@ -1,9 +1,9 @@
-using GTweak.Utilities.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
namespace GTweak.Utilities.Managers
{
diff --git a/.Source/GTweak/Utilities/Managers/FirewallManager.cs b/.Source/GTweak/Utilities/Managers/FirewallManager.cs
index 13b3b101..cc3f4a90 100644
--- a/.Source/GTweak/Utilities/Managers/FirewallManager.cs
+++ b/.Source/GTweak/Utilities/Managers/FirewallManager.cs
@@ -1,9 +1,9 @@
-using GTweak.Utilities.Controls;
-using NetFwTypeLib;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
+using NetFwTypeLib;
namespace GTweak.Utilities.Managers
{
@@ -32,11 +32,15 @@ namespace GTweak.Utilities.Managers
foreach (INetFwRule rule in firewallPolicy.Rules)
{
if (rule.Name == nameRule)
+ {
rulesToRemove.Add(rule);
+ }
}
foreach (var rule in rulesToRemove)
+ {
firewallPolicy.Rules.Remove(rule.Name);
+ }
}
private static bool CheckRulesWindows(string nameRule)
@@ -46,7 +50,9 @@ namespace GTweak.Utilities.Managers
foreach (INetFwRule rule in firewallRuleCheck.Rules)
{
if (rule.Name == nameRule)
+ {
isCheck = false;
+ }
}
return isCheck;
}
@@ -77,7 +83,9 @@ namespace GTweak.Utilities.Managers
if (isDisabled)
{
if (CheckRulesWindows(nameRule))
+ {
firewallPolicy.Rules.Remove(nameRule);
+ }
INetFwRule firewallRule = (INetFwRule)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
firewallRule.ApplicationName = pathProgram;
@@ -91,7 +99,9 @@ namespace GTweak.Utilities.Managers
firewallPolicy.Rules.Add(firewallRule);
}
else
+ {
RemoveAllRulesByName(nameRule);
+ }
}
protected static void BlockSpyDomain(in bool isDisabled)
@@ -132,11 +142,16 @@ namespace GTweak.Utilities.Managers
if (isDisabled)
{
if (CheckRulesWindows(_nameRules["Domain"]))
+ {
firewallPolicy.Rules.Remove(_nameRules["Domain"]);
+ }
+
firewallPolicy.Rules.Add(firewallRule);
}
else
+ {
RemoveAllRulesByName(_nameRules["Domain"]);
+ }
}
protected static void BlockWDefender(bool isDisabled)
diff --git a/.Source/GTweak/Utilities/Managers/INIManager.cs b/.Source/GTweak/Utilities/Managers/INIManager.cs
index 955f8797..9b501be6 100644
--- a/.Source/GTweak/Utilities/Managers/INIManager.cs
+++ b/.Source/GTweak/Utilities/Managers/INIManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
@@ -46,16 +46,23 @@ namespace GTweak.Utilities.Managers
internal void WriteAll(string section, Dictionary<string, string> selectedDictionary)
{
- if (selectedDictionary.Count == 0) return;
+ if (selectedDictionary.Count == 0)
+ {
+ return;
+ }
foreach (KeyValuePair<string, string> addKeyValue in selectedDictionary)
+ {
WritePrivateProfileString(section, addKeyValue.Key, addKeyValue.Value, _pathToConfig);
+ }
}
internal static void TempWrite<T>(Dictionary<string, string> selectedDictionary, string tweak, T value)
{
if (selectedDictionary.ContainsKey(tweak))
+ {
selectedDictionary.Remove(tweak);
+ }
selectedDictionary.Add(tweak, value.ToString());
}
@@ -78,16 +85,22 @@ namespace GTweak.Utilities.Managers
string line = rawLine.Trim();
if (line.StartsWith("[") && line.EndsWith("]"))
+ {
inSection = line.Equals("[" + section + "]", StringComparison.OrdinalIgnoreCase);
+ }
else if (inSection && line.Contains("="))
{
int equalsIndex = line.IndexOf('=');
if (equalsIndex > 0)
{
if (isGetKey)
+ {
result.Add(line.Substring(0, equalsIndex));
+ }
else
+ {
result.Add(line.Substring(equalsIndex + 1));
+ }
}
}
}
diff --git a/.Source/GTweak/Utilities/Managers/NotificationManager.cs b/.Source/GTweak/Utilities/Managers/NotificationManager.cs
index bedb0406..35b50603 100644
--- a/.Source/GTweak/Utilities/Managers/NotificationManager.cs
+++ b/.Source/GTweak/Utilities/Managers/NotificationManager.cs
@@ -1,9 +1,9 @@
-using GTweak.Utilities.Controls;
-using GTweak.Windows;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
+using GTweak.Utilities.Controls;
+using GTweak.Windows;
namespace GTweak.Utilities.Managers
{
@@ -103,7 +103,9 @@ namespace GTweak.Utilities.Managers
await Task.Delay(_delayMs).ContinueWith(_ =>
{
if (window != null && !window.IsVisible)
+ {
window.Show();
+ }
}, TaskScheduler.FromCurrentSynchronizationContext());
});
}
diff --git a/.Source/GTweak/Utilities/Managers/OverlayDialogManager.cs b/.Source/GTweak/Utilities/Managers/OverlayDialogManager.cs
index 054abef0..0946394a 100644
--- a/.Source/GTweak/Utilities/Managers/OverlayDialogManager.cs
+++ b/.Source/GTweak/Utilities/Managers/OverlayDialogManager.cs
@@ -1,8 +1,8 @@
-using GTweak.Utilities.Animation;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
+using GTweak.Utilities.Animation;
namespace GTweak.Utilities.Managers
{
diff --git a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs b/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs
index be49b0ab..bd935595 100644
--- a/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs
+++ b/.Source/GTweak/Utilities/Managers/TaskSchedulerManager.cs
@@ -1,11 +1,11 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Storage;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Storage;
namespace GTweak.Utilities.Managers
{
@@ -79,7 +79,9 @@ namespace GTweak.Utilities.Managers
{
Microsoft.Win32.TaskScheduler.Task task = taskService.GetTask(taskname);
if (task != null)
+ {
taskService.RootFolder.DeleteTask(taskname);
+ }
}
}
});
@@ -91,9 +93,13 @@ namespace GTweak.Utilities.Managers
string matchPath = files.FirstOrDefault(path => Path.GetFileName(path).IndexOf(partialName, StringComparison.OrdinalIgnoreCase) >= 0);
if (!string.IsNullOrWhiteSpace(matchPath))
+ {
return Path.GetFileName(matchPath);
+ }
else
+ {
return partialName;
+ }
}
private static string[] GetExistingTasks(params string[] tasklist)
@@ -103,7 +109,9 @@ namespace GTweak.Utilities.Managers
foreach (string path in tasklist)
{
if (File.Exists(Path.Combine(PathLocator.Folders.Tasks, path.TrimStart('\\', '/').Replace('/', '\\'))))
+ {
foundExisting.Add(path);
+ }
}
return foundExisting.ToArray();
diff --git a/.Source/GTweak/Utilities/Managers/TimerControlManager.cs b/.Source/GTweak/Utilities/Managers/TimerControlManager.cs
index 57b22f3b..c88299ee 100644
--- a/.Source/GTweak/Utilities/Managers/TimerControlManager.cs
+++ b/.Source/GTweak/Utilities/Managers/TimerControlManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Windows;
using System.Windows.Threading;
@@ -39,7 +39,9 @@ namespace GTweak.Utilities.Managers
_time -= _timer.Interval;
}
else
+ {
_time += _timer.Interval;
+ }
}
internal void Start() => _timer.Start();
diff --git a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
index 8a2c397c..c44bdf33 100644
--- a/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ConfidentialityTweaks.cs
@@ -1,13 +1,13 @@
-using GTweak.Properties;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using GTweak.Properties;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks
{
@@ -142,9 +142,13 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Control\WMI\Autologger\Diagtrack-Listener", "Start", isDisabled ? 0 : 1, RegistryValueKind.DWord);
if (isDisabled)
+ {
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation", 1, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Attachments", "SaveZoneInformation");
+ }
SetTaskState(!isDisabled, telemetryTasks);
break;
@@ -153,9 +157,14 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton5":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory", 1, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\AppCompat", "DisableInventory");
+ }
+
break;
case "TglButton6":
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection", "AllowTelemetry", isDisabled ? 0 : 1, RegistryValueKind.DWord);
@@ -163,24 +172,39 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", isDisabled ? 0 : 1, RegistryValueKind.DWord);
if (isDisabled)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry", 0, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\DataCollection", "AllowDeviceNameInTelemetry");
+ }
+
break;
case "TglButton7":
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\HandwritingErrorReports", "PreventHandwritingErrorReports", isDisabled ? 1 : 0, RegistryValueKind.DWord);
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Input\TIPC", "Enabled", isDisabled ? 0 : 1, RegistryValueKind.DWord);
if (isDisabled)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing", 1, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\TabletPC", "PreventHandwritingDataSharing");
+ }
+
break;
case "TglButton8":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\SQMClient\Windows", "CEIPEnable", 0, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\SQMClient");
+ }
+
break;
case "TglButton9":
BlockSpyDomain(isDisabled);
@@ -192,7 +216,9 @@ namespace GTweak.Utilities.Tweaks
if (isDisabled)
{
if (File.Exists(backupFile))
+ {
File.Delete(backupFile);
+ }
File.Move(PathLocator.Files.Hosts, backupFile);
ArchiveManager.Unarchive(PathLocator.Files.Hosts, Resources.hosts);
@@ -202,9 +228,13 @@ namespace GTweak.Utilities.Tweaks
File.Copy(backupFile, PathLocator.Files.Hosts, true);
if (File.Exists(backupFile))
+ {
File.Delete(backupFile);
+ }
else
+ {
File.WriteAllText(PathLocator.Files.Hosts, string.Empty);
+ }
}
}
catch (Exception ex) { ErrorLogging.LogDebug(ex); }
@@ -240,18 +270,28 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton12":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate", 0, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Speech", "AllowSpeechModelUpdate");
+ }
+
break;
case "TglButton13":
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\CDPUserSvc", "Start", isDisabled ? 4 : 2, RegistryValueKind.DWord);
break;
case "TglButton14":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation", 0, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\PolicyManager\current\device\System", "AllowExperimentation");
+ }
+
break;
case "TglButton15":
(string diagTrack, string dmwappushservice, string diagsvc) =
diff --git a/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs b/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs
index 896d57df..99a362f9 100644
--- a/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs
+++ b/.Source/GTweak/Utilities/Tweaks/DefenderManager/BackupRights.cs
@@ -1,11 +1,11 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Managers;
-using Microsoft.Win32;
-using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.AccessControl;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Managers;
+using Microsoft.Win32;
+using Newtonsoft.Json;
namespace GTweak.Utilities.Tweaks.DefenderManager
{
@@ -65,11 +65,15 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
using RegistryKey key = baseKey.OpenSubKey(path, false);
if (key == null)
+ {
continue;
+ }
var values = new Dictionary<string, object>();
foreach (string valueName in key.GetValueNames())
+ {
values[valueName] = key.GetValue(valueName);
+ }
allValues[path] = values;
@@ -101,12 +105,16 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
using RegistryKey key = baseKey.OpenSubKey(path, true) ?? baseKey.CreateSubKey(path);
if (key == null)
+ {
continue;
+ }
if (allValues.ContainsKey(path))
{
foreach (var pair in allValues[path])
+ {
key.SetValue(pair.Key, pair.Value);
+ }
}
if (aclDataDict.ContainsKey(path))
diff --git a/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs b/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs
index 7783df0c..af1057cd 100644
--- a/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs
+++ b/.Source/GTweak/Utilities/Tweaks/DefenderManager/WindowsDefender.cs
@@ -1,12 +1,12 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks.DefenderManager
{
@@ -35,9 +35,13 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
internal static void SetProtectionState(bool isDisabled)
{
if (isDisabled)
+ {
Deactivate();
+ }
else
+ {
Activate();
+ }
}
private static void Activate()
@@ -57,7 +61,9 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
(Path.Combine(PathLocator.Folders.WindowsDefender, "BlockConfigSecurityPolicy.exe"), "ConfigSecurityPolicy.exe"),
(Path.Combine(PathLocator.Folders.WindowsDefenderX86, "BlockMpCmdRun.exe"), "MpCmdRun.exe"),
})
+ {
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c rename \"{filePath}\" {originalFileName}");
+ }
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\BlockAntimalware.exe\" ren \"%D\\BlockAntimalware.exe\" MsMpEng.exe");
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\BlockAntimalwareCore.exe\" ren \"%D\\BlockAntimalwareCore.exe\" MpDefenderCoreService.exe");
@@ -167,7 +173,9 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
RegistryHelp.Write(Registry.ClassesRoot, @"CLSID\{09A47860-11B0-4DA5-AFA5-26D86198A780}\InprocServer32", "ThreadingModel", "Apartment", RegistryValueKind.String);
foreach (var service in services)
+ {
CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Services\{service.Key} /v Start /t REG_DWORD /d {service.Value} /f");
+ }
CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Services\WinDefend /v AutorunsDisabled /t REG_DWORD /d 0 /f");
CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v DelayedAutoStart /t REG_DWORD /d 0 /f");
@@ -200,14 +208,18 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
(Path.Combine(PathLocator.Folders.WindowsDefender, "ConfigSecurityPolicy.exe"), "BlockConfigSecurityPolicy.exe"),
(Path.Combine(PathLocator.Folders.WindowsDefenderX86, "MpCmdRun.exe"), "BlockMpCmdRun.exe"),
})
+ {
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c rename \"{filePath}\" {newFileName}");
+ }
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\MsMpEng.exe\" ren \"%D\\MsMpEng.exe\" BlockAntimalware.exe");
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c for /d %D in (\"{Path.Combine(PathLocator.Folders.SystemDrive, @"ProgramData\Microsoft\Windows Defender\Platform\*")}\") do if exist \"%D\\MpDefenderCoreService.exe\" ren \"%D\\MpDefenderCoreService.exe\" BlockAntimalwareCore.exe");
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c rename \"{Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Defender Advanced Threat Protection")}\" BlockWindowsDefenderATP");
foreach (var service in services)
+ {
CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Services\{service.Key} /v Start /t REG_DWORD /d 4 /f");
+ }
CommandExecutor.RunCommandAsTrustedInstaller($@"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c reg add HKLM\SYSTEM\CurrentControlSet\Services\WinDefend /v AutorunsDisabled /t REG_DWORD /d 3 /f");
CommandExecutor.RunCommandAsTrustedInstaller($@"/c reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v DelayedAutoStart /t REG_DWORD /d 1 /f");
@@ -379,10 +391,14 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
try
{
if (!Directory.Exists(directory))
+ {
continue;
+ }
foreach (var filePath in Directory.EnumerateFiles(directory, "*", SearchOption.TopDirectoryOnly))
+ {
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c del /q \"{filePath}\"");
+ }
}
catch (Exception ex) { ErrorLogging.LogDebug(ex); }
}
@@ -391,7 +407,9 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
private static void ManageExclusions(bool isDisable)
{
foreach (string drive in DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Removable).Select(d => d.Name))
+ {
CommandExecutor.RunCommand($" {(isDisable ? "Add-MpPreference" : "Remove-MpPreference")} -ExclusionPath '{drive}'", true);
+ }
}
private static void KillProcess(params string[] nameList)
@@ -399,7 +417,9 @@ namespace GTweak.Utilities.Tweaks.DefenderManager
foreach (string processName in nameList)
{
foreach (Process process in Process.GetProcessesByName(processName))
+ {
CommandExecutor.RunCommandAsTrustedInstaller($"{PathLocator.Executable.NSudo} -U:T -P:E -ShowWindowMode:Hide -Wait cmd /c taskkill /pid {process.Id} /f");
+ }
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
index ac99ac42..484a052a 100644
--- a/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/InterfaceTweaks.cs
@@ -1,13 +1,13 @@
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks
{
@@ -235,7 +235,10 @@ namespace GTweak.Utilities.Tweaks
else
{
if (File.Exists(PathLocator.Files.BlankIcon))
+ {
File.Delete(PathLocator.Files.BlankIcon);
+ }
+
RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons");
}
});
@@ -244,15 +247,25 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton12":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "link", Encoding.Unicode.GetBytes("\0\0"), RegistryValueKind.Binary);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer", "link");
+ }
+
break;
case "TglButton13":
if (isDisabled)
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}");
+ }
else
+ {
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, RegistryValueKind.DWord);
+ }
+
break;
case "TglButton14":
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{645FF040-5081-101B-9F08-00AA002F954E}", isDisabled ? 1 : 0, RegistryValueKind.DWord);
@@ -281,9 +294,14 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton17":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32", "", "", RegistryValueKind.String);
+ }
else
+ {
RegistryHelp.DeleteFolderTree(Registry.CurrentUser, @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}");
+ }
+
break;
case "TglButton18":
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager", "SoftLandingEnabled", isDisabled ? 0 : 1, RegistryValueKind.DWord);
@@ -408,9 +426,14 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton25":
if (isDisabled)
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers");
+ }
else
+ {
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "PersistBrowsers", 1, RegistryValueKind.DWord);
+ }
+
break;
case "TglButton26":
@@ -428,9 +451,13 @@ namespace GTweak.Utilities.Tweaks
if (HardwareData.OS.IsWin10)
{
if (isDisabled)
+ {
RegistryHelp.Write(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter", 1, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Policies\Microsoft\Windows\Explorer", "DisableNotificationCenter");
+ }
}
else if (HardwareData.OS.IsWin11)
{
@@ -475,33 +502,51 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton29":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality", 100, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "JPEGImportQuality");
+ }
+
break;
case "TglButton30":
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "ShowInfoTip", isDisabled ? 0 : 1, RegistryValueKind.DWord);
break;
case "TglButton31":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", 1, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\Explorer");
+ }
+
break;
case "TglButton32":
if (isDisabled)
{
if (HardwareData.OS.IsWin11)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode", 1, RegistryValueKind.DWord);
+ }
else if (HardwareData.OS.IsWin10)
+ {
RegistryHelp.Write(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo", 1, RegistryValueKind.DWord);
+ }
}
else
{
if (HardwareData.OS.IsWin11)
+ {
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer", "HubMode");
+ }
else if (HardwareData.OS.IsWin10)
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "LaunchTo");
+ }
}
break;
case "TglButton33":
diff --git a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
index a53d778d..8838ffd7 100644
--- a/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/ServicesTweaks.cs
@@ -1,7 +1,3 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -10,6 +6,10 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks
{
@@ -222,9 +222,13 @@ namespace GTweak.Utilities.Tweaks
try
{
if (isDisabled)
+ {
CommandExecutor.RunCommandAsTrustedInstaller($"/c takeown /f \"{currentFilePath}\" & icacls \"{currentFilePath}\" /inheritance:r /remove S-1-5-32-544 S-1-5-11 S-1-5-32-545 S-1-5-18 & icacls \"{currentFilePath}\" /grant {Environment.UserName}:F & rename \"{currentFilePath}\" \"{targetFileName}\"");
+ }
else
+ {
CommandExecutor.RunCommandAsTrustedInstaller($"/c rename \"{currentFilePath}\" \"{targetFileName}\" & icacls \"{targetFilePath}\" /reset & takeown /f \"{targetFilePath}\" /a & icacls \"{targetFilePath}\" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464");
+ }
}
catch (Exception ex) { ErrorLogging.LogDebug(ex); }
}
@@ -246,7 +250,10 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\WindowsUpdate\AU", "ScheduledInstallDay", 0, RegistryValueKind.DWord);
}
else
+ {
RegistryHelp.DeleteFolderTree(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\WindowsUpdate");
+ }
+
break;
case "TglButton4":
string[] services = {"WalletService","VacSvc", "spectrum", "SharedRealitySvc","perceptionsimulation", "MixedRealityOpenXRSvc",
@@ -276,7 +283,9 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\McpManagementService", "Start", isDisabled ? 4 : 3, RegistryValueKind.DWord);
if (isDisabled)
+ {
CommandExecutor.RunCommandAsTrustedInstaller(@$"/c net stop spooler && del /F /Q %systemroot%\System32\spool\PRINTERS\*.*");
+ }
try
{
@@ -296,9 +305,13 @@ namespace GTweak.Utilities.Tweaks
if (shellKey.GetSubKeyNames().Any(k => k.Equals("print", StringComparison.OrdinalIgnoreCase)))
{
if (isDisabled)
+ {
RegistryHelp.Write(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\print", "ProgrammaticAccessOnly", string.Empty, RegistryValueKind.String);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\print", "ProgrammaticAccessOnly");
+ }
}
}
}
@@ -468,7 +481,9 @@ namespace GTweak.Utilities.Tweaks
CommandExecutor.RunCommandAsTrustedInstaller("/c net start bits & net start cryptSvc");
}
else
+ {
SetTaskStateOwner(true, winUpdatesTasks);
+ }
}
catch (Exception ex) { ErrorLogging.LogDebug(ex); }
});
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
index 7d872a5b..2ee5b6d3 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
@@ -1,10 +1,3 @@
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks.DefenderManager;
-using GTweak.Windows;
-using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -15,6 +8,13 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using GTweak.Utilities.Tweaks.DefenderManager;
+using GTweak.Windows;
+using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks
{
@@ -79,7 +79,9 @@ namespace GTweak.Utilities.Tweaks
foreach (var subKeyName in regKey.GetSubKeyNames())
{
if (subKeyName == "Properties")
+ {
continue;
+ }
using RegistryKey subKey = regKey.OpenSubKey(subKeyName);
if (subKey != null)
@@ -90,9 +92,13 @@ namespace GTweak.Utilities.Tweaks
if (powerSettingsKey != null)
{
if (!(powerSettingsKey.GetValue("ConservationIdleTime") is byte[] conservationIdleTime) || !(powerSettingsKey.GetValue("IdlePowerState") is byte[] idlePowerState) || !(powerSettingsKey.GetValue("PerformanceIdleTime") is byte[] performanceIdleTime))
+ {
_сontrolWriter.Button[7] = false;
+ }
else
+ {
_сontrolWriter.Button[7] = conservationIdleTime?[0].ToString() != "255" || idlePowerState?[0].ToString() != "0" || performanceIdleTime?[0].ToString() != "255";
+ }
}
}
}
@@ -257,7 +263,10 @@ namespace GTweak.Utilities.Tweaks
overlayWindow.Close();
}
else
+ {
WindowsDefender.SetProtectionState(isDisabled);
+ }
+
break;
case "TglButton4":
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", isDisabled ? 0 : 5, RegistryValueKind.DWord);
@@ -273,9 +282,14 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton6":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload", 2, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.LocalMachine, @"SOFTWARE\Policies\Microsoft\WindowsStore", "AutoDownload");
+ }
+
break;
case "TglButton7":
try
@@ -310,9 +324,14 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton10":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Desktop", "AutoEndTasks", "1", RegistryValueKind.String);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"Control Panel\Desktop", "AutoEndTasks");
+ }
+
break;
case "TglButton11":
if (isDisabled)
@@ -350,9 +369,14 @@ namespace GTweak.Utilities.Tweaks
break;
case "TglButton15":
if (isDisabled)
+ {
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec", 0, RegistryValueKind.DWord);
+ }
else
+ {
RegistryHelp.DeleteValue(Registry.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize", "Startupdelayinmsec");
+ }
+
break;
case "TglButton16":
if (isDisabled)
@@ -398,7 +422,10 @@ namespace GTweak.Utilities.Tweaks
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\mpssvc", "Start", isDisabled ? 4 : 2, RegistryValueKind.DWord);
CommandExecutor.RunCommand($"/c netsh advfirewall set allprofiles state {(isDisabled ? "off" : "on")}");
if (HardwareData.OS.Build.CompareTo(22621.521m) >= 0)
+ {
RegistryHelp.Write(Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wtd", "Start", isDisabled ? 4 : 2, RegistryValueKind.DWord);
+ }
+
break;
case "TglButton21":
RegistryHelp.Write(Registry.CurrentUser, @"Software\Microsoft\GameBar", "AutoGameModeEnabled", isDisabled ? 0 : 1, RegistryValueKind.DWord);
@@ -514,7 +541,9 @@ namespace GTweak.Utilities.Tweaks
break;
}
else
+ {
searchScheme = string.Empty;
+ }
}
if (string.IsNullOrEmpty(searchScheme))
diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
index 0f3b3991..e221ca6c 100644
--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
@@ -1,7 +1,3 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -9,6 +5,10 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using Microsoft.Win32;
namespace GTweak.Utilities.Tweaks
{
@@ -84,7 +84,9 @@ namespace GTweak.Utilities.Tweaks
if (PackagesDetails.TryGetValue(key, out var details))
{
if (isUnavailable.HasValue)
+ {
PackagesDetails[key] = (details.Alias, isUnavailable.Value, details.Scripts);
+ }
OnPackagesChanged();
return details.IsUnavailable;
@@ -138,10 +140,14 @@ namespace GTweak.Utilities.Tweaks
List<string> packageNamesToRemove = new List<string> { packageName };
if (!string.IsNullOrEmpty(Alias))
+ {
packageNamesToRemove.Add(Alias);
+ }
if (Scripts != null)
+ {
packageNamesToRemove.AddRange(Scripts);
+ }
List<string> psCommands = packageNamesToRemove.SelectMany(name => new[]
{
@@ -207,7 +213,9 @@ namespace GTweak.Utilities.Tweaks
if (shellKey != null)
{
if (shellKey.GetSubKeyNames().Any(k => k.Equals("3D Print", StringComparison.OrdinalIgnoreCase)))
+ {
RegistryHelp.DeleteFolderTree(Registry.ClassesRoot, $@"SystemFileAssociations\{subkey}\shell\3D Print");
+ }
}
}
}
@@ -222,7 +230,9 @@ namespace GTweak.Utilities.Tweaks
foreach (string processName in new string[] { "msedge", "pwahelper", "edgeupdate", "edgeupdatem", "msedgewebview2", "MicrosoftEdgeUpdate", "msedgewebviewhost", "msedgeuserbroker", "usocoreworker", "RuntimeBroker" })
{
foreach (Process process in Process.GetProcessesByName(processName))
+ {
CommandExecutor.RunCommandAsTrustedInstaller($"/c taskkill /pid {process.Id} /f");
+ }
}
RemoveTasks(edgeTasks);
@@ -279,7 +289,9 @@ namespace GTweak.Utilities.Tweaks
foreach (string folder in new[] { "Edge", "EdgeCore", "EdgeUpdate", "Temp", "EdgeWebView" })
{
if (!shouldRemoveWebView && (folder == "EdgeWebView" || folder == "EdgeCore" || folder == "EdgeUpdate"))
+ {
continue;
+ }
RemoveDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Microsoft", folder));
}
@@ -294,10 +306,14 @@ namespace GTweak.Utilities.Tweaks
if (!string.IsNullOrEmpty(path) && path.Equals("Edge"))
{
if (!shouldRemoveWebView && path.Contains("WebView"))
+ {
continue;
+ }
if (path.EndsWith(@"\AppxManifest.xml", StringComparison.OrdinalIgnoreCase))
+ {
path = path.Replace(@"\AppxManifest.xml", "").Trim();
+ }
RemoveDirectory(path);
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.cs
index ef6a66eb..b75e5e5b 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs
+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs
@@ -1,10 +1,10 @@
-using GTweak.Assets.UserControl;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using GTweak.Assets.UserControl;
+using GTweak.Utilities.Managers;
+using GTweak.Utilities.Tweaks;
namespace GTweak.View
{
@@ -22,13 +22,17 @@ namespace GTweak.View
string description = ((ToggleButton)sender).Description?.ToString() ?? string.Empty;
if (DescBlock.Text != description)
+ {
DescBlock.Text = description;
+ }
}
private void Tweak_MouseLeave(object sender, MouseEventArgs e)
{
if (DescBlock.Text != DescBlock.DefaultText)
+ {
DescBlock.Text = DescBlock.DefaultText;
+ }
}
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
@@ -38,7 +42,9 @@ namespace GTweak.View
_confTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
if (NotificationManager.ConfActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction action))
+ {
NotificationManager.Show().WithDelay(300).Perform(action);
+ }
Parallel.Invoke(async delegate { await Task.Delay(1000); _confTweaks.AnalyzeAndUpdate(); });
}
diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.cs
index 863717d9..64f4d974 100644
--- a/.Source/GTweak/View/DataSystemView.xaml.cs
+++ b/.Source/GTweak/View/DataSystemView.xaml.cs
@@ -1,9 +1,3 @@
-using GTweak.Core.ViewModel;
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -14,6 +8,12 @@ using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Effects;
+using GTweak.Core.ViewModel;
+using GTweak.Utilities.Animation;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
namespace GTweak.View
{
@@ -79,7 +79,9 @@ namespace GTweak.View
_ = Dispatcher.BeginInvoke(new Action(() =>
{
if (BtnVision.IsChecked.Value & BtnVision.Visibility == Visibility.Hidden & !SystemDiagnostics.isIPAddressFormatValid)
+ {
IpAddress.Effect.BeginAnimation(BlurEffect.RadiusProperty, FactoryAnimation.CreateTo(0.18, () => { SettingsEngine.IsHiddenIpAddress = false; }));
+ }
}));
});
}
@@ -143,7 +145,9 @@ namespace GTweak.View
}
if (!PopupCopy.IsOpen)
+ {
AnimationPopup();
+ }
}
}
diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.cs
index c257d79b..3f711ed9 100644
--- a/.Source/GTweak/View/InterfaceView.xaml.cs
+++ b/.Source/GTweak/View/InterfaceView.xaml.cs
@@ -1,12 +1,12 @@
-using GTweak.Assets.UserControl;
-using GTweak.Utilities.Maintenance;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using GTweak.Assets.UserControl;
+using GTweak.Utilities.Maintenance;
+using GTweak.Utilities.Managers;
+using GTweak.Utilities.Tweaks;
namespace GTweak.View
{
@@ -19,7 +19,9 @@ namespace GTweak.View
InitializeComponent();
if (!WindowsLicense.IsWindowsActivated)
+ {
NotificationManager.Show("info", "warn_activate_noty").Perform();
+ }
}
@@ -28,13 +30,17 @@ namespace GTweak.View
string description = ((ToggleButton)sender).Description?.ToString() ?? string.Empty;
if (DescBlock.Text != description)
+ {
DescBlock.Text = description;
+ }
}
private void Tweak_MouseLeave(object sender, MouseEventArgs e)
{
if (DescBlock.Text != DescBlock.DefaultText)
+ {
DescBlock.Text = DescBlock.DefaultText;
+ }
}
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
@@ -44,10 +50,14 @@ namespace GTweak.View
_intfTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
if (ExplorerManager.IntfMapping.TryGetValue(toggleButton.Name, out bool needRestart))
+ {
ExplorerManager.Restart(new Process());
+ }
if (NotificationManager.IntfActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction action))
+ {
NotificationManager.Show().WithDelay(300).Perform(action);
+ }
Parallel.Invoke(async delegate { await Task.Delay(1000); _intfTweaks.AnalyzeAndUpdate(); });
}
diff --git a/.Source/GTweak/View/PakagesView.xaml.cs b/.Source/GTweak/View/PakagesView.xaml.cs
index 8e595881..d0e8ed64 100644
--- a/.Source/GTweak/View/PakagesView.xaml.cs
+++ b/.Source/GTweak/View/PakagesView.xaml.cs
@@ -1,7 +1,3 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
using System;
using System.ComponentModel;
using System.Diagnostics;
@@ -10,6 +6,10 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Threading;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using GTweak.Utilities.Tweaks;
namespace GTweak.View
{
@@ -44,14 +44,17 @@ namespace GTweak.View
string description = ((ToggleButton)sender).ToolTip?.ToString() ?? string.Empty;
if (DescBlock.Text != description)
+ {
DescBlock.Text = description;
-
+ }
}
private void Package_MouseLeave(object sender, MouseEventArgs e)
{
if (DescBlock.Text != DescBlock.DefaultText)
+ {
DescBlock.Text = DescBlock.DefaultText;
+ }
}
private async void ToggleButton_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
@@ -62,7 +65,9 @@ namespace GTweak.View
if (toggleButton.IsChecked == false && packageName == "OneDrive")
{
if (string.IsNullOrWhiteSpace(PathLocator.Executable.OneDrive))
+ {
NotificationManager.Show("warn", "error_onedrive_noty").Perform();
+ }
else
{
NotificationManager.Show("info", "success_onedrive_noty").Perform();
@@ -105,7 +110,9 @@ namespace GTweak.View
await Dispatcher.BeginInvoke(new Action(() =>
{
if (ExplorerManager.PackageMapping.TryGetValue(packageName, out bool needRestart))
+ {
ExplorerManager.Restart(new Process());
+ }
}), DispatcherPriority.ApplicationIdle);
});
}
diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.cs
index bebeb6cd..895344c7 100644
--- a/.Source/GTweak/View/ServicesView.xaml.cs
+++ b/.Source/GTweak/View/ServicesView.xaml.cs
@@ -1,10 +1,10 @@
-using GTweak.Assets.UserControl;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using GTweak.Assets.UserControl;
+using GTweak.Utilities.Managers;
+using GTweak.Utilities.Tweaks;
namespace GTweak.View
{
@@ -22,13 +22,17 @@ namespace GTweak.View
string description = ((ToggleButton)sender).Description?.ToString() ?? string.Empty;
if (DescBlock.Text != description)
+ {
DescBlock.Text = description;
+ }
}
private void Tweak_MouseLeave(object sender, MouseEventArgs e)
{
if (DescBlock.Text != DescBlock.DefaultText)
+ {
DescBlock.Text = DescBlock.DefaultText;
+ }
}
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 98022377..49735e9d 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -1,10 +1,10 @@
-using GTweak.Assets.UserControl;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using GTweak.Assets.UserControl;
+using GTweak.Utilities.Managers;
+using GTweak.Utilities.Tweaks;
namespace GTweak.View
{
@@ -33,13 +33,17 @@ namespace GTweak.View
}
if (DescBlock.Text != description)
+ {
DescBlock.Text = description;
+ }
}
private void Tweak_MouseLeave(object sender, MouseEventArgs e)
{
if (DescBlock.Text != DescBlock.DefaultText)
+ {
DescBlock.Text = DescBlock.DefaultText;
+ }
}
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) => _sysTweaks.ApplyTweaksSlider(((Slider)sender).Name, (uint)((Slider)sender).Value);
@@ -52,12 +56,16 @@ namespace GTweak.View
_sysTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
if (NotificationManager.SysActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction action))
+ {
NotificationManager.Show().WithDelay(300).Perform(action);
+ }
Parallel.Invoke(async delegate { await Task.Delay(1000); _sysTweaks.AnalyzeAndUpdate(); });
}
else
+ {
_sysTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
+ }
}
}
}
diff --git a/.Source/GTweak/View/UtilsView.xaml.cs b/.Source/GTweak/View/UtilsView.xaml.cs
index 3aee533c..895ecc74 100644
--- a/.Source/GTweak/View/UtilsView.xaml.cs
+++ b/.Source/GTweak/View/UtilsView.xaml.cs
@@ -1,13 +1,13 @@
-using GTweak.Utilities.Configuration;
+using System;
+using System.IO;
+using System.Windows.Controls;
+using GTweak.Utilities.Configuration;
using GTweak.Utilities.Controls;
using GTweak.Utilities.Helpers;
using GTweak.Utilities.Maintenance;
using GTweak.Utilities.Managers;
using GTweak.Windows;
using Ookii.Dialogs.Wpf;
-using System;
-using System.IO;
-using System.Windows.Controls;
namespace GTweak.View
{
@@ -27,13 +27,19 @@ namespace GTweak.View
private async void BtnLicenseWindows_ClickButton(object sender, EventArgs e)
{
if (WindowsLicense.IsWindowsActivated)
+ {
NotificationManager.Show("info", "ready_activate_noty").Perform();
+ }
else
{
if (new SystemDiagnostics().IsNetworkAvailable())
+ {
await WindowsLicense.StartActivation();
+ }
else
+ {
NotificationManager.Show("warn", "network_activate_noty").Perform();
+ }
}
}
@@ -61,7 +67,9 @@ namespace GTweak.View
await backgroundQueue.QueueTask(delegate { NotificationManager.Show("info", "disable_recovery_noty").WithDelay(300).Perform(); });
}
else
+ {
NotificationManager.Show("info", "warn_recovery_noty").Perform();
+ }
}
private async void BtnEnablePoint_ClickButton(object sender, EventArgs e)
@@ -76,7 +84,9 @@ namespace GTweak.View
await backgroundQueue.QueueTask(delegate { NotificationManager.Show("info", "enable_recovery_noty").WithDelay(300).Perform(); });
}
else
+ {
NotificationManager.Show("info", "warn_point_enabled_noty").Perform();
+ }
}
private async void BtnCompression_ClickButton(object sender, EventArgs e)
@@ -84,7 +94,9 @@ namespace GTweak.View
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();
if (folderDialog.ShowDialog() == false)
+ {
return;
+ }
string selectedPath = folderDialog.SelectedPath;
if (await _ntfsCompressor.IsSupportNtfs(selectedPath))
@@ -100,10 +112,14 @@ namespace GTweak.View
await backgroundQueue.QueueTask(delegate { NotificationManager.Show("info", "success_compression_noty").WithDelay(500).Perform(); });
}
else
+ {
NotificationManager.Show("info", "ready_compression_noty").Perform();
+ }
}
else
+ {
NotificationManager.Show("warn", "notsupport_ntfs_noty").Perform();
+ }
}
private async void BtnDecompression_ClickButton(object sender, EventArgs e)
@@ -111,7 +127,9 @@ namespace GTweak.View
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();
if (folderDialog.ShowDialog() == false)
+ {
return;
+ }
string selectedPath = folderDialog.SelectedPath;
if (await _ntfsCompressor.IsSupportNtfs(selectedPath))
@@ -128,10 +146,14 @@ namespace GTweak.View
await backgroundQueue.QueueTask(delegate { NotificationManager.Show("info", "success_decompression_noty").WithDelay(500).Perform(); });
}
else
+ {
NotificationManager.Show("info", "ready_decompression_noty").Perform();
+ }
}
else
+ {
NotificationManager.Show("warn", "notsupport_ntfs_noty").Perform();
+ }
}
private async void BtnClear_ClickButton(object sender, EventArgs e)
@@ -159,7 +181,9 @@ namespace GTweak.View
};
if (vistaSaveFileDialog.ShowDialog() != true)
+ {
return;
+ }
OverlayWindow overlayWindow = new OverlayWindow();
overlayWindow.Show();
diff --git a/.Source/GTweak/Windows/ImportWindow.xaml.cs b/.Source/GTweak/Windows/ImportWindow.xaml.cs
index e2db2fbc..c3dac138 100644
--- a/.Source/GTweak/Windows/ImportWindow.xaml.cs
+++ b/.Source/GTweak/Windows/ImportWindow.xaml.cs
@@ -1,7 +1,3 @@
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
-using GTweak.Utilities.Tweaks;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -9,6 +5,10 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
+using GTweak.Utilities.Tweaks;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -32,7 +32,9 @@ namespace GTweak.Windows
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
+ {
DragMove();
+ }
}
private async void Window_ContentRendered(object sender, EventArgs e)
@@ -46,10 +48,14 @@ namespace GTweak.Windows
if (valueProgress == 100)
{
if (_isExpRestartNeed)
+ {
ExplorerManager.Restart(new Process());
+ }
if (_requiredActions.Count != 0)
+ {
NotificationManager.Show().Perform(_requiredActions.Max());
+ }
App.UpdateImport();
Close();
@@ -80,7 +86,10 @@ namespace GTweak.Windows
int totalTweaks = allTweaks.Count;
int appliedTweaks = 0;
- if (totalTweaks == 0) progress.Report(100);
+ if (totalTweaks == 0)
+ {
+ progress.Report(100);
+ }
foreach (var (section, tweak, value) in allTweaks)
{
@@ -90,17 +99,23 @@ namespace GTweak.Windows
if (section == INIManager.SectionSys)
{
if (tweak.StartsWith("TglButton") && tweak != "TglButton3")
+ {
_sysTweaks.ApplyTweaks(tweak, Convert.ToBoolean(value));
+ }
else if (tweak == "TglButton8")
{
BackgroundQueue backgroundQueue = new BackgroundQueue();
await backgroundQueue.QueueTask(delegate { _sysTweaks.ApplyTweaks(tweak, Convert.ToBoolean(value), false); });
}
else
+ {
_sysTweaks.ApplyTweaksSlider(tweak, Convert.ToUInt32(value));
+ }
foreach (var act in NotificationManager.SysActions.Where(get => get.Key == tweak))
+ {
_requiredActions.Add(act.Value);
+ }
}
else
{
@@ -111,14 +126,20 @@ namespace GTweak.Windows
if (NoticeActions != null)
{
foreach (var act in NoticeActions.Where(get => get.Key == tweak))
+ {
_requiredActions.Add(act.Value);
+ }
}
if (ExplorerMapping != null && ExplorerMapping.Any(get => get.Key == tweak && get.Value == true))
+ {
_isExpRestartNeed = true;
+ }
if (section == INIManager.SectionSvc)
+ {
_requiredActions.Add(NotificationManager.NoticeAction.Restart);
+ }
}
}
catch (Exception ex) { ErrorLogging.LogDebug(ex); }
diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
index 152ccd78..7d190f40 100644
--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs
+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
@@ -1,13 +1,13 @@
-using GTweak.Utilities.Animation;
+using System;
+using System.ComponentModel;
+using System.Threading;
+using System.Threading.Tasks;
+using GTweak.Utilities.Animation;
using GTweak.Utilities.Configuration;
using GTweak.Utilities.Controls;
using GTweak.Utilities.Helpers;
using GTweak.Utilities.Maintenance;
using GTweak.Utilities.Tweaks;
-using System;
-using System.ComponentModel;
-using System.Threading;
-using System.Threading.Tasks;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -76,7 +76,9 @@ namespace GTweak.Windows
{
int index = Array.IndexOf(new[] { 0, 10, 30, 55, 75, 95 }, e.ProgressPercentage);
if (index > 0)
+ {
TypewriterAnimation.Create((string)FindResource($"step{++index}_load"), StatusLoading, TimeSpan.FromMilliseconds(200));
+ }
}
}
}
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index ca4c39f7..5a9aa73c 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -1,6 +1,3 @@
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
@@ -8,6 +5,9 @@ using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
+using GTweak.Utilities.Animation;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -36,7 +36,9 @@ namespace GTweak.Windows
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
+ {
DragMove();
+ }
}
private void TitleBar_PreviewMouseDown(object sender, MouseButtonEventArgs e)
@@ -49,7 +51,10 @@ namespace GTweak.Windows
while (current != null)
{
if (current is ButtonBase)
+ {
return;
+ }
+
current = VisualTreeHelper.GetParent(current);
}
}
diff --git a/.Source/GTweak/Windows/MessageWindow.xaml.cs b/.Source/GTweak/Windows/MessageWindow.xaml.cs
index 3e97f9e4..8b3ca781 100644
--- a/.Source/GTweak/Windows/MessageWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MessageWindow.xaml.cs
@@ -1,8 +1,8 @@
-using GTweak.Utilities.Managers;
using System;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Input;
+using GTweak.Utilities.Managers;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -34,13 +34,17 @@ namespace GTweak.Windows
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
+ {
DragMove();
+ }
}
private void BtnAccept_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
+ {
Application.Current.Shutdown();
+ }
}
}
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml.cs b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
index 6240cf29..93c936da 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml.cs
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
@@ -1,7 +1,3 @@
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
using System;
using System.Media;
using System.Windows;
@@ -9,6 +5,10 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media.Animation;
+using GTweak.Utilities.Animation;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
using Wpf.Ui.Controls;
namespace GTweak.Windows
diff --git a/.Source/GTweak/Windows/OverlayWindow.xaml.cs b/.Source/GTweak/Windows/OverlayWindow.xaml.cs
index 030aec9d..684b37e4 100644
--- a/.Source/GTweak/Windows/OverlayWindow.xaml.cs
+++ b/.Source/GTweak/Windows/OverlayWindow.xaml.cs
@@ -1,8 +1,8 @@
-using GTweak.Utilities.Animation;
-using GTweak.Utilities.Helpers;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
+using GTweak.Utilities.Animation;
+using GTweak.Utilities.Helpers;
namespace GTweak.Windows
{
diff --git a/.Source/GTweak/Windows/UpdateWindow.xaml.cs b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
index 7c03d682..1dbbc6ea 100644
--- a/.Source/GTweak/Windows/UpdateWindow.xaml.cs
+++ b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
@@ -1,11 +1,11 @@
-using GTweak.Utilities.Configuration;
-using GTweak.Utilities.Controls;
-using GTweak.Utilities.Helpers;
-using GTweak.Utilities.Managers;
using System;
using System.Net;
using System.Windows;
using System.Windows.Input;
+using GTweak.Utilities.Configuration;
+using GTweak.Utilities.Controls;
+using GTweak.Utilities.Helpers;
+using GTweak.Utilities.Managers;
using Wpf.Ui.Controls;
namespace GTweak.Windows
@@ -23,7 +23,9 @@ namespace GTweak.Windows
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
+ {
DragMove();
+ }
}
private void Window_Loaded(object sender, RoutedEventArgs e)