deadmoon 2 лет назад
Родитель
Сommit
fa0352c047

+ 7 - 0
CHANGELOG.md

@@ -1,3 +1,10 @@
+## [14.9] - 2023-02-18
+- New: Uninstall OneDrive is ONLY visible in UNSAFE MODE, for apparent reasons...
+- New: Optimizer Insights collects - with great respect to privacy - every error the app produces for further investigation
+- New: Of course, you can disable Optimizer Insights in Options
+- New: Fully translated into Japanese (thanks to Yamada Hayao - https://github.com/Hayao0819 for Japanese translation) (#286)
+- Improved: Minor code refactoring
+
 ## [14.8] - 2023-01-07
 - New: Updated to .NET Framework 4.8 for better performance and support
 - New: Added Restore all UWP apps

+ 8 - 10
Optimizer/ErrorLogger.cs

@@ -13,16 +13,7 @@ namespace Optimizer
             {
                 if (!File.Exists(ErrorLogFile) || (File.Exists(ErrorLogFile) && File.ReadAllText(ErrorLogFile).Trim() == string.Empty))
                 {
-                    string bitness = Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit";
-
-                    if (Utilities.CurrentWindowsVersion == WindowsVersion.Windows10)
-                    {
-                        File.AppendAllText(ErrorLogFile, string.Format("{0} - {1} ({2})", Utilities.GetOS(), Utilities.GetWindows10Build(), bitness));
-                    }
-                    else
-                    {
-                        File.AppendAllText(ErrorLogFile, string.Format("{0} - ({1})", Utilities.GetOS(), bitness));
-                    }
+                    File.AppendAllText(ErrorLogFile, Utilities.GetWindowsDetails());
                     File.AppendAllText(ErrorLogFile, Environment.NewLine);
                     File.AppendAllText(ErrorLogFile, string.Format("Optimizer {0} - .NET Framework {1} - Experimental build: {2}", Program.GetCurrentVersionTostring(), Utilities.GetNETFramework(), Program.EXPERIMENTAL_BUILD));
                     File.AppendAllText(ErrorLogFile, Environment.NewLine);
@@ -43,6 +34,13 @@ namespace Optimizer
                 File.AppendAllText(ErrorLogFile, Environment.NewLine);
             }
             catch { }
+            finally
+            {
+                if (!Options.CurrentOptions.DisableOptimizerTelemetry)
+                {
+                    TelemetryHelper.GenerateTelemetryData(functionName, errorMessage, errorStackTrace);
+                }
+            }
         }
     }
 }

Разница между файлами не показана из-за своего большого размера
+ 4595 - 4576
Optimizer/Forms/MainForm.Designer.cs


+ 19 - 4
Optimizer/Forms/MainForm.cs

@@ -753,16 +753,17 @@ namespace Optimizer
             _trayMenu = Options.CurrentOptions.EnableTray;
             quickAccessToggle.ToggleChecked = Options.CurrentOptions.EnableTray;
             launcherIcon.Visible = Options.CurrentOptions.EnableTray;
+            autoStartToggle.ToggleChecked = Options.CurrentOptions.AutoStart;
+            telemetrySvcToggle.ToggleChecked = Options.CurrentOptions.DisableOptimizerTelemetry;
+
             //seperatorNetMon.Visible = Options.CurrentOptions.EnableTray;
             //trayDownSpeed.Visible = Options.CurrentOptions.EnableTray;
             //trayUpSpeed.Visible = Options.CurrentOptions.EnableTray;
-            autoStartToggle.ToggleChecked = Options.CurrentOptions.AutoStart;
 
             // fix SSL/TLS error when contacting internet
             ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
 
             // initial states
-
             checkDefaultIcon.Checked = true;
             radioProgram.Checked = true;
             radioTop.Checked = true;
@@ -861,6 +862,10 @@ namespace Optimizer
                 txtOS.Text += string.Format(" ({0})", Utilities.GetWindows10Build());
             }
 
+            // Show Uninstall OneDrive ONLY in UNSAFE MODE!
+            // Reasons should be apparent by now...
+            uODSw.Visible = Program.UNSAFE_MODE;
+
             _splashForm.LoadingStatus.Text = "loading startup && hosts items";
 
             _columnSorter = new ListViewColumnSorter();
@@ -2200,8 +2205,7 @@ namespace Optimizer
 
         private void Main_Load(object sender, EventArgs e)
         {
-            WizardForm f = new WizardForm();
-            f.Show();
+
         }
 
         private void GetDesktopItems()
@@ -4659,5 +4663,16 @@ namespace Optimizer
                 UWPHelper.RestoreAllUWPApps();
             }
         }
+
+        private void telemetrySvcToggle_ToggleClicked(object sender, EventArgs e)
+        {
+            Options.CurrentOptions.DisableOptimizerTelemetry = telemetrySvcToggle.ToggleChecked;
+            Options.SaveSettings();
+
+            if (!Options.CurrentOptions.DisableOptimizerTelemetry)
+            {
+                TelemetryHelper.EnableTelemetryService();
+            }
+        }
     }
 }

+ 1 - 1
Optimizer/Forms/MainForm.resx

@@ -722,7 +722,7 @@ any application only by typing your desired keyword.</value>
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC0
-        GgAAAk1TRnQBSQFMAgEBCQEAAZgBDQGYAQ0BIAEAASABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAGA
+        GgAAAk1TRnQBSQFMAgEBCQEAAbgBDQG4AQ0BIAEAASABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAGA
         AwABYAMAAQEBAAEgBgABwP8A/wD/AP8A/wD/AP8A/wAeAANHAYB0//8AiQADRwGAdP//AIkAAyoBQANH
         AYADRwGAA0cBgANHAYADRwGAA0cBgANHAYADRwGAA0cBgANHAYADRwGAA0cBgANHAYADRwGAA0cBgANH
         AYADRwGAA0cBgANHAYADRwGAA0cBgANHAYADRwGAA0cBgANHAYADRwGAA0cBgANHAYADRwGA/wD/AP8A

+ 0 - 0
Optimizer/Hardware.cs → Optimizer/HardwareModel.cs


+ 3 - 1
Optimizer/Optimizer.csproj

@@ -177,7 +177,7 @@
     <Compile Include="Forms\UpdateForm.Designer.cs">
       <DependentUpon>UpdateForm.cs</DependentUpon>
     </Compile>
-    <Compile Include="Hardware.cs" />
+    <Compile Include="HardwareModel.cs" />
     <Compile Include="Forms\HostsEditorForm.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -236,6 +236,8 @@
     <Compile Include="StartupBackupItem.cs" />
     <Compile Include="StartupHelper.cs" />
     <Compile Include="StartupItem.cs" />
+    <Compile Include="TelemetryData.cs" />
+    <Compile Include="TelemetryHelper.cs" />
     <Compile Include="TokenPrivilege.cs" />
     <Compile Include="Utilities.cs" />
     <Compile Include="UWPHelper.cs" />

+ 12 - 0
Optimizer/Options.cs

@@ -16,6 +16,9 @@ namespace Optimizer
         public bool EnableTray { get; set; }
         public bool AutoStart { get; set; }
 
+        public string TelemetryClientID { get; set; }
+        public bool DisableOptimizerTelemetry { get; set; }
+
         public LanguageCode LanguageCode { get; set; }
 
         // universal
@@ -212,6 +215,9 @@ namespace Optimizer
                     CurrentOptions.EnableTray = false;
                     CurrentOptions.AutoStart = false;
 
+                    CurrentOptions.TelemetryClientID = Guid.NewGuid().ToString().ToUpperInvariant();
+                    CurrentOptions.DisableOptimizerTelemetry = false;
+
                     CurrentOptions.LanguageCode = LanguageCode.EN;
 
                     CurrentOptions.EnablePerformanceTweaks = false;
@@ -296,6 +302,12 @@ namespace Optimizer
             {
                 CurrentOptions.Theme = Color.FromArgb(153, 102, 204);
             }
+            // generate random telemetry ID if not present
+            if (string.IsNullOrEmpty(CurrentOptions.TelemetryClientID))
+            {
+                CurrentOptions.TelemetryClientID = Guid.NewGuid().ToString().ToUpperInvariant();
+                SaveSettings();
+            }
 
             LoadTranslation();
         }

+ 7 - 2
Optimizer/Program.cs

@@ -14,7 +14,7 @@ namespace Optimizer
         /* DO NOT LEAVE THEM EMPTY */
 
         internal readonly static float Major = 14;
-        internal readonly static float Minor = 8;
+        internal readonly static float Minor = 9;
 
         internal readonly static bool EXPERIMENTAL_BUILD = false;
         internal static int DPI_PREFERENCE;
@@ -310,6 +310,11 @@ namespace Optimizer
                     Options.LoadSettings();
                 }
 
+                if (!Options.CurrentOptions.DisableOptimizerTelemetry)
+                {
+                    TelemetryHelper.EnableTelemetryService();
+                }
+
                 // ideal place to replace internal messages from translation list
                 _adminMissingMessage = Options.TranslationList["adminMissingMsg"];
                 _unsupportedMessage = Options.TranslationList["unsupportedMsg"];
@@ -321,7 +326,7 @@ namespace Optimizer
             }
             catch (Exception ex)
             {
-                ErrorLogger.LogError("Program.Main", ex.Message, ex.StackTrace);
+                ErrorLogger.LogError("Program.Main-LoadSettings", ex.Message, ex.StackTrace);
                 Environment.Exit(0);
             }
         }

+ 2 - 1
Optimizer/Resources/i18n/AR.json

@@ -439,5 +439,6 @@
 	"storeUpdatesSw": "تعطيل تحديثات متجر Microsoft",
 	"storeUpdatesTip": "تعطيل وظيفة التحديثات التلقائية لـ Microsoft Store.",
 	"btnRestoreUwp": "ستعادة كل UWP",
-	"restoreUwpMessage": "هل انت متأكد من أنك تريد أن تفعل هذا؟"
+	"restoreUwpMessage": "هل انت متأكد من أنك تريد أن تفعل هذا؟",
+	"telemetrySvcToggle": "تعطيل Optimizer عن بعد"
 }

+ 3 - 2
Optimizer/Resources/i18n/CN.json

@@ -437,5 +437,6 @@
 	"storeUpdatesSw": "禁用 Microsoft Store 更新",
 	"storeUpdatesTip": "禁用 Microsoft Store 自动更新功能。",
 	"btnRestoreUwp": "恢复所有 UWP",
-	"restoreUwpMessage": "你确定要这么做吗?"
-}
+	"restoreUwpMessage": "你确定要这么做吗?",
+	"telemetrySvcToggle": "禁用优化器遥测"
+}

+ 2 - 1
Optimizer/Resources/i18n/CZ.json

@@ -439,5 +439,6 @@ Má to negativní vliv na výkon.",
 	"storeUpdatesSw": "Zakázat aktualizace Microsoft Store",
 	"storeUpdatesTip": "Zakáže funkci automatických aktualizací Microsoft Store.",
 	"btnRestoreUwp": "Obnovte všechny UWP",
-	"restoreUwpMessage": "Opravdu to chcete udělat?"
+	"restoreUwpMessage": "Opravdu to chcete udělat?",
+	"telemetrySvcToggle": "Zakázat telemetrii optimalizátoru"
 }

+ 2 - 1
Optimizer/Resources/i18n/DE.json

@@ -415,5 +415,6 @@ Es wirkt sich negativ auf die Leistung aus.",
 	"storeUpdatesSw": "Deaktivieren Sie Microsoft Store-Updates",
 	"storeUpdatesTip": "Deaktiviert die Funktion für automatische Updates im Microsoft Store.",
 	"btnRestoreUwp": "Stellen Sie alle UWP wieder her",
-	"restoreUwpMessage": "Sind Sie sicher, dass Sie dies tun möchten?"
+	"restoreUwpMessage": "Sind Sie sicher, dass Sie dies tun möchten?",
+	"telemetrySvcToggle": "Deaktivieren Sie die Optimizer-Telemetrie"
 }

+ 3 - 2
Optimizer/Resources/i18n/EL.json

@@ -341,7 +341,7 @@
 για μελλοντική βελτίωση.",
 	"officeTelemetryTip": "Η υπηρεσία Τηλεμετρίας του Office στέλνει δεδομένα χρήσης 
 και απόδοσης στη Microsoft, για μελλοντική βελτίωση. ",
-	"ffTelemetryTip": "ΑπενεργοποίησηS τηλεμετρίας και συλλογής δεδομένων του Mozilla Firefox.",
+	"ffTelemetryTip": "Απενεργοποίηση τηλεμετρίας και συλλογής δεδομένων του Mozilla Firefox.",
 	"vsTip": "Απενεργοποίηση της τηλεμετρίας και της υπηρεσίας σχολίων του Visual Studio.",
 	"chromeTelemetryTip": "Απενεργοποίηση της τηλεμετρίας και αναφοράς σφαλμάτων του Chrome.
 (μειώνει δραματικά την άσκοπη χρήση επεξεργαστή).",
@@ -434,5 +434,6 @@
 	"storeUpdatesSw": "Απενεργοποίηση Ενημερώσεων Microsoft Store",
 	"storeUpdatesTip": "Απενεργοποιεί τις ενημερώσεις του Microsoft Store.",
 	"btnRestoreUwp": "Επαναφορά όλων των UWP",
-	"restoreUwpMessage": "Είστε σίγουροι ότι θέλετε να επαναφέρετε όλες τις εφαρμογές UWP;"
+	"restoreUwpMessage": "Είστε σίγουροι ότι θέλετε να επαναφέρετε όλες τις εφαρμογές UWP;",
+	"telemetrySvcToggle": "Απενεργοποίηση τηλεμετρίας Optimizer"
 }

+ 2 - 1
Optimizer/Resources/i18n/EN.json

@@ -439,5 +439,6 @@ It has negative effect on performance.",
 	"winSearchSw": "Disable Search",
 	"winSearchTip": "Disables Windows search service.",
 	"btnRestoreUwp": "Restore all UWP",
-	"restoreUwpMessage": "Are you sure you want to do this?"
+	"restoreUwpMessage": "Are you sure you want to do this?",
+	"telemetrySvcToggle": "Disable Optimizer Insights"
 }

+ 2 - 1
Optimizer/Resources/i18n/ES.json

@@ -436,5 +436,6 @@ Tiene un efecto negativo en el rendimiento.",
 	"storeUpdatesSw": "Deshabilitar las actualizaciones de la tienda de Microsoft",
 	"storeUpdatesTip": "Deshabilita la funcionalidad de actualizaciones automáticas de Microsoft Store.",
 	"btnRestoreUwp": "Restaurar todo UWP",
-	"restoreUwpMessage": "¿Seguro que quieres hacer esto?"
+	"restoreUwpMessage": "¿Seguro que quieres hacer esto?",
+	"telemetrySvcToggle": "Deshabilitar la telemetría del optimizador"
 }

+ 2 - 1
Optimizer/Resources/i18n/FR.json

@@ -436,5 +436,6 @@ Cela a un effet négatif sur les performances.",
 	"storeUpdatesSw": "Désactiver les mises à jour du Microsoft Store",
 	"storeUpdatesTip": "Désactive la fonctionnalité de mises à jour automatiques de Microsoft Store.",
 	"btnRestoreUwp": "Restaurer tous les UWP",
-	"restoreUwpMessage": "Es-tu sûr de vouloir faire ça?"
+	"restoreUwpMessage": "Es-tu sûr de vouloir faire ça?",
+	"telemetrySvcToggle": "Désactiver la télémétrie de l'optimiseur"
 }

+ 2 - 1
Optimizer/Resources/i18n/HU.json

@@ -439,5 +439,6 @@ Negatív hatással van a teljesítményre.",
 	"storeUpdatesSw": "A Microsoft Store frissítéseinek letiltása",
 	"storeUpdatesTip": "Letiltja a Microsoft Store automatikus frissítési funkcióját.",
 	"btnRestoreUwp": "Állítsa vissza az összes UWP",
-	"restoreUwpMessage": "Biztosan ezt akarod csinálni?"
+	"restoreUwpMessage": "Biztosan ezt akarod csinálni?",
+	"telemetrySvcToggle": "Az Optimizer telemetria letiltása"
 }

+ 1 - 1
Optimizer/Resources/i18n/IT.json

@@ -434,5 +434,5 @@ Ha un effetto negativo sulle prestazioni.",
 	"storeUpdatesSw": "Disabilita gli aggiornamenti di Microsoft Store",
 	"storeUpdatesTip": "Disabilita la funzionalità degli aggiornamenti automatici di Microsoft Store.",
 	"btnRestoreUwp": "Ripristina tutta la piattaforma UWP",
-	"restoreUwpMessage": "Sei sicuro di volerlo fare?"
+	"restoreUwpMessage": "Disabilita la telemetria dell'ottimizzatore"
 }

+ 2 - 1
Optimizer/Resources/i18n/JA.json

@@ -429,5 +429,6 @@ Disabling it can reduce I/O operations on the disks.",
 	"winSearchSw": "検索を無効化",
 	"winSearchTip": "Windows Searchサービスを無効化します。",
 	"btnRestoreUwp": "全てのUWPを復元",
-	"restoreUwpMessage": "これを実行してもよろしいですか?"
+	"restoreUwpMessage": "これを実行してもよろしいですか?",
+	"telemetrySvcToggle": "オプティマイザーのテレメトリを無効にする"
 }

+ 2 - 1
Optimizer/Resources/i18n/KO.json

@@ -439,5 +439,6 @@ Microsoft 계정 로그인이 필요합니다.",
 	"storeUpdatesSw": "Microsoft Store 업데이트 비활성화",
 	"storeUpdatesTip": "Microsoft Store 자동 업데이트 기능을 비활성화합니다.",
 	"btnRestoreUwp": "모든 UWP 복원",
-	"restoreUwpMessage": "이 작업을 수행하시겠습니까?"
+	"restoreUwpMessage": "이 작업을 수행하시겠습니까?",
+	"telemetrySvcToggle": "옵티마이저 텔레메트리 비활성화"
 }

+ 2 - 1
Optimizer/Resources/i18n/KU.json

@@ -438,5 +438,6 @@
 	"storeUpdatesSw": "نوێکارییەکانی فرۆشگای مایکرۆسۆفت لەکاربخە",
 	"storeUpdatesTip": "کارایی نوێکردنەوەی ئۆتۆماتیکی فرۆشگای مایکرۆسۆفت لەکاردەخات.",
 	"btnRestoreUwp": "هەموو UWP بگەڕێنەرەوە",
-	"restoreUwpMessage": "دڵنیای کە دەتەوێت ئەم کارە بکەیت؟"
+	"restoreUwpMessage": "دڵنیای کە دەتەوێت ئەم کارە بکەیت؟",
+	"telemetrySvcToggle": "تەلەمێتری ئۆپتیمایزەر لەکاربخە"
 }

+ 2 - 1
Optimizer/Resources/i18n/NL.json

@@ -390,5 +390,6 @@ Het heeft een negatief effect op de prestaties.",
    "storeUpdatesSw": "Schakel Microsoft Store-updates uit",
 	"storeUpdatesTip": "Schakelt de functionaliteit voor automatische updates van de Microsoft Store uit.",
    "btnRestoreUwp": "Herstel alle UWP",
-	"restoreUwpMessage": "Weet je zeker dat je dit wilt doen?"
+	"restoreUwpMessage": "Weet je zeker dat je dit wilt doen?",
+   "telemetrySvcToggle": "Schakel Optimizer-telemetrie uit"
 }

+ 2 - 1
Optimizer/Resources/i18n/PL.json

@@ -435,5 +435,6 @@ Ma negatywny wpływ na wydajność.",
 	"storeUpdatesSw": "Wyłącz aktualizacje Microsoft Store",
 	"storeUpdatesTip": "Wyłącza funkcję automatycznych aktualizacji Microsoft Store.",
 	"btnRestoreUwp": "Przywróć wszystkie platformy UWP",
-	"restoreUwpMessage": "Czy na pewno chcesz to zrobić?"
+	"restoreUwpMessage": "Czy na pewno chcesz to zrobić?",
+	"telemetrySvcToggle": "Wyłącz telemetrię Optymalizatora"
 }

+ 2 - 1
Optimizer/Resources/i18n/PT.json

@@ -436,5 +436,6 @@ Tem efeito negativo no desempenho.",
 	"storeUpdatesSw": "Desativar atualizações da Microsoft Store",
 	"storeUpdatesTip": "Desativa a funcionalidade de atualizações automáticas da Microsoft Store.",
 	"btnRestoreUwp": "Restaurar todos os UWP",
-	"restoreUwpMessage": "Você tem certeza de que quer fazer isso?"
+	"restoreUwpMessage": "Você tem certeza de que quer fazer isso?",
+	"telemetrySvcToggle": "Desativar a telemetria do otimizador"
 }

+ 2 - 1
Optimizer/Resources/i18n/RO.json

@@ -421,5 +421,6 @@ Are un efect negativ asupra performanței.",
 	"storeUpdatesSw": "Dezactivați actualizările Microsoft Store",
 	"storeUpdatesTip": "Dezactivează funcționalitatea de actualizări automate din Microsoft Store.",
 	"btnRestoreUwp": "Restaurați toate UWP",
-	"restoreUwpMessage": "Ești sigur că vrei să faci asta?"
+	"restoreUwpMessage": "Ești sigur că vrei să faci asta?",
+	"telemetrySvcToggle": "Dezactivați telemetria Optimizer"
 }

+ 2 - 1
Optimizer/Resources/i18n/RU.json

@@ -439,5 +439,6 @@
 	"storeUpdatesSw": "Отключить обновления магазина Microsoft",
 	"storeUpdatesTip": "Отключает функцию автоматического обновления Microsoft Store.",
 	"btnRestoreUwp": "Восстановить все UWP",
-	"restoreUwpMessage": "Вы уверены, что хотите это сделать?"
+	"restoreUwpMessage": "Вы уверены, что хотите это сделать?",
+	"telemetrySvcToggle": "Отключить телеметрию оптимизатора"
 }

+ 2 - 1
Optimizer/Resources/i18n/TR.json

@@ -437,5 +437,6 @@ Performansa olumsuz etkisi vardır.",
 	"storeUpdatesSw": "Microsoft Store Güncellemelerini Devre Dışı Bırak",
 	"storeUpdatesTip": "Microsoft Mağazası otomatik güncellemeler işlevini devre dışı bırakır.",
 	"btnRestoreUwp": "Tüm UWP'yi geri yükle",
-	"restoreUwpMessage": "Bunu yapmak istediğinizden emin misiniz?"
+	"restoreUwpMessage": "Bunu yapmak istediğinizden emin misiniz?",
+	"telemetrySvcToggle": "Optimize Edici Telemetriyi Devre Dışı Bırak"
 }

+ 2 - 1
Optimizer/Resources/i18n/TW.json

@@ -437,5 +437,6 @@
 	"storeUpdatesSw": "禁用 Microsoft Store 更新",
 	"storeUpdatesTip": "禁用 Microsoft Store 自動更新功能。",
 	"btnRestoreUwp": "恢復所有 UWP",
-	"restoreUwpMessage": "你確定要這麼做嗎?"
+	"restoreUwpMessage": "你確定要這麼做嗎?",
+	"telemetrySvcToggle": "禁用優化器遙測"
 }

+ 2 - 1
Optimizer/Resources/i18n/UA.json

@@ -441,5 +441,6 @@
 	"storeUpdatesSw": "Вимкніть оновлення Microsoft Store",
 	"storeUpdatesTip": "Вимикає функцію автоматичного оновлення Microsoft Store.",
 	"btnRestoreUwp": "Відновити всі UWP",
-	"restoreUwpMessage": "Ви впевнені, що хочете це зробити?"
+	"restoreUwpMessage": "Ви впевнені, що хочете це зробити?",
+	"telemetrySvcToggle": "Вимкніть оптимізатор телеметрії"
 }

+ 36 - 0
Optimizer/TelemetryData.cs

@@ -0,0 +1,36 @@
+using System;
+
+namespace Optimizer
+{
+    [Serializable]
+    public sealed class TelemetryData
+    {
+        // General data
+        public string Timestamp { get; set; }
+        public string Country { get; set; }
+
+        // Windows environment info
+        public string WindowsVersion { get; set; }
+        public string DotNetVersion { get; set; }
+
+        // Optimizer-specific details
+        public string OptimizerVersion { get; set; }
+        public string LanguageCode { get; set; }
+        public string TelemetryID { get; set; }
+        public string UnsafeMode { get; set; }
+        public string ExperimentalBuild { get; set; }
+        public string SavedOptions { get; set; }
+
+        // Exception details
+        public string FunctionName { get; set; }
+        public string ErrorMessage { get; set; }
+        public string StackTrace { get; set; }
+    }
+
+    [Serializable]
+    public sealed class GeoLookupResult
+    {
+        public string status { get; set; }
+        public string country { get; set; }
+    }
+}

+ 86 - 0
Optimizer/TelemetryHelper.cs

@@ -0,0 +1,86 @@
+using Newtonsoft.Json;
+using System;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Optimizer
+{
+    internal static class TelemetryHelper
+    {
+        const string GEO_LOOKUP_URL = "http://ip-api.com/json/";
+        static TelemetryData telemetryEntry = new TelemetryData();
+
+        internal static HttpClient TelemetryClient;
+
+        internal const string TELEMETRY_API_URL = "https://optimizer-telemetry-handler.azurewebsites.net/telemetry.php";
+        internal const string TELEMETRY_KEY = @"{OPTIMIZER-0EFC7B8A-D1FC-467F-B4B1-0117C643FE19-TELEMETRY}";
+
+        internal static async void EnableTelemetryService()
+        {
+            TelemetryClient = new HttpClient();
+            TelemetryClient.BaseAddress = new Uri(TELEMETRY_API_URL);
+            TelemetryClient.DefaultRequestHeaders.Add("Optimizertelemetrykey", TELEMETRY_KEY);
+            TelemetryClient.DefaultRequestHeaders
+              .Accept
+              .Add(new MediaTypeWithQualityHeaderValue("application/json"));
+
+            await CacheTelemetryData();
+        }
+
+        internal static async Task<string> GetSessionCountry()
+        {
+            try
+            {
+                string result = await TelemetryClient.GetStringAsync(GEO_LOOKUP_URL);
+                GeoLookupResult x = JsonConvert.DeserializeObject<GeoLookupResult>(result);
+                if (x.status == "success")
+                {
+                    return x.country;
+                }
+                else
+                {
+                    return "Unknown";
+                }
+            }
+            catch
+            {
+                return "Unknown";
+            }
+        }
+
+        internal static async Task CacheTelemetryData()
+        {
+            telemetryEntry.Country = await GetSessionCountry();
+            telemetryEntry.WindowsVersion = Utilities.GetWindowsDetails();
+            telemetryEntry.DotNetVersion = Utilities.GetNETFramework();
+            telemetryEntry.OptimizerVersion = Program.GetCurrentVersionTostring();
+            telemetryEntry.UnsafeMode = Program.UNSAFE_MODE.ToString();
+            telemetryEntry.ExperimentalBuild = Program.EXPERIMENTAL_BUILD.ToString();
+            telemetryEntry.TelemetryID = Options.CurrentOptions.TelemetryClientID;
+        }
+
+        internal static void GenerateTelemetryData(string functionName, string errorMessage, string errorStackTrace)
+        {
+            telemetryEntry.Timestamp = string.Format("{0:yyyy-MM-ddTHH:mm:ss.FFFZ}", DateTime.UtcNow);
+            telemetryEntry.LanguageCode = Enum.GetName(typeof(LanguageCode), Options.CurrentOptions.LanguageCode);
+            telemetryEntry.SavedOptions = JsonConvert.SerializeObject(Options.CurrentOptions, Formatting.Indented);
+            telemetryEntry.FunctionName = functionName;
+            telemetryEntry.ErrorMessage = errorMessage;
+            telemetryEntry.StackTrace = errorStackTrace;
+
+            SendTelemetryData(telemetryEntry);
+        }
+
+        internal static void SendTelemetryData(TelemetryData entry)
+        {
+            try
+            {
+                StringContent bodyContent = new StringContent(JsonConvert.SerializeObject(telemetryEntry, Formatting.Indented), Encoding.UTF8, "application/json");
+                TelemetryClient.PostAsync(TelemetryClient.BaseAddress, bodyContent);
+            }
+            catch { }
+        }
+    }
+}

+ 15 - 2
Optimizer/Utilities.cs

@@ -61,6 +61,19 @@ namespace Optimizer
             return Color.FromArgb(grayScale, grayScale, grayScale);
         }
 
+        internal static string GetWindowsDetails()
+        {
+            string bitness = Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit";
+            if (CurrentWindowsVersion == WindowsVersion.Windows10 || CurrentWindowsVersion == WindowsVersion.Windows11)
+            {
+                return string.Format("{0} - {1} ({2})", GetOS(), GetWindows10Build(), bitness);
+            }
+            else
+            {
+                return string.Format("{0} - ({1})", GetOS(), bitness);
+            }
+        }
+
         internal static string GetWindows10Build()
         {
             return (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "DisplayVersion", "");
@@ -114,7 +127,7 @@ namespace Optimizer
 
         internal static string GetBitness()
         {
-            string bitness = string.Empty;
+            string bitness;
 
             if (Environment.Is64BitOperatingSystem)
             {
@@ -562,7 +575,7 @@ namespace Optimizer
 
         public static RegistryKey OpenSubKeyWritable(this RegistryKey registryKey, string subkeyName, RegistryRights? rights = null)
         {
-            RegistryKey subKey = null;
+            RegistryKey subKey;
 
             if (rights == null)
                 subKey = registryKey.OpenSubKey(subkeyName, RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.FullControl);

+ 6 - 5
README.md

@@ -3,7 +3,7 @@
 </p> 
 
 <p align="center">
-	<a href="https://github.com/hellzerg/optimizer/releases/download/14.8/Optimizer-14.8.exe" target="_blank">
+	<a href="https://github.com/hellzerg/optimizer/releases/download/14.9/Optimizer-14.9.exe" target="_blank">
 		<img src="https://raw.githubusercontent.com/hellzerg/optimizer/master/download-button.png">
 		<br>
 		<img src="https://raw.githubusercontent.com/hellzerg/optimizer/master/flags.png">
@@ -16,7 +16,7 @@ Advanced configuration utility that helps you restore your privacy and increase
 Optimizer is recommended after a fresh, clean installation of Windows to achieve maximum privacy and security.<br>
 Depending on your version of Windows, Optimizer will also allow you to perform some specific tweaks.
 
-* Full multilingual support (20 languages available)
+* Full multilingual support (21 languages available)
 * Speed up your system and network performance
 * Disable unnecessary Windows services
 * Disable Windows telemetry, Cortana and many more
@@ -87,9 +87,9 @@ https://github.com/hellzerg/optimizer/blob/master/LEGACY.md
 
 ### #️ Details: ###
 
-* Latest version: 14.8
-* Released: January 7, 2023
-* SHA256: 3D535198EBF1E519E4F58C9AACA1B1E00C9B375C6F79CD3CCA5F0B70F0A3DCD5
+* Latest version: 14.9
+* Released: February 18, 2023
+* SHA256: CC81BE39ADCB8EA105C75106084F7B6809014AEDE70B52FD7EB2F41D5C7C288C
 
 <hr>
 
@@ -125,5 +125,6 @@ Support my hard work by donating me through [PayPal](https://www.paypal.com/payp
 * https://github.com/BeamingNG - BeamingNG for Romanian translation
 * https://github.com/svanlaere - svanlaere for Dutch translation
 * https://github.com/kirill0ermakov - Kirill Ermakov for Ukrainian translation
+* https://github.com/Hayao0819 - Yamada Hayao for Japanese translation
 * Parwar Andam for Kurdish translation
 * Zan for Hungarian translation

+ 1 - 1
version.txt

@@ -1 +1 @@
-14.8
+14.9

Некоторые файлы не были показаны из-за большого количества измененных файлов