MainForm.cs 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Diagnostics;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Net;
  9. using System.Net.NetworkInformation;
  10. using System.Reflection;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14. namespace Optimizer
  15. {
  16. public partial class MainForm : Form
  17. {
  18. ListViewColumnSorter _columnSorter;
  19. List<StartupItem> _startUpItems = new List<StartupItem>();
  20. List<string> _hostsEntries = new List<string>();
  21. List<string> _customCommands = new List<string>();
  22. List<string> _desktopItems = new List<string>();
  23. List<string> _modernApps = new List<string>();
  24. bool _trayMenu = false;
  25. List<PingReply> _pingResults;
  26. string _shodanIP = string.Empty;
  27. PingReply tmpReply;
  28. DesktopItemType _desktopItemType = DesktopItemType.Program;
  29. DesktopTypePosition _desktopItemPosition = DesktopTypePosition.Top;
  30. public List<FeedApp> AppsFromFeed = new List<FeedApp>();
  31. readonly string _feedLink = "https://raw.githubusercontent.com/hellzerg/optimizer/master/feed.json";
  32. readonly string _licenseLink = "https://www.gnu.org/licenses/gpl-3.0.en.html";
  33. readonly string _openSourceLink = "https://opensource.org/";
  34. readonly string _latestVersionLink = "https://raw.githubusercontent.com/hellzerg/optimizer/master/version.txt";
  35. readonly string _changelogLink = "https://github.com/hellzerg/optimizer/blob/master/CHANGELOG.md";
  36. readonly string _noNewVersionMessage = "You already have the latest version!";
  37. readonly string _betaVersionMessage = "You are using an experimental version!";
  38. readonly string _blockedIP = "0.0.0.0";
  39. string infoText = string.Empty;
  40. string[] toRemove =
  41. {
  42. "Enable ",
  43. "Disable ",
  44. "Remove ",
  45. "Uninstall ",
  46. "Exclude ",
  47. };
  48. readonly string _restartMessage = "Restart to apply changes?";
  49. readonly string _removeStartupItemsMessage = "Are you sure you want to delete all startup items?";
  50. readonly string _removeHostsEntriesMessage = "Are you sure you want to delete all hosts entries?";
  51. readonly string _removeDesktopItemsMessage = "Are you sure you want to delete all desktop items?";
  52. readonly string _removeModernAppsMessage = "Are you sure you want to uninstall the following app(s)?";
  53. readonly string _errorModernAppsMessage = "The following app(s) couldn't be uninstalled:\n";
  54. readonly string _resetMessage = "Are you sure you want to reset configuration?\n\nThis will reset all your preferences, including any icons you extracted or downloaded using Integrator, but will not touch anything on your computer!";
  55. private string NewVersionMessage(string latestVersion)
  56. {
  57. return string.Format("There is a new version available!\n\nLatest version: {0}\nCurrent version: {1}\n\nDo you want to download it now?", latestVersion, Program.GetCurrentVersionTostring());
  58. }
  59. private string NewDownloadLink(string latestVersion)
  60. {
  61. return string.Format("https://github.com/hellzerg/optimizer/releases/download/{0}/Optimizer-{0}.exe", latestVersion);
  62. }
  63. private void CheckForUpdate(bool silentCheck = false)
  64. {
  65. WebClient client = new WebClient
  66. {
  67. Encoding = Encoding.UTF8
  68. };
  69. string latestVersion = string.Empty;
  70. try
  71. {
  72. latestVersion = client.DownloadString(_latestVersionLink);
  73. }
  74. catch (Exception ex)
  75. {
  76. ErrorLogger.LogError("MainForm.CheckForUpdate", ex.Message, ex.StackTrace);
  77. MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  78. }
  79. if (!string.IsNullOrEmpty(latestVersion))
  80. {
  81. if (float.Parse(latestVersion) > Program.GetCurrentVersion())
  82. {
  83. // show UPDATE AVAILABLE on app launch
  84. if (silentCheck)
  85. {
  86. linkUpdate.Visible = true;
  87. return;
  88. }
  89. if (MessageBox.Show(NewVersionMessage(latestVersion), "Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  90. {
  91. // PATCHING PROCESS
  92. try
  93. {
  94. Assembly currentAssembly = Assembly.GetEntryAssembly();
  95. if (currentAssembly == null)
  96. {
  97. currentAssembly = Assembly.GetCallingAssembly();
  98. }
  99. string appFolder = Path.GetDirectoryName(currentAssembly.Location);
  100. string appName = Path.GetFileNameWithoutExtension(currentAssembly.Location);
  101. string appExtension = Path.GetExtension(currentAssembly.Location);
  102. string archiveFile = Path.Combine(appFolder, appName + "_old" + appExtension);
  103. string appFile = Path.Combine(appFolder, appName + appExtension);
  104. string tempFile = Path.Combine(appFolder, appName + "_tmp" + appExtension);
  105. // DOWNLOAD NEW VERSION
  106. client.DownloadFile(NewDownloadLink(latestVersion), tempFile);
  107. // DELETE PREVIOUS BACK-UP
  108. if (File.Exists(archiveFile))
  109. {
  110. File.Delete(archiveFile);
  111. }
  112. // MAKE BACK-UP
  113. File.Move(appFile, archiveFile);
  114. // PATCH
  115. File.Move(tempFile, appFile);
  116. Application.Restart();
  117. }
  118. catch (Exception ex)
  119. {
  120. ErrorLogger.LogError("MainForm.CheckForUpdate", ex.Message, ex.StackTrace);
  121. MessageBox.Show(ex.Message);
  122. }
  123. }
  124. }
  125. else if (float.Parse(latestVersion) == Program.GetCurrentVersion())
  126. {
  127. if (!silentCheck) MessageBox.Show(_noNewVersionMessage, "No update available", MessageBoxButtons.OK, MessageBoxIcon.Information);
  128. }
  129. else
  130. {
  131. if (!silentCheck) MessageBox.Show(_betaVersionMessage, "BETA build", MessageBoxButtons.OK, MessageBoxIcon.Information);
  132. }
  133. }
  134. }
  135. private void EnableToggleEvents()
  136. {
  137. toggleSwitch7.Click += new EventHandler(ToggleSwitch7_Click);
  138. toggleSwitch12.Click += new EventHandler(toggleSwitch12_Click);
  139. toggleSwitch11.Click += new EventHandler(toggleSwitch11_Click);
  140. toggleSwitch10.Click += new EventHandler(toggleSwitch10_Click);
  141. toggleSwitch9.Click += new EventHandler(toggleSwitch9_Click);
  142. toggleSwitch8.Click += new EventHandler(toggleSwitch8_Click);
  143. toggleSwitch6.Click += new EventHandler(toggleSwitch6_Click);
  144. toggleSwitch5.Click += new EventHandler(toggleSwitch5_Click);
  145. toggleSwitch4.Click += new EventHandler(toggleSwitch4_Click);
  146. toggleSwitch1.Click += new EventHandler(toggleSwitch1_Click);
  147. toggleSwitch3.Click += new EventHandler(toggleSwitch3_Click);
  148. toggleSwitch2.Click += new EventHandler(toggleSwitch2_Click);
  149. toggleSwitch27.Click += new EventHandler(toggleSwitch27_Click);
  150. toggleSwitch28.Click += new EventHandler(toggleSwitch28_Click);
  151. toggleSwitch29.Click += new EventHandler(toggleSwitch29_Click);
  152. toggleSwitch30.Click += new EventHandler(toggleSwitch30_Click);
  153. toggleSwitch20.Click += new EventHandler(toggleSwitch20_Click);
  154. toggleSwitch21.Click += new EventHandler(toggleSwitch21_Click);
  155. toggleSwitch23.Click += new EventHandler(toggleSwitch23_Click);
  156. toggleSwitch24.Click += new EventHandler(toggleSwitch24_Click);
  157. toggleSwitch25.Click += new EventHandler(toggleSwitch25_Click);
  158. toggleSwitch26.Click += new EventHandler(toggleSwitch26_Click);
  159. toggleSwitch17.Click += new EventHandler(toggleSwitch17_Click);
  160. toggleSwitch16.Click += new EventHandler(toggleSwitch16_Click);
  161. toggleSwitch15.Click += new EventHandler(toggleSwitch15_Click);
  162. toggleSwitch14.Click += new EventHandler(toggleSwitch14_Click);
  163. toggleSwitch13.Click += new EventHandler(toggleSwitch13_Click);
  164. toggleSwitch31.Click += new EventHandler(toggleSwitch31_Click);
  165. toggleSwitch18.Click += new EventHandler(toggleSwitch18_Click);
  166. toggleSwitch19.Click += new EventHandler(toggleSwitch19_Click);
  167. toggleSwitch32.Click += new EventHandler(toggleSwitch32_Click);
  168. toggleSwitch33.Click += new EventHandler(ToggleSwitch33_Click);
  169. toggleSwitch34.Click += new EventHandler(ToggleSwitch34_Click);
  170. toggleSwitch35.Click += new EventHandler(ToggleSwitch35_Click);
  171. toggleSwitch36.Click += new EventHandler(ToggleSwitch36_Click);
  172. toggleSwitch37.Click += new EventHandler(ToggleSwitch37_Click);
  173. toggleSwitch38.Click += new EventHandler(ToggleSwitch38_Click);
  174. toggleSwitch39.Click += new EventHandler(ToggleSwitch39_Click);
  175. toggleSwitch40.Click += new EventHandler(ToggleSwitch40_Click);
  176. }
  177. private void ToggleSwitch7_Click(object sender, EventArgs e)
  178. {
  179. if (!toggleSwitch7.Checked)
  180. {
  181. Optimize.DisableActionCenter();
  182. }
  183. else
  184. {
  185. Optimize.EnableActionCenter();
  186. }
  187. Options.CurrentOptions.DisableActionCenter = !toggleSwitch7.Checked;
  188. }
  189. private void ToggleSwitch40_Click(object sender, EventArgs e)
  190. {
  191. if (!toggleSwitch40.Checked)
  192. {
  193. Optimize.RemoveCastToDevice();
  194. }
  195. else
  196. {
  197. Optimize.AddCastToDevice();
  198. }
  199. Options.CurrentOptions.RemoveCastToDevice = !toggleSwitch40.Checked;
  200. }
  201. private void ToggleSwitch39_Click(object sender, EventArgs e)
  202. {
  203. if (!toggleSwitch39.Checked)
  204. {
  205. Optimize.EnableLongPaths();
  206. }
  207. else
  208. {
  209. Optimize.DisableLongPaths();
  210. }
  211. Options.CurrentOptions.EnableLongPaths = !toggleSwitch39.Checked;
  212. }
  213. private void ToggleSwitch38_Click(object sender, EventArgs e)
  214. {
  215. if (!toggleSwitch38.Checked)
  216. {
  217. Optimize.DisableStickyKeys();
  218. }
  219. else
  220. {
  221. Optimize.EnableStickyKeys();
  222. }
  223. Options.CurrentOptions.DisableStickyKeys = !toggleSwitch38.Checked;
  224. }
  225. private void ToggleSwitch37_Click(object sender, EventArgs e)
  226. {
  227. if (!toggleSwitch37.Checked)
  228. {
  229. Optimize.DisableCloudClipboard();
  230. }
  231. else
  232. {
  233. Optimize.EnableCloudClipboard();
  234. }
  235. Options.CurrentOptions.DisableCloudClipboard = !toggleSwitch37.Checked;
  236. }
  237. private void ToggleSwitch36_Click(object sender, EventArgs e)
  238. {
  239. if (!toggleSwitch36.Checked)
  240. {
  241. Optimize.DisableSmartScreen();
  242. }
  243. else
  244. {
  245. Optimize.EnableSmartScreen();
  246. }
  247. Options.CurrentOptions.DisableSmartScreen = !toggleSwitch36.Checked;
  248. }
  249. private void ToggleSwitch35_Click(object sender, EventArgs e)
  250. {
  251. if (!toggleSwitch35.Checked)
  252. {
  253. Optimize.DisableForcedFeatureUpdates();
  254. }
  255. else
  256. {
  257. Optimize.EnableForcedFeatureUpdates();
  258. }
  259. Options.CurrentOptions.DisableFeatureUpdates = !toggleSwitch35.Checked;
  260. }
  261. private void ToggleSwitch34_Click(object sender, EventArgs e)
  262. {
  263. if (!toggleSwitch34.Checked)
  264. {
  265. Optimize.DisableInsiderService();
  266. }
  267. else
  268. {
  269. Optimize.EnableInsiderService();
  270. }
  271. Options.CurrentOptions.DisableInsiderService = !toggleSwitch34.Checked;
  272. }
  273. private void ToggleSwitch33_Click(object sender, EventArgs e)
  274. {
  275. if (!toggleSwitch33.Checked)
  276. {
  277. Optimize.DisableFaxService();
  278. }
  279. else
  280. {
  281. Optimize.EnableFaxService();
  282. }
  283. Options.CurrentOptions.DisableFaxService = !toggleSwitch33.Checked;
  284. }
  285. private void LoadSettings()
  286. {
  287. switch (Options.CurrentOptions.Color)
  288. {
  289. case Theme.Caramel:
  290. radioCaramel.Checked = true;
  291. break;
  292. case Theme.Lime:
  293. radioLime.Checked = true;
  294. break;
  295. case Theme.Magma:
  296. radioMagma.Checked = true;
  297. break;
  298. case Theme.Minimal:
  299. radioMinimal.Checked = true;
  300. break;
  301. case Theme.Ocean:
  302. radioOcean.Checked = true;
  303. break;
  304. case Theme.Zerg:
  305. radioZerg.Checked = true;
  306. break;
  307. }
  308. }
  309. //INIT
  310. public MainForm()
  311. {
  312. InitializeComponent();
  313. EnableToggleEvents();
  314. CheckForIllegalCrossThreadCalls = false;
  315. // theming
  316. Options.ApplyTheme(this);
  317. launcherMenu.Renderer = new ToolStripRendererMaterial();
  318. progressDownloader.BackColor = Options.ForegroundColor;
  319. progressDownloader.ForeColor = Options.ForegroundAccentColor;
  320. // quick access
  321. _trayMenu = Options.CurrentOptions.EnableTray;
  322. quickAccessToggle.Checked = Options.CurrentOptions.EnableTray;
  323. launcherIcon.Visible = Options.CurrentOptions.EnableTray;
  324. // help tips
  325. infoTip.Active = Options.CurrentOptions.ShowHelp;
  326. helpTipsToggle.Checked = Options.CurrentOptions.ShowHelp;
  327. // fix SSL/TLS error when contacting internet
  328. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  329. // initial states
  330. chkOnlyRemovable.Checked = true;
  331. checkDefaultIcon.Checked = true;
  332. radioProgram.Checked = true;
  333. radioTop.Checked = true;
  334. c64.Checked = Environment.Is64BitOperatingSystem;
  335. c32.Checked = !Environment.Is64BitOperatingSystem;
  336. // EXPERIMENTAL message
  337. lblLab.Visible = Program.EXPERIMENTAL_BUILD;
  338. if (Utilities.CurrentWindowsVersion == WindowsVersion.Unsupported)
  339. {
  340. tabCollection.TabPages.Remove(universalTab);
  341. tabCollection.TabPages.Remove(windowsVIIITab);
  342. tabCollection.TabPages.Remove(windowsXTab);
  343. tabCollection.TabPages.Remove(modernAppsTab);
  344. }
  345. if (Utilities.CurrentWindowsVersion == WindowsVersion.Windows7)
  346. {
  347. LoadUniversalToggleStates();
  348. tabCollection.TabPages.Remove(windowsVIIITab);
  349. tabCollection.TabPages.Remove(windowsXTab);
  350. tabCollection.TabPages.Remove(modernAppsTab);
  351. }
  352. if (Utilities.CurrentWindowsVersion == WindowsVersion.Windows8)
  353. {
  354. LoadUniversalToggleStates();
  355. LoadWindowsVIIIToggleStates();
  356. tabCollection.TabPages.Remove(windowsXTab);
  357. GetModernApps(false);
  358. }
  359. if (Utilities.CurrentWindowsVersion == WindowsVersion.Windows10)
  360. {
  361. LoadUniversalToggleStates();
  362. LoadWindowsXToggleStates();
  363. tabCollection.TabPages.Remove(windowsVIIITab);
  364. GetModernApps(false);
  365. }
  366. _columnSorter = new ListViewColumnSorter();
  367. listStartupItems.ListViewItemSorter = _columnSorter;
  368. GetStartupItems();
  369. GetHostsEntries();
  370. GetDesktopItems();
  371. GetCustomCommands();
  372. GetFeed();
  373. GetFootprint();
  374. LoadSettings();
  375. txtVersion.Text = "Version: " + Program.GetCurrentVersionTostring();
  376. Program.MainForm = this;
  377. txtOS.Text = "Microsoft " + Utilities.GetOS();
  378. txtBitness.Text = Utilities.GetBitness();
  379. if (string.IsNullOrEmpty(Options.CurrentOptions.AppsFolder))
  380. {
  381. txtDownloadFolder.Text = Path.Combine(Application.StartupPath, "Optimizer Downloads");
  382. Options.CurrentOptions.AppsFolder = Path.Combine(Application.StartupPath, "Optimizer Downloads");
  383. Directory.CreateDirectory(Options.CurrentOptions.AppsFolder);
  384. Options.SaveSettings();
  385. }
  386. else
  387. {
  388. if (!Directory.Exists(Options.CurrentOptions.AppsFolder))
  389. {
  390. Directory.CreateDirectory(Options.CurrentOptions.AppsFolder);
  391. }
  392. txtDownloadFolder.Text = Options.CurrentOptions.AppsFolder;
  393. }
  394. if (!Program.EXPERIMENTAL_BUILD && Utilities.IsInternetAvailable()) CheckForUpdate(true);
  395. if (Program.EXPERIMENTAL_BUILD)
  396. {
  397. btnUpdate.Enabled = false;
  398. lblUpdateDisabled.Visible = true;
  399. }
  400. }
  401. private void GetFootprint()
  402. {
  403. ByteSize footprint = CleanHelper.CheckFootprint();
  404. lblFootprint.Text = footprint.ToString();
  405. }
  406. private void GetFeed()
  407. {
  408. WebClient client = new WebClient
  409. {
  410. Encoding = Encoding.UTF8
  411. };
  412. try
  413. {
  414. string feed = client.DownloadString(_feedLink);
  415. AppsFromFeed = JsonConvert.DeserializeObject<List<FeedApp>>(feed);
  416. // UI handling
  417. btnDownloadApps.Enabled = true;
  418. txtFeedError.Visible = false;
  419. }
  420. catch (Exception ex)
  421. {
  422. btnDownloadApps.Enabled = false;
  423. txtFeedError.Visible = true;
  424. ErrorLogger.LogError("MainForm.GetFeed", ex.Message, ex.StackTrace);
  425. }
  426. }
  427. private void CleanPC()
  428. {
  429. try
  430. {
  431. if (checkTemp.Checked)
  432. {
  433. CleanHelper.CleanTemporaries();
  434. }
  435. if (checkMiniDumps.Checked)
  436. {
  437. CleanHelper.CleanMiniDumps();
  438. }
  439. if (checkMediaCache.Checked)
  440. {
  441. CleanHelper.CleanMediaPlayersCache();
  442. }
  443. if (checkLogs.Checked)
  444. {
  445. CleanHelper.CleanLogs();
  446. }
  447. if (checkErrorReports.Checked)
  448. {
  449. CleanHelper.CleanErrorReports();
  450. }
  451. if (checkBin.Checked)
  452. {
  453. CleanHelper.EmptyRecycleBin();
  454. }
  455. }
  456. catch (Exception ex)
  457. {
  458. ErrorLogger.LogError("MainForm.CleanPC", ex.Message, ex.StackTrace);
  459. }
  460. finally
  461. {
  462. Cleaning(false);
  463. GetFootprint();
  464. }
  465. }
  466. private bool FixRegistry()
  467. {
  468. bool changeDetected = false;
  469. try
  470. {
  471. if (checkFirewall.Checked)
  472. {
  473. Utilities.EnableFirewall();
  474. changeDetected = true;
  475. }
  476. if (checkCommandPrompt.Checked)
  477. {
  478. Utilities.EnableCommandPrompt();
  479. changeDetected = true;
  480. }
  481. if (checkControlPanel.Checked)
  482. {
  483. Utilities.EnableControlPanel();
  484. changeDetected = true;
  485. }
  486. if (checkFolderOptions.Checked)
  487. {
  488. Utilities.EnableFolderOptions();
  489. changeDetected = true;
  490. }
  491. if (checkRunDialog.Checked)
  492. {
  493. Utilities.EnableRunDialog();
  494. changeDetected = true;
  495. }
  496. if (checkContextMenu.Checked)
  497. {
  498. Utilities.EnableContextMenu();
  499. changeDetected = true;
  500. }
  501. if (checkTaskManager.Checked)
  502. {
  503. Utilities.EnableTaskManager();
  504. changeDetected = true;
  505. }
  506. if (checkRegistryEditor.Checked)
  507. {
  508. Utilities.EnableRegistryEditor();
  509. changeDetected = true;
  510. }
  511. }
  512. catch (Exception ex)
  513. {
  514. ErrorLogger.LogError("MainForm.FixRegistry", ex.Message, ex.StackTrace);
  515. }
  516. return changeDetected;
  517. }
  518. private void LoadUniversalToggleStates()
  519. {
  520. toggleSwitch1.Checked = Options.CurrentOptions.EnablePerformanceTweaks;
  521. toggleSwitch2.Checked = Options.CurrentOptions.DisableNetworkThrottling;
  522. toggleSwitch3.Checked = Options.CurrentOptions.DisableWindowsDefender;
  523. toggleSwitch4.Checked = Options.CurrentOptions.DisableSystemRestore;
  524. toggleSwitch5.Checked = Options.CurrentOptions.DisablePrintService;
  525. toggleSwitch6.Checked = Options.CurrentOptions.DisableMediaPlayerSharing;
  526. toggleSwitch8.Checked = Options.CurrentOptions.DisableErrorReporting;
  527. toggleSwitch9.Checked = Options.CurrentOptions.DisableHomeGroup;
  528. toggleSwitch10.Checked = Options.CurrentOptions.DisableSuperfetch;
  529. toggleSwitch11.Checked = Options.CurrentOptions.DisableTelemetryTasks;
  530. toggleSwitch12.Checked = Options.CurrentOptions.DisableOffice2016Telemetry;
  531. toggleSwitch32.Checked = Options.CurrentOptions.DisableCompatibilityAssistant;
  532. toggleSwitch33.Checked = Options.CurrentOptions.DisableFaxService;
  533. toggleSwitch36.Checked = Options.CurrentOptions.DisableSmartScreen;
  534. toggleSwitch38.Checked = Options.CurrentOptions.DisableStickyKeys;
  535. }
  536. private void LoadWindowsVIIIToggleStates()
  537. {
  538. toggleSwitch31.Checked = Options.CurrentOptions.DisableOneDrive;
  539. }
  540. private void LoadWindowsXToggleStates()
  541. {
  542. toggleSwitch13.Checked = Options.CurrentOptions.EnableLegacyVolumeSlider;
  543. toggleSwitch14.Checked = Options.CurrentOptions.UninstallOneDrive;
  544. toggleSwitch15.Checked = Options.CurrentOptions.DisableGameBar;
  545. toggleSwitch16.Checked = Options.CurrentOptions.DisableCortana;
  546. toggleSwitch17.Checked = Options.CurrentOptions.DisableXboxLive;
  547. toggleSwitch18.Checked = Options.CurrentOptions.DisableQuickAccessHistory;
  548. toggleSwitch19.Checked = Options.CurrentOptions.EnableTaskbarColor;
  549. toggleSwitch20.Checked = Options.CurrentOptions.DisableSensorServices;
  550. toggleSwitch21.Checked = Options.CurrentOptions.DisablePrivacyOptions;
  551. toggleSwitch23.Checked = Options.CurrentOptions.DisableTelemetryServices;
  552. toggleSwitch24.Checked = Options.CurrentOptions.DisableAutomaticUpdates;
  553. toggleSwitch25.Checked = Options.CurrentOptions.DisableMyPeople;
  554. toggleSwitch26.Checked = Options.CurrentOptions.DisableStartMenuAds;
  555. toggleSwitch27.Checked = Options.CurrentOptions.EnableDarkTheme;
  556. toggleSwitch28.Checked = Options.CurrentOptions.DisableSpellingTyping;
  557. toggleSwitch29.Checked = Options.CurrentOptions.DisableWindowsInk;
  558. toggleSwitch30.Checked = Options.CurrentOptions.ExcludeDrivers;
  559. toggleSwitch34.Checked = Options.CurrentOptions.DisableInsiderService;
  560. toggleSwitch35.Checked = Options.CurrentOptions.DisableFeatureUpdates;
  561. toggleSwitch37.Checked = Options.CurrentOptions.DisableCloudClipboard;
  562. toggleSwitch39.Checked = Options.CurrentOptions.EnableLongPaths;
  563. toggleSwitch40.Checked = Options.CurrentOptions.RemoveCastToDevice;
  564. toggleSwitch7.Checked = Options.CurrentOptions.DisableActionCenter;
  565. }
  566. private void Main_Load(object sender, EventArgs e)
  567. {
  568. }
  569. private void GetDesktopItems()
  570. {
  571. _desktopItems = Integrator.GetDesktopItems();
  572. listDesktopItems.Items.Clear();
  573. for (int i = 0; i < _desktopItems.Count; i++)
  574. {
  575. if (!string.IsNullOrEmpty(_desktopItems[i]))
  576. {
  577. listDesktopItems.Items.Add(_desktopItems[i]);
  578. }
  579. }
  580. }
  581. private void GetHostsEntries()
  582. {
  583. ((Control)this.hostsEditorTab).Enabled = false;
  584. _hostsEntries = HostsHelper.GetHostsEntries();
  585. listHostEntries.Items.Clear();
  586. listHostEntries.Items.AddRange(_hostsEntries.ToArray());
  587. chkReadOnly.Checked = HostsHelper.GetReadOnly();
  588. button47.Enabled = !chkReadOnly.Checked;
  589. button46.Enabled = !chkReadOnly.Checked;
  590. button42.Enabled = !chkReadOnly.Checked;
  591. button41.Enabled = !chkReadOnly.Checked;
  592. linkLabel4.Enabled = !chkReadOnly.Checked;
  593. chkBlock.Enabled = !chkReadOnly.Checked;
  594. txtDomain.Enabled = !chkReadOnly.Checked;
  595. txtIP.Enabled = !chkReadOnly.Checked;
  596. button1.Enabled = !chkReadOnly.Checked;
  597. button2.Enabled = !chkReadOnly.Checked;
  598. button3.Enabled = !chkReadOnly.Checked;
  599. button4.Enabled = !chkReadOnly.Checked;
  600. ((Control)this.hostsEditorTab).Enabled = true;
  601. }
  602. private void GetStartupItems()
  603. {
  604. _startUpItems = Utilities.GetStartupItems();
  605. listStartupItems.Items.Clear();
  606. for (int i = 0; i < _startUpItems.Count; i++)
  607. {
  608. ListViewItem list = new ListViewItem(_startUpItems[i].Name);
  609. list.SubItems.Add(_startUpItems[i].FileLocation);
  610. list.SubItems.Add(_startUpItems[i].ToString());
  611. listStartupItems.Items.Add(list);
  612. }
  613. }
  614. private void GetModernApps(bool showAll)
  615. {
  616. button74.Enabled = false;
  617. button75.Enabled = false;
  618. listModernApps.Enabled = false;
  619. listModernApps.Items.Clear();
  620. _modernApps = Utilities.GetModernApps(showAll);
  621. foreach (string x in _modernApps)
  622. {
  623. listModernApps.Items.Add(x);
  624. }
  625. button74.Enabled = true;
  626. button75.Enabled = true;
  627. listModernApps.Enabled = true;
  628. }
  629. private async void UninstallModernApps()
  630. {
  631. string selectedApps = string.Empty;
  632. if (listModernApps.CheckedItems.Count > 0)
  633. {
  634. foreach (string x in listModernApps.CheckedItems)
  635. {
  636. if (string.IsNullOrEmpty(selectedApps))
  637. {
  638. selectedApps = x;
  639. }
  640. else
  641. {
  642. selectedApps += Environment.NewLine + x;
  643. }
  644. }
  645. if (MessageBox.Show(_removeModernAppsMessage + "\n\n" + selectedApps, "Optimizer", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  646. {
  647. button74.Enabled = false;
  648. button75.Enabled = false;
  649. listModernApps.Enabled = false;
  650. bool errorOccured = false;
  651. string failedApps = string.Empty;
  652. foreach (string app in listModernApps.CheckedItems)
  653. {
  654. await Task.Run(() => errorOccured = Utilities.UninstallModernApp(app));
  655. if (errorOccured)
  656. {
  657. failedApps += Environment.NewLine + app;
  658. }
  659. }
  660. if (!string.IsNullOrEmpty(failedApps))
  661. {
  662. MessageBox.Show(_errorModernAppsMessage + failedApps, "Optimizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
  663. }
  664. GetModernApps(!chkOnlyRemovable.Checked);
  665. }
  666. }
  667. }
  668. private void GetCustomCommands()
  669. {
  670. _customCommands = Integrator.GetCustomCommands();
  671. listCustomCommands.Items.Clear();
  672. foreach (string s in _customCommands)
  673. {
  674. listCustomCommands.Items.Add(s);
  675. }
  676. }
  677. private void Main_FormClosing(object sender, FormClosingEventArgs e)
  678. {
  679. if (_trayMenu)
  680. {
  681. e.Cancel = true;
  682. this.Hide();
  683. }
  684. else
  685. {
  686. Options.CurrentOptions.AppsFolder = txtDownloadFolder.Text;
  687. Options.SaveSettings();
  688. }
  689. }
  690. private void button39_Click(object sender, EventArgs e)
  691. {
  692. HelperForm f = new HelperForm(this, MessageType.Restart, _restartMessage);
  693. f.ShowDialog();
  694. }
  695. private void button43_Click(object sender, EventArgs e)
  696. {
  697. HelperForm f = new HelperForm(this, MessageType.Restart, _restartMessage);
  698. f.ShowDialog();
  699. }
  700. private void button44_Click(object sender, EventArgs e)
  701. {
  702. HelperForm f = new HelperForm(this, MessageType.Restart, _restartMessage);
  703. f.ShowDialog();
  704. }
  705. private void button45_Click(object sender, EventArgs e)
  706. {
  707. HelperForm f = new HelperForm(this, MessageType.Restart, _restartMessage);
  708. f.ShowDialog();
  709. }
  710. private void button18_Click(object sender, EventArgs e)
  711. {
  712. EdgeForm f = new EdgeForm();
  713. f.ShowDialog();
  714. }
  715. private void checkSelectAll_CheckedChanged(object sender, EventArgs e)
  716. {
  717. checkTemp.Checked = checkSelectAll.Checked;
  718. checkMiniDumps.Checked = checkSelectAll.Checked;
  719. checkMediaCache.Checked = checkSelectAll.Checked;
  720. checkLogs.Checked = checkSelectAll.Checked;
  721. checkBin.Checked = checkSelectAll.Checked;
  722. checkErrorReports.Checked = checkSelectAll.Checked;
  723. }
  724. private void button20_Click(object sender, EventArgs e)
  725. {
  726. Cleaning(true);
  727. Task t = new Task(() => CleanPC());
  728. t.Start();
  729. }
  730. private void Cleaning(bool enabled)
  731. {
  732. button20.Enabled = !enabled;
  733. button20.Text = (enabled) ? "..." : "Clean";
  734. }
  735. private void button32_Click(object sender, EventArgs e)
  736. {
  737. if (listStartupItems.SelectedItems.Count == 1)
  738. {
  739. _startUpItems[listStartupItems.SelectedIndices[0]].Remove();
  740. GetStartupItems();
  741. }
  742. }
  743. internal void RemoveAllStartupItems()
  744. {
  745. foreach (ListViewItem i in listStartupItems.Items)
  746. {
  747. _startUpItems[i.Index].Remove();
  748. }
  749. GetStartupItems();
  750. }
  751. private void button22_Click(object sender, EventArgs e)
  752. {
  753. if (listStartupItems.Items.Count > 0)
  754. {
  755. HelperForm r = new HelperForm(this, MessageType.Startup, _removeStartupItemsMessage);
  756. r.ShowDialog(this);
  757. }
  758. }
  759. private void button31_Click(object sender, EventArgs e)
  760. {
  761. if (listStartupItems.SelectedItems.Count == 1)
  762. {
  763. _startUpItems[listStartupItems.SelectedIndices[0]].LocateFile();
  764. }
  765. }
  766. private void checkEnableAll_CheckedChanged(object sender, EventArgs e)
  767. {
  768. checkTaskManager.Checked = checkEnableAll.Checked;
  769. checkCommandPrompt.Checked = checkEnableAll.Checked;
  770. checkControlPanel.Checked = checkEnableAll.Checked;
  771. checkFolderOptions.Checked = checkEnableAll.Checked;
  772. checkRunDialog.Checked = checkEnableAll.Checked;
  773. checkContextMenu.Checked = checkEnableAll.Checked;
  774. checkFirewall.Checked = checkEnableAll.Checked;
  775. checkRegistryEditor.Checked = checkEnableAll.Checked;
  776. }
  777. private void button33_Click(object sender, EventArgs e)
  778. {
  779. bool flag = FixRegistry();
  780. if (flag)
  781. {
  782. panel2.Enabled = false;
  783. button33.Enabled = false;
  784. if (checkRestartExplorer.Checked)
  785. {
  786. Utilities.RestartExplorer();
  787. }
  788. panel2.Enabled = true;
  789. button33.Enabled = true;
  790. }
  791. }
  792. private void pictureBox1_Click(object sender, EventArgs e)
  793. {
  794. AboutForm f = new AboutForm();
  795. f.ShowDialog(this);
  796. }
  797. private void button37_Click(object sender, EventArgs e)
  798. {
  799. GetStartupItems();
  800. }
  801. private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  802. {
  803. HostsHelper.LocateHosts();
  804. }
  805. private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  806. {
  807. HostsEditorForm f = new HostsEditorForm();
  808. f.ShowDialog(this);
  809. GetHostsEntries();
  810. }
  811. private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  812. {
  813. HostsHelper.RestoreDefaultHosts();
  814. GetHostsEntries();
  815. }
  816. private void button47_Click(object sender, EventArgs e)
  817. {
  818. if ((txtIP.Text != string.Empty) && (txtDomain.Text != string.Empty))
  819. {
  820. string ip = txtIP.Text.Trim();
  821. string domain = txtDomain.Text.Trim();
  822. string recommendedDomain = string.Empty;
  823. if (!domain.StartsWith("www."))
  824. {
  825. recommendedDomain = "www." + domain;
  826. }
  827. else
  828. {
  829. recommendedDomain = domain.Replace("www.", string.Empty);
  830. }
  831. HostsHelper.AddEntry(HostsHelper.SanitizeEntry(ip) + " " + HostsHelper.SanitizeEntry(domain));
  832. if (!string.IsNullOrEmpty(recommendedDomain))
  833. {
  834. HostsHelper.AddEntry(HostsHelper.SanitizeEntry(ip) + " " + HostsHelper.SanitizeEntry(recommendedDomain));
  835. }
  836. GetHostsEntries();
  837. txtIP.Clear();
  838. txtDomain.Clear();
  839. chkBlock.Checked = false;
  840. }
  841. }
  842. private void button41_Click(object sender, EventArgs e)
  843. {
  844. GetHostsEntries();
  845. }
  846. private void button42_Click(object sender, EventArgs e)
  847. {
  848. if (listHostEntries.SelectedItems.Count == 1)
  849. {
  850. HostsHelper.RemoveEntry(listHostEntries.SelectedItem.ToString().Replace(" : ", " "));
  851. GetHostsEntries();
  852. }
  853. }
  854. private void button46_Click(object sender, EventArgs e)
  855. {
  856. if (listHostEntries.Items.Count > 0)
  857. {
  858. HelperForm r = new HelperForm(this, MessageType.Hosts, _removeHostsEntriesMessage);
  859. r.ShowDialog(this);
  860. }
  861. }
  862. internal void RemoveAllHostsEntries()
  863. {
  864. List<string> collection = new List<string>();
  865. foreach (string item in listHostEntries.Items)
  866. {
  867. collection.Add(item.Replace(" : ", " "));
  868. }
  869. HostsHelper.RemoveAllEntries(collection);
  870. GetHostsEntries();
  871. }
  872. private void aio_SelectedIndexChanged(object sender, EventArgs e)
  873. {
  874. if (tabCollection.SelectedTab == hostsEditorTab) txtIP.Focus();
  875. if (tabCollection.SelectedTab == pingerTab) txtPingInput.Focus();
  876. }
  877. private void button48_Click(object sender, EventArgs e)
  878. {
  879. defineCommandDialog.ShowDialog();
  880. }
  881. private void button50_Click(object sender, EventArgs e)
  882. {
  883. if (!string.IsNullOrEmpty(txtRunFile.Text) && !string.IsNullOrEmpty(txtRunKeyword.Text))
  884. {
  885. Integrator.CreateCustomCommand(txtRunFile.Text, txtRunKeyword.Text);
  886. txtRunFile.Clear();
  887. txtRunKeyword.Clear();
  888. GetCustomCommands();
  889. }
  890. }
  891. private void DefineCmd_FileOk(object sender, CancelEventArgs e)
  892. {
  893. txtRunFile.Text = defineCommandDialog.FileName;
  894. txtRunKeyword.Text = Path.GetFileNameWithoutExtension(txtRunFile.Text).ToLower();
  895. }
  896. private void button58_Click(object sender, EventArgs e)
  897. {
  898. InfoForm r = new InfoForm(Integrator.powerinfo);
  899. r.ShowDialog(this);
  900. }
  901. private void button56_Click(object sender, EventArgs e)
  902. {
  903. InfoForm r = new InfoForm(Integrator.systemtoolsinfo);
  904. r.ShowDialog(this);
  905. }
  906. private void button52_Click(object sender, EventArgs e)
  907. {
  908. InfoForm r = new InfoForm(Integrator.windowsappsinfo);
  909. r.ShowDialog(this);
  910. }
  911. private void button49_Click(object sender, EventArgs e)
  912. {
  913. InfoForm r = new InfoForm(Integrator.systemshortcutsinfo);
  914. r.ShowDialog(this);
  915. }
  916. private void button55_Click(object sender, EventArgs e)
  917. {
  918. InfoForm r = new InfoForm(Integrator.desktopshortcutsinfo);
  919. r.ShowDialog(this);
  920. }
  921. private void button59_Click(object sender, EventArgs e)
  922. {
  923. Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\PowerMenu.reg");
  924. GetDesktopItems();
  925. }
  926. private void button53_Click(object sender, EventArgs e)
  927. {
  928. Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\SystemTools.reg");
  929. GetDesktopItems();
  930. }
  931. private void button54_Click(object sender, EventArgs e)
  932. {
  933. Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\WindowsApps.reg");
  934. GetDesktopItems();
  935. }
  936. private void button51_Click(object sender, EventArgs e)
  937. {
  938. Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\SystemShortcuts.reg");
  939. GetDesktopItems();
  940. }
  941. private void button57_Click(object sender, EventArgs e)
  942. {
  943. Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\DesktopShortcuts.reg");
  944. GetDesktopItems();
  945. }
  946. private void button60_Click(object sender, EventArgs e)
  947. {
  948. GetDesktopItems();
  949. }
  950. private void button61_Click(object sender, EventArgs e)
  951. {
  952. if (listDesktopItems.SelectedItems.Count == 1)
  953. {
  954. Integrator.RemoveItem(listDesktopItems.SelectedItem.ToString());
  955. GetDesktopItems();
  956. }
  957. }
  958. internal void RemoveAllDesktopItems()
  959. {
  960. List<string> collection = new List<string>();
  961. foreach (string item in listDesktopItems.Items)
  962. {
  963. collection.Add(item);
  964. }
  965. Integrator.RemoveAllItems(collection);
  966. GetDesktopItems();
  967. }
  968. private void button62_Click(object sender, EventArgs e)
  969. {
  970. if (listDesktopItems.Items.Count > 0)
  971. {
  972. HelperForm r = new HelperForm(this, MessageType.Integrator, _removeDesktopItemsMessage);
  973. r.ShowDialog(this);
  974. }
  975. }
  976. private void radioProgram_CheckedChanged(object sender, EventArgs e)
  977. {
  978. if (radioProgram.Checked)
  979. {
  980. btnBrowseItem.Enabled = true;
  981. txtItem.Clear();
  982. checkDefaultIcon.Checked = true;
  983. txtIcon.Enabled = false;
  984. btnBrowseIcon.Enabled = false;
  985. itemtoaddgroup.Text = "Program to add:";
  986. checkDefaultIcon.Visible = true;
  987. checkDefaultIcon.Text = "Use program's icon";
  988. txtItemName.Clear();
  989. txtItem.ReadOnly = true;
  990. txtIcon.ReadOnly = true;
  991. _desktopItemType = DesktopItemType.Program;
  992. }
  993. }
  994. private void radioFolder_CheckedChanged(object sender, EventArgs e)
  995. {
  996. if (radioFolder.Checked)
  997. {
  998. checkDefaultIcon.Checked = true;
  999. btnBrowseItem.Enabled = true;
  1000. txtItem.Clear();
  1001. itemtoaddgroup.Text = "Folder to add:";
  1002. checkDefaultIcon.Text = "Use default folder icon";
  1003. txtItemName.Clear();
  1004. txtItem.ReadOnly = true;
  1005. txtIcon.ReadOnly = true;
  1006. _desktopItemType = DesktopItemType.Folder;
  1007. }
  1008. }
  1009. private void radioLink_CheckedChanged(object sender, EventArgs e)
  1010. {
  1011. if (radioLink.Checked)
  1012. {
  1013. checkDefaultIcon.Checked = true;
  1014. checkDefaultIcon.Text = "Download website icon (favicon)";
  1015. btnBrowseItem.Enabled = false;
  1016. itemtoaddgroup.Text = "Web address to add:";
  1017. checkDefaultIcon.Visible = true;
  1018. txtItem.Text = "http://";
  1019. txtItemName.Clear();
  1020. txtItem.ReadOnly = false;
  1021. txtIcon.ReadOnly = true;
  1022. _desktopItemType = DesktopItemType.Link;
  1023. }
  1024. }
  1025. private void radioFile_CheckedChanged(object sender, EventArgs e)
  1026. {
  1027. if (radioFile.Checked)
  1028. {
  1029. checkDefaultIcon.Checked = true;
  1030. checkDefaultIcon.Text = "No icon";
  1031. btnBrowseItem.Enabled = true;
  1032. itemtoaddgroup.Text = "File to add:";
  1033. checkDefaultIcon.Visible = true;
  1034. txtItem.Clear();
  1035. txtItemName.Clear();
  1036. txtItem.ReadOnly = true;
  1037. txtIcon.ReadOnly = true;
  1038. _desktopItemType = DesktopItemType.File;
  1039. }
  1040. }
  1041. private void radioCommand_CheckedChanged(object sender, EventArgs e)
  1042. {
  1043. if (radioCommand.Checked)
  1044. {
  1045. btnBrowseItem.Enabled = false;
  1046. txtItem.Clear();
  1047. checkDefaultIcon.Checked = true;
  1048. txtIcon.Enabled = false;
  1049. btnBrowseIcon.Enabled = false;
  1050. itemtoaddgroup.Text = "Command to add:";
  1051. checkDefaultIcon.Visible = true;
  1052. checkDefaultIcon.Text = "No icon";
  1053. txtItemName.Clear();
  1054. txtItem.ReadOnly = false;
  1055. txtIcon.ReadOnly = true;
  1056. _desktopItemType = DesktopItemType.Command;
  1057. }
  1058. }
  1059. private void checkDefaultIcon_CheckedChanged(object sender, EventArgs e)
  1060. {
  1061. if (checkDefaultIcon.Checked)
  1062. {
  1063. txtIcon.Clear();
  1064. txtIcon.Enabled = false;
  1065. btnBrowseIcon.Enabled = false;
  1066. }
  1067. else
  1068. {
  1069. txtIcon.Clear();
  1070. txtIcon.Enabled = true;
  1071. btnBrowseIcon.Enabled = true;
  1072. }
  1073. }
  1074. private void btnBrowseItem_Click(object sender, EventArgs e)
  1075. {
  1076. switch (_desktopItemType)
  1077. {
  1078. case DesktopItemType.Program:
  1079. defineProgramDialog.ShowDialog();
  1080. break;
  1081. case DesktopItemType.Folder:
  1082. defineFolderDialog.ShowDialog();
  1083. txtItem.Text = defineFolderDialog.SelectedPath;
  1084. int i = defineFolderDialog.SelectedPath.LastIndexOf("\\");
  1085. txtItemName.Text = defineFolderDialog.SelectedPath.Remove(0, i + 1);
  1086. break;
  1087. case DesktopItemType.File:
  1088. defineFileDialog.ShowDialog();
  1089. break;
  1090. }
  1091. }
  1092. private void DefineProgramDialog_FileOk(object sender, CancelEventArgs e)
  1093. {
  1094. txtItem.Text = defineProgramDialog.FileName;
  1095. txtItemName.Text = defineProgramDialog.SafeFileName.Replace(".exe", string.Empty);
  1096. }
  1097. private void DefineFileDialog_FileOk(object sender, CancelEventArgs e)
  1098. {
  1099. txtItem.Text = defineFileDialog.FileName;
  1100. txtItemName.Text = defineFileDialog.SafeFileName;
  1101. }
  1102. private void btnBrowseIcon_Click(object sender, EventArgs e)
  1103. {
  1104. switch (_desktopItemType)
  1105. {
  1106. case DesktopItemType.Program:
  1107. DefineProgramIconDialog.ShowDialog();
  1108. break;
  1109. case DesktopItemType.Folder:
  1110. DefineFolderIconDialog.ShowDialog();
  1111. break;
  1112. case DesktopItemType.Link:
  1113. DefineURLIconDialog.ShowDialog();
  1114. break;
  1115. case DesktopItemType.File:
  1116. DefineFileIconDialog.ShowDialog();
  1117. break;
  1118. case DesktopItemType.Command:
  1119. DefineCommandIconDialog.ShowDialog();
  1120. break;
  1121. }
  1122. }
  1123. private void DefineProgramIconDialog_FileOk(object sender, CancelEventArgs e)
  1124. {
  1125. txtIcon.Text = DefineProgramIconDialog.FileName;
  1126. if (txtIcon.Text.Contains(".exe"))
  1127. {
  1128. string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineProgramIconDialog.FileName);
  1129. txtIcon.Text = iconpath;
  1130. }
  1131. }
  1132. private void DefineFolderIconDialog_FileOk(object sender, CancelEventArgs e)
  1133. {
  1134. txtIcon.Text = DefineFolderIconDialog.FileName;
  1135. if (txtIcon.Text.Contains(".exe"))
  1136. {
  1137. string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineFolderIconDialog.FileName);
  1138. txtIcon.Text = iconpath;
  1139. }
  1140. }
  1141. private void DefineURLIconDialog_FileOk(object sender, CancelEventArgs e)
  1142. {
  1143. txtIcon.Text = DefineURLIconDialog.FileName;
  1144. if (txtIcon.Text.Contains(".exe"))
  1145. {
  1146. string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineURLIconDialog.FileName);
  1147. txtIcon.Text = iconpath;
  1148. }
  1149. }
  1150. private void DefineFileIconDialog_FileOk(object sender, CancelEventArgs e)
  1151. {
  1152. txtIcon.Text = DefineFileIconDialog.FileName;
  1153. if (txtIcon.Text.Contains(".exe"))
  1154. {
  1155. string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineFileIconDialog.FileName);
  1156. txtIcon.Text = iconpath;
  1157. }
  1158. }
  1159. private void DefineCommandIconDialog_FileOk(object sender, CancelEventArgs e)
  1160. {
  1161. txtIcon.Text = DefineCommandIconDialog.FileName;
  1162. if (txtIcon.Text.Contains(".exe"))
  1163. {
  1164. string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineCommandIconDialog.FileName);
  1165. txtIcon.Text = iconpath;
  1166. }
  1167. }
  1168. private void btnAddItem_Click(object sender, EventArgs e)
  1169. {
  1170. if (!checkDefaultIcon.Checked && (string.IsNullOrEmpty(txtItem.Text) || string.IsNullOrEmpty(txtItemName.Text) || string.IsNullOrEmpty(txtIcon.Text)))
  1171. {
  1172. return;
  1173. }
  1174. if (checkDefaultIcon.Checked && (string.IsNullOrEmpty(txtItem.Text) || string.IsNullOrEmpty(txtItemName.Text)))
  1175. {
  1176. return;
  1177. }
  1178. string icon = string.Empty;
  1179. switch (_desktopItemType)
  1180. {
  1181. case DesktopItemType.Program:
  1182. if (checkDefaultIcon.Checked)
  1183. {
  1184. icon = txtItem.Text;
  1185. }
  1186. else
  1187. {
  1188. icon = txtIcon.Text;
  1189. }
  1190. Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.Program);
  1191. break;
  1192. case DesktopItemType.Folder:
  1193. if (checkDefaultIcon.Checked)
  1194. {
  1195. icon = Integrator.FolderDefaultIcon;
  1196. }
  1197. else
  1198. {
  1199. icon = txtIcon.Text;
  1200. }
  1201. Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.Folder);
  1202. break;
  1203. case DesktopItemType.Link:
  1204. if (checkDefaultIcon.Checked)
  1205. {
  1206. icon = Integrator.DownloadFavicon(txtItem.Text, txtItemName.Text);
  1207. }
  1208. else
  1209. {
  1210. icon = txtIcon.Text;
  1211. }
  1212. Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.Link);
  1213. break;
  1214. case DesktopItemType.File:
  1215. if (!checkDefaultIcon.Checked)
  1216. {
  1217. icon = txtIcon.Text;
  1218. }
  1219. Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.File);
  1220. break;
  1221. case DesktopItemType.Command:
  1222. if (!checkDefaultIcon.Checked)
  1223. {
  1224. icon = txtIcon.Text;
  1225. }
  1226. Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.Command);
  1227. break;
  1228. }
  1229. GetDesktopItems();
  1230. ResetIntegratorForm();
  1231. }
  1232. private void radioTop_CheckedChanged(object sender, EventArgs e)
  1233. {
  1234. if (radioTop.Checked)
  1235. {
  1236. _desktopItemPosition = DesktopTypePosition.Top;
  1237. }
  1238. }
  1239. private void radioMiddle_CheckedChanged(object sender, EventArgs e)
  1240. {
  1241. if (radioMiddle.Checked)
  1242. {
  1243. _desktopItemPosition = DesktopTypePosition.Middle;
  1244. }
  1245. }
  1246. private void radioBottom_CheckedChanged(object sender, EventArgs e)
  1247. {
  1248. if (radioBottom.Checked)
  1249. {
  1250. _desktopItemPosition = DesktopTypePosition.Bottom;
  1251. }
  1252. }
  1253. private void ResetIntegratorForm()
  1254. {
  1255. txtItem.Clear();
  1256. txtIcon.Clear();
  1257. checkDefaultIcon.Checked = true;
  1258. txtItemName.Clear();
  1259. if (radioLink.Checked)
  1260. {
  1261. txtItem.Text = "http://";
  1262. }
  1263. }
  1264. private void radioOcean_CheckedChanged(object sender, EventArgs e)
  1265. {
  1266. Options.CurrentOptions.Color = Theme.Ocean;
  1267. Options.ApplyTheme(this);
  1268. }
  1269. private void radioMagma_CheckedChanged(object sender, EventArgs e)
  1270. {
  1271. Options.CurrentOptions.Color = Theme.Magma;
  1272. Options.ApplyTheme(this);
  1273. }
  1274. private void radioZerg_CheckedChanged(object sender, EventArgs e)
  1275. {
  1276. Options.CurrentOptions.Color = Theme.Zerg;
  1277. Options.ApplyTheme(this);
  1278. }
  1279. private void radioMinimal_CheckedChanged(object sender, EventArgs e)
  1280. {
  1281. Options.CurrentOptions.Color = Theme.Minimal;
  1282. Options.ApplyTheme(this);
  1283. }
  1284. private void radioCaramel_CheckedChanged(object sender, EventArgs e)
  1285. {
  1286. Options.CurrentOptions.Color = Theme.Caramel;
  1287. Options.ApplyTheme(this);
  1288. }
  1289. private void radioLime_CheckedChanged(object sender, EventArgs e)
  1290. {
  1291. Options.CurrentOptions.Color = Theme.Lime;
  1292. Options.ApplyTheme(this);
  1293. }
  1294. private void button64_Click(object sender, EventArgs e)
  1295. {
  1296. if (listStartupItems.SelectedItems.Count == 1)
  1297. {
  1298. _startUpItems[listStartupItems.SelectedIndices[0]].LocateKey();
  1299. }
  1300. }
  1301. private void button66_Click(object sender, EventArgs e)
  1302. {
  1303. Integrator.TakeOwnership(false);
  1304. }
  1305. private void button65_Click(object sender, EventArgs e)
  1306. {
  1307. Integrator.TakeOwnership(true);
  1308. }
  1309. private void listStartupItems_ColumnClick(object sender, ColumnClickEventArgs e)
  1310. {
  1311. if (e.Column == _columnSorter.CurrentColumn)
  1312. {
  1313. if (_columnSorter.SortOrder == SortOrder.Ascending)
  1314. {
  1315. _columnSorter.SortOrder = SortOrder.Descending;
  1316. }
  1317. else
  1318. {
  1319. _columnSorter.SortOrder = SortOrder.Ascending;
  1320. }
  1321. }
  1322. else
  1323. {
  1324. _columnSorter.CurrentColumn = e.Column;
  1325. _columnSorter.SortOrder = SortOrder.Ascending;
  1326. }
  1327. listStartupItems.Sort();
  1328. }
  1329. private void chkBlock_CheckedChanged(object sender, EventArgs e)
  1330. {
  1331. if (chkBlock.Checked)
  1332. {
  1333. txtIP.Text = _blockedIP;
  1334. txtIP.Enabled = false;
  1335. }
  1336. else
  1337. {
  1338. txtIP.Clear();
  1339. txtIP.Enabled = true;
  1340. }
  1341. }
  1342. private void button8_Click(object sender, EventArgs e)
  1343. {
  1344. GetCustomCommands();
  1345. }
  1346. private void button26_Click(object sender, EventArgs e)
  1347. {
  1348. if (listCustomCommands.SelectedItems.Count == 1)
  1349. {
  1350. Integrator.DeleteCustomCommand(listCustomCommands.SelectedItem.ToString());
  1351. GetCustomCommands();
  1352. }
  1353. }
  1354. private void button75_Click(object sender, EventArgs e)
  1355. {
  1356. GetModernApps(!chkOnlyRemovable.Checked);
  1357. }
  1358. private void button74_Click(object sender, EventArgs e)
  1359. {
  1360. UninstallModernApps();
  1361. }
  1362. private void chkSelectAllModernApps_CheckedChanged(object sender, EventArgs e)
  1363. {
  1364. for (int i = 0; i < listModernApps.Items.Count; i++)
  1365. {
  1366. listModernApps.SetItemChecked(i, chkSelectAllModernApps.Checked);
  1367. }
  1368. }
  1369. private void btnResetConfig_Click(object sender, EventArgs e)
  1370. {
  1371. if (MessageBox.Show(_resetMessage, "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  1372. {
  1373. Utilities.ResetConfiguration();
  1374. }
  1375. }
  1376. private void toggleSwitch1_Click(object sender, EventArgs e)
  1377. {
  1378. if (!toggleSwitch1.Checked)
  1379. {
  1380. Optimize.EnablePerformanceTweaks();
  1381. }
  1382. else
  1383. {
  1384. Optimize.DisablePerformanceTweaks();
  1385. }
  1386. Options.CurrentOptions.EnablePerformanceTweaks = !toggleSwitch1.Checked;
  1387. }
  1388. private void toggleSwitch2_Click(object sender, EventArgs e)
  1389. {
  1390. if (!toggleSwitch2.Checked)
  1391. {
  1392. Optimize.DisableNetworkThrottling();
  1393. }
  1394. else
  1395. {
  1396. Optimize.EnableNetworkThrottling();
  1397. }
  1398. Options.CurrentOptions.DisableNetworkThrottling = !toggleSwitch2.Checked;
  1399. }
  1400. private void toggleSwitch3_Click(object sender, EventArgs e)
  1401. {
  1402. if (!toggleSwitch3.Checked)
  1403. {
  1404. Optimize.DisableDefender();
  1405. }
  1406. else
  1407. {
  1408. Optimize.EnableDefender();
  1409. }
  1410. Options.CurrentOptions.DisableWindowsDefender = !toggleSwitch3.Checked;
  1411. }
  1412. private void toggleSwitch4_Click(object sender, EventArgs e)
  1413. {
  1414. if (!toggleSwitch4.Checked)
  1415. {
  1416. Optimize.DisableSystemRestore();
  1417. }
  1418. else
  1419. {
  1420. Optimize.EnableSystemRestore();
  1421. }
  1422. Options.CurrentOptions.DisableSystemRestore = !toggleSwitch4.Checked;
  1423. }
  1424. private void toggleSwitch5_Click(object sender, EventArgs e)
  1425. {
  1426. if (!toggleSwitch5.Checked)
  1427. {
  1428. Optimize.DisablePrintService();
  1429. }
  1430. else
  1431. {
  1432. Optimize.EnablePrintService();
  1433. }
  1434. Options.CurrentOptions.DisablePrintService = !toggleSwitch5.Checked;
  1435. }
  1436. private void toggleSwitch6_Click(object sender, EventArgs e)
  1437. {
  1438. if (!toggleSwitch6.Checked)
  1439. {
  1440. Optimize.DisableMediaPlayerSharing();
  1441. }
  1442. else
  1443. {
  1444. Optimize.EnableMediaPlayerSharing();
  1445. }
  1446. Options.CurrentOptions.DisableMediaPlayerSharing = !toggleSwitch6.Checked;
  1447. }
  1448. private void toggleSwitch8_Click(object sender, EventArgs e)
  1449. {
  1450. if (!toggleSwitch8.Checked)
  1451. {
  1452. Optimize.DisableErrorReporting();
  1453. }
  1454. else
  1455. {
  1456. Optimize.EnableErrorReporting();
  1457. }
  1458. Options.CurrentOptions.DisableErrorReporting = !toggleSwitch8.Checked;
  1459. }
  1460. private void toggleSwitch9_Click(object sender, EventArgs e)
  1461. {
  1462. if (!toggleSwitch9.Checked)
  1463. {
  1464. Optimize.DisableHomeGroup();
  1465. }
  1466. else
  1467. {
  1468. Optimize.EnableHomeGroup();
  1469. }
  1470. Options.CurrentOptions.DisableHomeGroup = !toggleSwitch9.Checked;
  1471. }
  1472. private void toggleSwitch10_Click(object sender, EventArgs e)
  1473. {
  1474. if (!toggleSwitch10.Checked)
  1475. {
  1476. Optimize.DisableSuperfetch();
  1477. }
  1478. else
  1479. {
  1480. Optimize.EnableSuperfetch();
  1481. }
  1482. Options.CurrentOptions.DisableSuperfetch = !toggleSwitch10.Checked;
  1483. }
  1484. private void toggleSwitch11_Click(object sender, EventArgs e)
  1485. {
  1486. if (!toggleSwitch11.Checked)
  1487. {
  1488. Optimize.DisableTelemetryTasks();
  1489. }
  1490. else
  1491. {
  1492. Optimize.EnableTelemetryTasks();
  1493. }
  1494. Options.CurrentOptions.DisableTelemetryTasks = !toggleSwitch11.Checked;
  1495. }
  1496. private void toggleSwitch12_Click(object sender, EventArgs e)
  1497. {
  1498. if (!toggleSwitch12.Checked)
  1499. {
  1500. Optimize.DisableOffice2016Telemetry();
  1501. }
  1502. else
  1503. {
  1504. Optimize.EnableOffice2016Telemetry();
  1505. }
  1506. Options.CurrentOptions.DisableOffice2016Telemetry = !toggleSwitch12.Checked;
  1507. }
  1508. private void toggleSwitch13_Click(object sender, EventArgs e)
  1509. {
  1510. if (!toggleSwitch13.Checked)
  1511. {
  1512. Optimize.EnableLegacyVolumeSlider();
  1513. }
  1514. else
  1515. {
  1516. Optimize.DisableLegacyVolumeSlider();
  1517. }
  1518. Options.CurrentOptions.EnableLegacyVolumeSlider = !toggleSwitch13.Checked;
  1519. }
  1520. private void toggleSwitch19_Click(object sender, EventArgs e)
  1521. {
  1522. if (!toggleSwitch19.Checked)
  1523. {
  1524. Optimize.EnableTaskbarColor();
  1525. }
  1526. else
  1527. {
  1528. Optimize.DisableTaskbarColor();
  1529. }
  1530. Options.CurrentOptions.EnableTaskbarColor = !toggleSwitch19.Checked;
  1531. }
  1532. private void toggleSwitch18_Click(object sender, EventArgs e)
  1533. {
  1534. if (!toggleSwitch18.Checked)
  1535. {
  1536. Optimize.DisableQuickAccessHistory();
  1537. }
  1538. else
  1539. {
  1540. Optimize.EnableQuickAccessHistory();
  1541. }
  1542. Options.CurrentOptions.DisableQuickAccessHistory = !toggleSwitch18.Checked;
  1543. }
  1544. private void toggleSwitch26_Click(object sender, EventArgs e)
  1545. {
  1546. if (!toggleSwitch26.Checked)
  1547. {
  1548. Optimize.DisableStartMenuAds();
  1549. }
  1550. else
  1551. {
  1552. Optimize.EnableStartMenuAds();
  1553. }
  1554. Options.CurrentOptions.DisableStartMenuAds = !toggleSwitch26.Checked;
  1555. }
  1556. private void toggleSwitch27_Click(object sender, EventArgs e)
  1557. {
  1558. if (!toggleSwitch27.Checked)
  1559. {
  1560. Optimize.EnableDarkTheme();
  1561. }
  1562. else
  1563. {
  1564. Optimize.EnableLightTheme();
  1565. }
  1566. Options.CurrentOptions.EnableDarkTheme = !toggleSwitch27.Checked;
  1567. }
  1568. private void toggleSwitch14_Click(object sender, EventArgs e)
  1569. {
  1570. if (!toggleSwitch14.Checked)
  1571. {
  1572. Task t = new Task(() => Optimize.UninstallOneDrive());
  1573. t.Start();
  1574. }
  1575. else
  1576. {
  1577. Task t = new Task(() => Optimize.InstallOneDrive());
  1578. t.Start();
  1579. }
  1580. Options.CurrentOptions.UninstallOneDrive = !toggleSwitch14.Checked;
  1581. }
  1582. private void toggleSwitch25_Click(object sender, EventArgs e)
  1583. {
  1584. if (!toggleSwitch25.Checked)
  1585. {
  1586. Optimize.DisableMyPeople();
  1587. }
  1588. else
  1589. {
  1590. Optimize.EnableMyPeople();
  1591. }
  1592. Options.CurrentOptions.DisableMyPeople = !toggleSwitch25.Checked;
  1593. }
  1594. private void toggleSwitch24_Click(object sender, EventArgs e)
  1595. {
  1596. if (!toggleSwitch24.Checked)
  1597. {
  1598. Optimize.DisableAutomaticUpdates();
  1599. }
  1600. else
  1601. {
  1602. Optimize.EnableAutomaticUpdates();
  1603. }
  1604. Options.CurrentOptions.DisableAutomaticUpdates = !toggleSwitch24.Checked;
  1605. }
  1606. private void toggleSwitch30_Click(object sender, EventArgs e)
  1607. {
  1608. if (!toggleSwitch30.Checked)
  1609. {
  1610. Optimize.ExcludeDrivers();
  1611. }
  1612. else
  1613. {
  1614. Optimize.IncludeDrivers();
  1615. }
  1616. Options.CurrentOptions.ExcludeDrivers = !toggleSwitch30.Checked;
  1617. }
  1618. private void toggleSwitch23_Click(object sender, EventArgs e)
  1619. {
  1620. if (!toggleSwitch23.Checked)
  1621. {
  1622. Optimize.DisableTelemetryServices();
  1623. }
  1624. else
  1625. {
  1626. Optimize.EnableTelemetryServices();
  1627. }
  1628. Options.CurrentOptions.DisableTelemetryServices = !toggleSwitch23.Checked;
  1629. }
  1630. private void toggleSwitch21_Click(object sender, EventArgs e)
  1631. {
  1632. if (!toggleSwitch21.Checked)
  1633. {
  1634. Optimize.DisablePrivacyOptions();
  1635. }
  1636. else
  1637. {
  1638. Optimize.EnablePrivacyOptions();
  1639. }
  1640. Options.CurrentOptions.DisablePrivacyOptions = !toggleSwitch21.Checked;
  1641. }
  1642. private void toggleSwitch16_Click(object sender, EventArgs e)
  1643. {
  1644. if (!toggleSwitch16.Checked)
  1645. {
  1646. Optimize.DisableCortana();
  1647. }
  1648. else
  1649. {
  1650. Optimize.EnableCortana();
  1651. }
  1652. Options.CurrentOptions.DisableCortana = !toggleSwitch16.Checked;
  1653. }
  1654. private void toggleSwitch20_Click(object sender, EventArgs e)
  1655. {
  1656. if (!toggleSwitch20.Checked)
  1657. {
  1658. Optimize.DisableSensorServices();
  1659. }
  1660. else
  1661. {
  1662. Optimize.EnableSensorServices();
  1663. }
  1664. Options.CurrentOptions.DisableSensorServices = !toggleSwitch20.Checked;
  1665. }
  1666. private void toggleSwitch29_Click(object sender, EventArgs e)
  1667. {
  1668. if (!toggleSwitch29.Checked)
  1669. {
  1670. Optimize.DisableWindowsInk();
  1671. }
  1672. else
  1673. {
  1674. Optimize.EnableWindowsInk();
  1675. }
  1676. Options.CurrentOptions.DisableWindowsInk = !toggleSwitch29.Checked;
  1677. }
  1678. private void toggleSwitch28_Click(object sender, EventArgs e)
  1679. {
  1680. if (!toggleSwitch28.Checked)
  1681. {
  1682. Optimize.DisableSpellingAndTypingFeatures();
  1683. }
  1684. else
  1685. {
  1686. Optimize.EnableSpellingAndTypingFeatures();
  1687. }
  1688. Options.CurrentOptions.DisableSpellingTyping = !toggleSwitch28.Checked;
  1689. }
  1690. private void toggleSwitch17_Click(object sender, EventArgs e)
  1691. {
  1692. if (!toggleSwitch17.Checked)
  1693. {
  1694. Optimize.DisableXboxLive();
  1695. }
  1696. else
  1697. {
  1698. Optimize.EnableXboxLive();
  1699. }
  1700. Options.CurrentOptions.DisableXboxLive = !toggleSwitch17.Checked;
  1701. }
  1702. private void toggleSwitch15_Click(object sender, EventArgs e)
  1703. {
  1704. if (!toggleSwitch15.Checked)
  1705. {
  1706. Optimize.DisableGameBar();
  1707. }
  1708. else
  1709. {
  1710. Optimize.EnableGameBar();
  1711. }
  1712. Options.CurrentOptions.DisableGameBar = !toggleSwitch15.Checked;
  1713. }
  1714. private void toggleSwitch31_Click(object sender, EventArgs e)
  1715. {
  1716. if (!toggleSwitch31.Checked)
  1717. {
  1718. Optimize.DisableOneDrive();
  1719. }
  1720. else
  1721. {
  1722. Optimize.EnableOneDrive();
  1723. }
  1724. Options.CurrentOptions.DisableOneDrive = !toggleSwitch31.Checked;
  1725. }
  1726. private void toggleSwitch32_Click(object sender, EventArgs e)
  1727. {
  1728. if (!toggleSwitch32.Checked)
  1729. {
  1730. Optimize.DisableCompatibilityAssistant();
  1731. }
  1732. else
  1733. {
  1734. Optimize.EnableCompatibilityAssistant();
  1735. }
  1736. Options.CurrentOptions.DisableCompatibilityAssistant = !toggleSwitch32.Checked;
  1737. }
  1738. private void btnUpdate_Click(object sender, EventArgs e)
  1739. {
  1740. CheckForUpdate();
  1741. }
  1742. private void btnChangelog_Click(object sender, EventArgs e)
  1743. {
  1744. try
  1745. {
  1746. Process.Start(_changelogLink);
  1747. }
  1748. catch (Exception ex)
  1749. {
  1750. ErrorLogger.LogError("MainForm.btnChangelog_Click", ex.Message, ex.StackTrace);
  1751. MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1752. }
  1753. }
  1754. private void chkReadOnly_CheckedChanged(object sender, EventArgs e)
  1755. {
  1756. HostsHelper.ReadOnly(chkReadOnly.Checked);
  1757. button47.Enabled = !chkReadOnly.Checked;
  1758. button46.Enabled = !chkReadOnly.Checked;
  1759. button42.Enabled = !chkReadOnly.Checked;
  1760. button41.Enabled = !chkReadOnly.Checked;
  1761. linkLabel4.Enabled = !chkReadOnly.Checked;
  1762. chkBlock.Enabled = !chkReadOnly.Checked;
  1763. txtDomain.Enabled = !chkReadOnly.Checked;
  1764. txtIP.Enabled = !chkReadOnly.Checked;
  1765. button1.Enabled = !chkReadOnly.Checked;
  1766. button2.Enabled = !chkReadOnly.Checked;
  1767. button3.Enabled = !chkReadOnly.Checked;
  1768. button4.Enabled = !chkReadOnly.Checked;
  1769. txtIP.Focus();
  1770. }
  1771. private void button1_Click(object sender, EventArgs e)
  1772. {
  1773. HostsHelper.AdblockBasic();
  1774. GetHostsEntries();
  1775. }
  1776. private void button3_Click(object sender, EventArgs e)
  1777. {
  1778. HostsHelper.AdBlockWithPorn();
  1779. GetHostsEntries();
  1780. }
  1781. private void button2_Click(object sender, EventArgs e)
  1782. {
  1783. HostsHelper.AdBlockWithSocial();
  1784. GetHostsEntries();
  1785. }
  1786. private void button4_Click(object sender, EventArgs e)
  1787. {
  1788. HostsHelper.AdBlockWithSocial();
  1789. GetHostsEntries();
  1790. }
  1791. private void RenderAppDownloaderBusy()
  1792. {
  1793. btnDownloadApps.Enabled = false;
  1794. button5.Enabled = false;
  1795. txtDownloadFolder.ReadOnly = true;
  1796. linkLabel1.Visible = false;
  1797. }
  1798. private void RenderAppDownloaderFree()
  1799. {
  1800. btnDownloadApps.Enabled = true;
  1801. button5.Enabled = true;
  1802. txtDownloadFolder.ReadOnly = false;
  1803. linkLabel1.Visible = !string.IsNullOrEmpty(downloadLog);
  1804. txtDownloadStatus.Text = "Finished";
  1805. }
  1806. string appNameTemp = string.Empty;
  1807. int maxCount = 0;
  1808. int count = 0;
  1809. Process p;
  1810. string downloadLog = string.Empty;
  1811. private async void btnDownloadApps_Click(object sender, EventArgs e)
  1812. {
  1813. if (!Directory.Exists(txtDownloadFolder.Text))
  1814. {
  1815. MessageBox.Show("Download folder specified is not valid!", "Invalid folder", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1816. return;
  1817. }
  1818. RenderAppDownloaderBusy();
  1819. maxCount = 0;
  1820. count = 0;
  1821. downloadLog = string.Empty;
  1822. foreach (Control c in Utilities.GetSelfAndChildrenRecursive(appsTab))
  1823. {
  1824. if (c.Name == "cAutoInstall") continue;
  1825. if (c is ColoredCheckBox && ((ColoredCheckBox)c).Checked) maxCount++;
  1826. }
  1827. ColoredCheckBox currentCheck;
  1828. Control[] temp;
  1829. foreach (FeedApp x in AppsFromFeed)
  1830. {
  1831. if (string.IsNullOrEmpty(x.Tag)) continue;
  1832. temp = appsTab.Controls.Find(x.Tag, true);
  1833. if (temp.Count() == 0) continue;
  1834. currentCheck = (ColoredCheckBox)temp[0];
  1835. if (currentCheck == null) continue;
  1836. if (!currentCheck.Checked) continue;
  1837. appNameTemp = x.Title;
  1838. if (c64.Checked)
  1839. {
  1840. count++;
  1841. if (string.IsNullOrEmpty(x.Link64))
  1842. {
  1843. downloadLog += "• " + x.Title + ":" + Environment.NewLine + "No 64-bit available, downloading 32-bit" + Environment.NewLine + Environment.NewLine;
  1844. await DownloadApp(x, false);
  1845. }
  1846. else
  1847. {
  1848. await DownloadApp(x, true);
  1849. }
  1850. }
  1851. else
  1852. {
  1853. count++;
  1854. if (!string.IsNullOrEmpty(x.Link))
  1855. {
  1856. await DownloadApp(x, false);
  1857. }
  1858. else
  1859. {
  1860. downloadLog += "• " + x.Title + ":" + Environment.NewLine + "No 32-bit available, skipping" + Environment.NewLine + Environment.NewLine;
  1861. }
  1862. }
  1863. }
  1864. if (cAutoInstall.Checked)
  1865. {
  1866. count = 0;
  1867. foreach (string a in Directory.GetFiles(txtDownloadFolder.Text, "*.*", SearchOption.TopDirectoryOnly))
  1868. {
  1869. using (p = new Process())
  1870. {
  1871. count++;
  1872. p.StartInfo.FileName = a;
  1873. p.EnableRaisingEvents = true;
  1874. p.StartInfo.WorkingDirectory = txtDownloadFolder.Text;
  1875. // APP-SPECIFIC HACKS //
  1876. if (a.Contains("Sumatra")) p.StartInfo.Arguments = " -install";
  1877. // *** //
  1878. txtDownloadStatus.Text = string.Format("{0}/{1} - Installing {2} ...", count, maxCount, Path.GetFileNameWithoutExtension(a));
  1879. await p.RunAsync();
  1880. };
  1881. }
  1882. }
  1883. // reset all checkboxes
  1884. foreach (Control c in Utilities.GetSelfAndChildrenRecursive(appsTab))
  1885. {
  1886. if (c.Name == "cAutoInstall") continue;
  1887. if (c is ColoredCheckBox && ((ColoredCheckBox)c).Checked) ((ColoredCheckBox)c).Checked = false;
  1888. }
  1889. RenderAppDownloaderFree();
  1890. }
  1891. string fileExtension = ".exe";
  1892. private async Task DownloadApp(FeedApp app, bool pref64)
  1893. {
  1894. try
  1895. {
  1896. using (WebClient downloader = new WebClient())
  1897. {
  1898. downloader.Headers.Add("User-Agent: Other");
  1899. downloader.Encoding = Encoding.UTF8;
  1900. downloader.DownloadProgressChanged += Downloader_DownloadProgressChanged;
  1901. downloader.DownloadFileCompleted += Downloader_DownloadFileCompleted;
  1902. if (pref64)
  1903. {
  1904. if (app.Link64.Contains(".msi"))
  1905. {
  1906. fileExtension = ".msi";
  1907. }
  1908. else
  1909. {
  1910. fileExtension = ".exe";
  1911. }
  1912. await downloader.DownloadFileTaskAsync(new Uri(app.Link64), Path.Combine(txtDownloadFolder.Text, app.Title + "-x64" + fileExtension));
  1913. }
  1914. else
  1915. {
  1916. if (app.Link.Contains(".msi"))
  1917. {
  1918. fileExtension = ".msi";
  1919. }
  1920. else
  1921. {
  1922. fileExtension = ".exe";
  1923. }
  1924. await downloader.DownloadFileTaskAsync(new Uri(app.Link), Path.Combine(txtDownloadFolder.Text, app.Title + "-x86" + fileExtension));
  1925. }
  1926. }
  1927. }
  1928. catch (Exception ex)
  1929. {
  1930. ErrorLogger.LogError("MainForm.DownloadApp", ex.Message, ex.StackTrace);
  1931. downloadLog += "• " + app.Title + ":" + Environment.NewLine + "Link is no longer valid!" + Environment.NewLine + Environment.NewLine;
  1932. if (pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x64.exe")); } catch { }
  1933. if (!pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x86.exe")); } catch { }
  1934. if (pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x64.msi")); } catch { }
  1935. if (!pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x86.msi")); } catch { }
  1936. }
  1937. }
  1938. private void Downloader_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
  1939. {
  1940. this.BeginInvoke((MethodInvoker)delegate
  1941. {
  1942. //txtDownloadStatus.Text = "Finished";
  1943. });
  1944. }
  1945. int tempProgress;
  1946. private void Downloader_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
  1947. {
  1948. this.BeginInvoke((MethodInvoker)delegate
  1949. {
  1950. double bytesIn = double.Parse(e.BytesReceived.ToString());
  1951. double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
  1952. double percentage = bytesIn / totalBytes * 100;
  1953. tempProgress = int.Parse(Math.Truncate(percentage).ToString());
  1954. // if Content-Length header is missing, just show an animation
  1955. if (Math.Abs(tempProgress) > 100)
  1956. {
  1957. txtDownloadStatus.Text = string.Format("({1}/{2}) - {0} ...", appNameTemp, count, maxCount);
  1958. progressDownloader.Style = ProgressBarStyle.Marquee;
  1959. }
  1960. // if not, show actual progress
  1961. else
  1962. {
  1963. txtDownloadStatus.Text = string.Format("({1}/{2}) - {0} - {3} / {4}", appNameTemp, count, maxCount, ByteSize.FromBytes(e.BytesReceived).ToString("MB"), ByteSize.FromBytes(e.TotalBytesToReceive).ToString("MB"));
  1964. progressDownloader.Style = ProgressBarStyle.Continuous;
  1965. progressDownloader.Value = tempProgress;
  1966. }
  1967. });
  1968. }
  1969. private void button5_Click(object sender, EventArgs e)
  1970. {
  1971. FolderBrowserDialog d = new FolderBrowserDialog();
  1972. if (d.ShowDialog() == DialogResult.OK)
  1973. {
  1974. txtDownloadFolder.Text = d.SelectedPath;
  1975. Options.CurrentOptions.AppsFolder = d.SelectedPath;
  1976. Options.SaveSettings();
  1977. }
  1978. }
  1979. private void button6_Click(object sender, EventArgs e)
  1980. {
  1981. Process.Start(txtDownloadFolder.Text);
  1982. }
  1983. private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  1984. {
  1985. InfoForm lf = new InfoForm(downloadLog);
  1986. lf.ShowDialog(this);
  1987. }
  1988. private void txtDownloadFolder_TextChanged(object sender, EventArgs e)
  1989. {
  1990. Options.CurrentOptions.AppsFolder = txtDownloadFolder.Text;
  1991. Options.SaveSettings();
  1992. }
  1993. private void chkOnlyRemovable_CheckedChanged(object sender, EventArgs e)
  1994. {
  1995. GetModernApps(!chkOnlyRemovable.Checked);
  1996. }
  1997. private void btnGetFeed_Click(object sender, EventArgs e)
  1998. {
  1999. GetFeed();
  2000. }
  2001. private void l2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  2002. {
  2003. AboutForm f = new AboutForm();
  2004. f.ShowDialog(this);
  2005. //Process.Start("https://github.com/hellzerg/optimizer");
  2006. }
  2007. private void btnViewLog_Click(object sender, EventArgs e)
  2008. {
  2009. if (File.Exists(ErrorLogger.ErrorLogFile))
  2010. {
  2011. InfoForm iform = new InfoForm(File.ReadAllText(ErrorLogger.ErrorLogFile, Encoding.UTF8));
  2012. iform.ShowDialog();
  2013. }
  2014. else
  2015. {
  2016. MessageBox.Show("There are no errors to show!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  2017. }
  2018. }
  2019. private void btnOpenConf_Click(object sender, EventArgs e)
  2020. {
  2021. Process.Start(Required.CoreFolder);
  2022. }
  2023. private void btnPing_Click(object sender, EventArgs e)
  2024. {
  2025. if (string.IsNullOrEmpty(txtPingInput.Text)) return;
  2026. _pingResults = new List<PingReply>();
  2027. listPingResults.Items.Clear();
  2028. if (Utilities.PingHost(txtPingInput.Text) == null)
  2029. {
  2030. listPingResults.Items.Add(string.Format("Could not find host [{0}]", txtPingInput.Text));
  2031. return;
  2032. }
  2033. Task pinger = new Task(() =>
  2034. {
  2035. btnShodan.Enabled = false;
  2036. btnPing.Enabled = false;
  2037. listPingResults.Items.Add(string.Format("Pinging [{0}] with 32 bytes - 9 times...", txtPingInput.Text));
  2038. listPingResults.Items.Add("");
  2039. for (int i = 0; i < 9; i++)
  2040. {
  2041. tmpReply = Utilities.PingHost(txtPingInput.Text);
  2042. if (tmpReply.Address == null)
  2043. {
  2044. listPingResults.Items.Add(tmpReply.Status);
  2045. }
  2046. else
  2047. {
  2048. _pingResults.Add(tmpReply);
  2049. _shodanIP = _pingResults[i].Address.ToString();
  2050. listPingResults.Items.Add(string.Format("{0} - LATENCY: {1} ms - TTL: {2}", _pingResults[i].Status, _pingResults[i].RoundtripTime, _pingResults[i].Options.Ttl));
  2051. }
  2052. }
  2053. listPingResults.Items.Add("");
  2054. // calculate statistics
  2055. if (_pingResults.Count > 0)
  2056. {
  2057. long maxLatency = _pingResults.Max(x => x.RoundtripTime);
  2058. long minLatency = _pingResults.Min(x => x.RoundtripTime);
  2059. double averageLatency = _pingResults.Average(x => x.RoundtripTime);
  2060. listPingResults.Items.Add(string.Format("LATENCY: Min = {0}, Max = {1}, Average = {2:F2}", minLatency, maxLatency, averageLatency));
  2061. }
  2062. else
  2063. {
  2064. listPingResults.Items.Add("All packets timed out");
  2065. }
  2066. btnPing.Enabled = true;
  2067. btnShodan.Enabled = true;
  2068. });
  2069. pinger.Start();
  2070. }
  2071. private void btnCheckFootprint_Click(object sender, EventArgs e)
  2072. {
  2073. CleanHelper.CheckFootprint();
  2074. }
  2075. private void btnShodan_Click(object sender, EventArgs e)
  2076. {
  2077. IPAddress tryIP;
  2078. if (IPAddress.TryParse(txtPingInput.Text, out tryIP))
  2079. {
  2080. Process.Start(string.Format("https://www.shodan.io/host/{0}", txtPingInput.Text));
  2081. return;
  2082. }
  2083. if (!string.IsNullOrEmpty(_shodanIP))
  2084. {
  2085. Process.Start(string.Format("https://www.shodan.io/host/{0}", _shodanIP));
  2086. return;
  2087. }
  2088. }
  2089. private void button9_Click(object sender, EventArgs e)
  2090. {
  2091. try
  2092. {
  2093. Clipboard.SetText(_shodanIP);
  2094. }
  2095. catch { }
  2096. }
  2097. private void button7_Click(object sender, EventArgs e)
  2098. {
  2099. try
  2100. {
  2101. Clipboard.SetText(txtPingInput.Text);
  2102. }
  2103. catch { }
  2104. }
  2105. private void txtPingInput_KeyDown(object sender, KeyEventArgs e)
  2106. {
  2107. if (e.KeyCode == Keys.Enter) btnPing.PerformClick();
  2108. }
  2109. private void btnExport_Click(object sender, EventArgs e)
  2110. {
  2111. if (ExportDialog.ShowDialog() == DialogResult.OK)
  2112. {
  2113. try
  2114. {
  2115. File.WriteAllLines(ExportDialog.FileName, listPingResults.Items.Cast<string>());
  2116. }
  2117. catch (Exception ex)
  2118. {
  2119. ErrorLogger.LogError("btnExport.Click", ex.Message, ex.StackTrace);
  2120. MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  2121. }
  2122. }
  2123. }
  2124. private void startupItem_Click(object sender, EventArgs e)
  2125. {
  2126. tabCollection.SelectedTab = startupTab;
  2127. RestoreWindow();
  2128. }
  2129. private void cleanerItem_Click(object sender, EventArgs e)
  2130. {
  2131. tabCollection.SelectedTab = cleanerTab;
  2132. RestoreWindow();
  2133. }
  2134. private void pingerItem_Click(object sender, EventArgs e)
  2135. {
  2136. tabCollection.SelectedTab = pingerTab;
  2137. RestoreWindow();
  2138. txtPingInput.Focus();
  2139. }
  2140. private void hostsItem_Click(object sender, EventArgs e)
  2141. {
  2142. tabCollection.SelectedTab = hostsEditorTab;
  2143. RestoreWindow();
  2144. txtIP.Focus();
  2145. }
  2146. private void appsItem_Click(object sender, EventArgs e)
  2147. {
  2148. tabCollection.SelectedTab = appsTab;
  2149. RestoreWindow();
  2150. }
  2151. private void exitItem_Click(object sender, EventArgs e)
  2152. {
  2153. _trayMenu = false;
  2154. Options.CurrentOptions.AppsFolder = txtDownloadFolder.Text;
  2155. Options.SaveSettings();
  2156. Application.Exit();
  2157. }
  2158. private void RestoreWindow()
  2159. {
  2160. if (this.WindowState == FormWindowState.Minimized) this.WindowState = FormWindowState.Normal;
  2161. this.Show();
  2162. this.Activate();
  2163. this.Focus();
  2164. }
  2165. private void launcherIcon_MouseDoubleClick(object sender, MouseEventArgs e)
  2166. {
  2167. if (this.Visible)
  2168. {
  2169. if (this.WindowState == FormWindowState.Minimized) this.WindowState = FormWindowState.Normal;
  2170. this.Hide();
  2171. }
  2172. else
  2173. {
  2174. RestoreWindow();
  2175. }
  2176. }
  2177. private void quickAccessToggle_CheckedChanged(object sender, EventArgs e)
  2178. {
  2179. Options.CurrentOptions.EnableTray = quickAccessToggle.Checked;
  2180. Options.SaveSettings();
  2181. _trayMenu = quickAccessToggle.Checked;
  2182. launcherIcon.Visible = quickAccessToggle.Checked;
  2183. }
  2184. private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  2185. {
  2186. Process.Start(_licenseLink);
  2187. }
  2188. private void linkLabel6_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  2189. {
  2190. Process.Start(_openSourceLink);
  2191. }
  2192. private void linkUpdate_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  2193. {
  2194. CheckForUpdate();
  2195. }
  2196. private void restartExpolorerItem_Click(object sender, EventArgs e)
  2197. {
  2198. Utilities.RestartExplorer();
  2199. }
  2200. private void button10_Click(object sender, EventArgs e)
  2201. {
  2202. Utilities.FlushDNSCache();
  2203. }
  2204. private void infoBaloon_Popup(object sender, PopupEventArgs e)
  2205. {
  2206. infoText = ((ToggleSwitch)e.AssociatedControl).OnText;
  2207. foreach (string x in toRemove)
  2208. {
  2209. infoText = infoText.Replace(x, string.Empty);
  2210. }
  2211. infoTip.ToolTipTitle = "What is " + infoText + "?";
  2212. }
  2213. private void helpTipsToggle_CheckedChanged(object sender, EventArgs e)
  2214. {
  2215. Options.CurrentOptions.ShowHelp = helpTipsToggle.Checked;
  2216. Options.SaveSettings();
  2217. infoTip.Active = helpTipsToggle.Checked;
  2218. }
  2219. }
  2220. }