MainForm.cs 87 KB

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