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