Skip to content

Commit cf0887f

Browse files
committed
v1.4 Minor Fixex
Some Windows Services were protected and the programme was failing, these have been removed. Chinese and Ukrainian language added Note : When you move the mouse cursor over each feature, a bubble message describing that feature will appear.
1 parent ca65bfb commit cf0887f

28 files changed

+2529
-1727
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

.vs/ShadesTweaker/v17/.suo

7.5 KB
Binary file not shown.

ShadesTweaker/MainWindow.xaml

Lines changed: 138 additions & 143 deletions
Large diffs are not rendered by default.

ShadesTweaker/MainWindow.xaml.cs

Lines changed: 102 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ namespace ShadesTweaker
1818
{
1919
public partial class MainWindow : UiWindow
2020
{
21+
private const string ConfigFileName = "config.xml";
22+
private string configFilePath;
2123
public MainWindow()
2224
{
2325
InitializeComponent();
26+
configFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigFileName);
27+
28+
29+
LoadLanguagePreference();
2430
Loaded += (sender, args) =>
2531
{
2632
if (IsWindows11OrHigher())
@@ -33,7 +39,50 @@ public MainWindow()
3339
}
3440
};
3541
}
42+
private void LoadLanguagePreference()
43+
{
44+
if (File.Exists(configFilePath))
45+
{
46+
XDocument doc = XDocument.Load(configFilePath);
47+
XElement languageIndexElement = doc.Element("Config")?.Element("LanguageIndex");
48+
if (int.TryParse(languageIndexElement?.Value, out int languageIndex))
49+
{
50+
comboBoxLanguage.SelectedIndex = languageIndex;
51+
ApplyLanguage(languageIndex);
52+
}
53+
}
54+
}
3655

56+
private void SaveLanguagePreference(int languageIndex)
57+
{
58+
if (!string.IsNullOrEmpty(configFilePath))
59+
{
60+
XDocument doc = new XDocument(new XElement("Config", new XElement("LanguageIndex", languageIndex)));
61+
doc.Save(configFilePath);
62+
}
63+
}
64+
65+
66+
private void ApplyLanguage(int languageIndex)
67+
{
68+
ResourceDictionary resourceDictionary = new ResourceDictionary();
69+
70+
string basePath = AppDomain.CurrentDomain.BaseDirectory;
71+
string[] languageFiles = { "StringResources.en.xaml", "StringResources.tr.xaml", "StringResources.de.xaml", "StringResources.es.xaml", "StringResources.zh-cy.xaml","StringResources.ua.xaml" };
72+
73+
if (languageIndex >= 0 && languageIndex < languageFiles.Length)
74+
{
75+
resourceDictionary.Source = new Uri(Path.Combine(basePath, languageFiles[languageIndex]));
76+
this.Resources.MergedDictionaries.Add(resourceDictionary);
77+
}
78+
}
79+
80+
private void comboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
81+
{
82+
int selectedLanguageIndex = comboBoxLanguage.SelectedIndex;
83+
SaveLanguagePreference(selectedLanguageIndex);
84+
ApplyLanguage(selectedLanguageIndex);
85+
}
3786
private bool IsWindows11OrHigher()
3887
{
3988
// Windows 11 version number: 10.0.22000
@@ -1063,16 +1112,6 @@ private void xboxGameBar_Unchecked(object sender, RoutedEventArgs e)
10631112
RegHelper.SetValue(RegistryHive.LocalMachine, @"SOFTWARE\Policies\Microsoft\Windows\GameDVR", "AllowGameDVR", 1, RegistryValueKind.DWord);
10641113
}
10651114

1066-
// Password Reveal Button
1067-
private void passwordReveal_Checked(object sender, RoutedEventArgs e)
1068-
{
1069-
RegHelper.SetValue(RegistryHive.CurrentUser, @"SOFTWARE\Policies\Microsoft\Windows\CredUI", "DisablePasswordReveal", 1, RegistryValueKind.DWord);
1070-
}
1071-
1072-
private void passwordReveal_Unchecked(object sender, RoutedEventArgs e)
1073-
{
1074-
RegHelper.SetValue(RegistryHive.CurrentUser, @"SOFTWARE\Policies\Microsoft\Windows\CredUI", "DisablePasswordReveal", 0, RegistryValueKind.DWord);
1075-
}
10761115

10771116
// Location Sensors
10781117
private void locationSensors_Checked(object sender, RoutedEventArgs e)
@@ -1444,7 +1483,6 @@ private void DownloadedMapsManager_Unchecked(object sender, RoutedEventArgs e)
14441483
private void FileHistoryService_Checked(object sender, RoutedEventArgs e)
14451484
{
14461485
RegHelper.SetValue(RegistryHive.LocalMachine, @"SYSTEM\CurrentControlSet\Services\fhsvc", "Start", 4, RegistryValueKind.DWord);
1447-
14481486
}
14491487
private void FileHistoryService_Unchecked(object sender, RoutedEventArgs e)
14501488
{
@@ -1565,12 +1603,46 @@ private void PrintSpoolerService_Unchecked(object sender, RoutedEventArgs e)
15651603
// Security Center Service
15661604
private void SecurityCenterService_Checked(object sender, RoutedEventArgs e)
15671605
{
1568-
RegHelper.SetValue(RegistryHive.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "Start", 4, RegistryValueKind.DWord);
1606+
try
1607+
{
1608+
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc", true))
1609+
{
1610+
if (key != null)
1611+
{
1612+
key.SetValue("Start", 4, RegistryValueKind.DWord);
1613+
}
1614+
else
1615+
{
1616+
// Anahtar bulunamadı
1617+
}
1618+
}
1619+
}
1620+
catch (Exception ex)
1621+
{
1622+
// Hata işleme
1623+
}
15691624
}
15701625

15711626
private void SecurityCenterService_Unchecked(object sender, RoutedEventArgs e)
15721627
{
1573-
RegHelper.SetValue(RegistryHive.LocalMachine, @"SYSTEM\CurrentControlSet\Services\wscsvc", "Start", 2, RegistryValueKind.DWord);
1628+
try
1629+
{
1630+
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\wscsvc", true))
1631+
{
1632+
if (key != null)
1633+
{
1634+
key.SetValue("Start", 2, RegistryValueKind.DWord);
1635+
}
1636+
else
1637+
{
1638+
// Anahtar bulunamadı
1639+
}
1640+
}
1641+
}
1642+
catch (Exception ex)
1643+
{
1644+
// Hata işleme
1645+
}
15741646
}
15751647

15761648
// Windows Error Reporting Service
@@ -1933,7 +2005,7 @@ await Task.Run(() =>
19332005
{
19342006
if (!MessageBoxShown)
19352007
{
1936-
System.Windows.MessageBox.Show("Bazı dosyalar ve klasörler arkaplanda açık uygulamalar tarafından kullanılıyor, bu dosya ve klasörler silinemeyecek!.");
2008+
System.Windows.MessageBox.Show("Some files and folders are used in the background by open applications, these files and folders will not be deleted!.");
19372009
MessageBoxShown = true; // MessageBox gösterildiğini işaretle
19382010
}
19392011
}
@@ -1954,7 +2026,7 @@ private async void AnalyzeButton_Click(object sender, RoutedEventArgs e)
19542026
isProcessing = true;
19552027
await Task.Delay(3000);
19562028

1957-
if (LogsCheckbox.IsChecked == true)
2029+
if (logsCheckbox.IsChecked == true)
19582030
{
19592031
string updateLogsPath = @"C:\Windows\Logs\";
19602032
if (Directory.Exists(updateLogsPath))
@@ -1987,7 +2059,7 @@ private async void AnalyzeButton_Click(object sender, RoutedEventArgs e)
19872059
}
19882060
}
19892061

1990-
if (WindowsOldCheckbox.IsChecked == true)
2062+
if (windowsOldCheckbox.IsChecked == true)
19912063
{
19922064
string windowsOldPath = @"C:\Windows.old\";
19932065
if (Directory.Exists(windowsOldPath))
@@ -2003,7 +2075,7 @@ private async void AnalyzeButton_Click(object sender, RoutedEventArgs e)
20032075
}
20042076
}
20052077

2006-
if (erroreportingCheckbox.IsChecked == true)
2078+
if (errorReportingCheckbox.IsChecked == true)
20072079
{
20082080
string werPath = @"C:\ProgramData\Microsoft\Windows\WER\";
20092081
if (Directory.Exists(werPath))
@@ -2019,7 +2091,7 @@ private async void AnalyzeButton_Click(object sender, RoutedEventArgs e)
20192091
}
20202092
}
20212093

2022-
if (programdatacachesCheckbox.IsChecked == true)
2094+
if (programDataCachesCheckbox.IsChecked == true)
20232095
{
20242096
string cachesPath = @"C:\ProgramData\Microsoft\Windows\Caches\";
20252097
if (Directory.Exists(cachesPath))
@@ -2052,7 +2124,7 @@ private async void AnalyzeButton_Click(object sender, RoutedEventArgs e)
20522124
}
20532125
}
20542126

2055-
if (recyclebinCheckbox.IsChecked == true)
2127+
if (recycleBinCheckbox.IsChecked == true)
20562128
{
20572129
string cachesPath = @"C:\$Recycle.Bin";
20582130
if (Directory.Exists(cachesPath))
@@ -2068,7 +2140,7 @@ private async void AnalyzeButton_Click(object sender, RoutedEventArgs e)
20682140
}
20692141
}
20702142

2071-
if (searchindexCheckbox.IsChecked == true)
2143+
if (searchIndexCheckbox.IsChecked == true)
20722144
{
20732145
string cachesPath = @"C:\ProgramData\Microsoft\Search\Data\";
20742146
if (Directory.Exists(cachesPath))
@@ -2100,7 +2172,7 @@ private async void AnalyzeButton_Click(object sender, RoutedEventArgs e)
21002172
}
21012173
}
21022174

2103-
if (fontcacheCheckbox.IsChecked == true)
2175+
if (fontCacheCheckbox.IsChecked == true)
21042176
{
21052177
string cachesPath = @"C:\Windows\ServiceProfiles\LocalService\AppData\Local\FontCache";
21062178
if (Directory.Exists(cachesPath))
@@ -2116,7 +2188,7 @@ private async void AnalyzeButton_Click(object sender, RoutedEventArgs e)
21162188
}
21172189
}
21182190

2119-
if (ınstallerCheckbox.IsChecked == true)
2191+
if (installerCheckbox.IsChecked == true)
21202192
{
21212193
string cachesPath = @"C:\Windows\Installer";
21222194
if (Directory.Exists(cachesPath))
@@ -2157,7 +2229,7 @@ private async void CleanButton_Click(object sender, RoutedEventArgs e)
21572229

21582230
/// CLEAR BAŞLANGICI ///
21592231

2160-
if (LogsCheckbox.IsChecked == true)
2232+
if (logsCheckbox.IsChecked == true)
21612233
{
21622234
selectedPath[0] = @"C:\Windows\Logs\";
21632235
}
@@ -2168,17 +2240,17 @@ private async void CleanButton_Click(object sender, RoutedEventArgs e)
21682240
selectedPath[1] = Path.Combine(@"C:\Users", username, "AppData", "Local", "Temp");
21692241
}
21702242

2171-
if (WindowsOldCheckbox.IsChecked == true)
2243+
if (windowsOldCheckbox.IsChecked == true)
21722244
{
21732245
selectedPath[2] = Path.Combine(@"C:\Windows.old");
21742246
}
21752247

2176-
if (erroreportingCheckbox.IsChecked == true)
2248+
if (errorReportingCheckbox.IsChecked == true)
21772249
{
21782250
selectedPath[3] = Path.Combine(@"C:\ProgramData\Microsoft\Windows\WER");
21792251
}
21802252

2181-
if (programdatacachesCheckbox.IsChecked == true)
2253+
if (programDataCachesCheckbox.IsChecked == true)
21822254
{
21832255
selectedPath[4] = Path.Combine(@"C:\ProgramData\Microsoft\Windows\Caches");
21842256
}
@@ -2189,12 +2261,12 @@ private async void CleanButton_Click(object sender, RoutedEventArgs e)
21892261
selectedPath[5] = Path.Combine(@"C:\Users", username, "Downloads");
21902262
}
21912263

2192-
if (recyclebinCheckbox.IsChecked == true)
2264+
if (recycleBinCheckbox.IsChecked == true)
21932265
{
21942266
selectedPath[6] = Path.Combine(@"C:\$Recycle.Bin");
21952267
}
21962268

2197-
if (searchindexCheckbox.IsChecked == true)
2269+
if (searchIndexCheckbox.IsChecked == true)
21982270
{
21992271
selectedPath[7] = Path.Combine(@"C:\ProgramData\Microsoft\Search\Data");
22002272
}
@@ -2204,12 +2276,12 @@ private async void CleanButton_Click(object sender, RoutedEventArgs e)
22042276
selectedPath[8] = Path.Combine(@"C:\Windows\Prefetch");
22052277
}
22062278

2207-
if (fontcacheCheckbox.IsChecked == true)
2279+
if (fontCacheCheckbox.IsChecked == true)
22082280
{
22092281
selectedPath[9] = Path.Combine(@"C:\Windows\ServiceProfiles\LocalService\AppData\Local\FontCache");
22102282
}
22112283

2212-
if (ınstallerCheckbox.IsChecked == true)
2284+
if (installerCheckbox.IsChecked == true)
22132285
{
22142286
selectedPath[10] = Path.Combine(@"C:\Windows\Installer");
22152287
}
@@ -2234,33 +2306,5 @@ private void TakeOwnership(string filePath)
22342306
}
22352307
}
22362308

2237-
private void comboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
2238-
{
2239-
ResourceDictionary resourceDictionary = new ResourceDictionary();
2240-
string basePath = AppDomain.CurrentDomain.BaseDirectory; // Programın çalıştığı dizin
2241-
2242-
if (comboBoxLanguage.SelectedIndex == 0)
2243-
{
2244-
resourceDictionary.Source = new Uri(Path.Combine(basePath, "StringResources.en.xaml"));
2245-
}
2246-
else if (comboBoxLanguage.SelectedIndex == 1)
2247-
{
2248-
resourceDictionary.Source = new Uri(Path.Combine(basePath, "StringResources.tr.xaml"));
2249-
}
2250-
else if (comboBoxLanguage.SelectedIndex == 2)
2251-
{
2252-
resourceDictionary.Source = new Uri(Path.Combine(basePath, "StringResources.de.xaml"));
2253-
}
2254-
else if (comboBoxLanguage.SelectedIndex == 3)
2255-
{
2256-
resourceDictionary.Source = new Uri(Path.Combine(basePath, "StringResources.es.xaml"));
2257-
}
2258-
this.Resources.MergedDictionaries.Add(resourceDictionary);
2259-
}
2260-
2261-
2262-
2263-
2264-
22652309
}
22662310
}

ShadesTweaker/ShadesTweaker.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,8 @@
120120
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
121121
</EmbeddedResource>
122122
</ItemGroup>
123+
<ItemGroup>
124+
<Resource Include="flag.png" />
125+
</ItemGroup>
123126
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
124127
</Project>
12.5 KB
Binary file not shown.
2 KB
Binary file not shown.

0 commit comments

Comments
 (0)