MainForm.cs 88 KB

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