12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- using System.Reflection;
- using System.Diagnostics;
- using System.Net;
- using System.Threading;
- using System.Linq;
- using System.Drawing;
- using Timer = System.Windows.Forms.Timer;
- namespace Optimizer
- {
- public partial class MainForm : Form
- {
- ListViewColumnSorter _columnSorter;
- AppLinks apps = new AppLinks();
- List<StartupItem> _startUpItems = new List<StartupItem>();
- List<string> _hostsEntries = new List<string>();
- List<string> _customCommands = new List<string>();
- List<string> _desktopItems = new List<string>();
- List<string> _modernApps = new List<string>();
- DesktopItemType _desktopItemType = DesktopItemType.Program;
- DesktopTypePosition _desktopItemPosition = DesktopTypePosition.Top;
- readonly string _feedLink = "https://raw.githubusercontent.com/hellzerg/optimizer/master/fesdt";
- readonly string _latestVersionLink = "https://raw.githubusercontent.com/hellzerg/optimizer/master/version.txt";
- readonly string _changelogLink = "https://github.com/hellzerg/optimizer/blob/master/CHANGELOG.md";
- readonly string _noNewVersionMessage = "You already have the latest version!";
- readonly string _betaVersionMessage = "You are using an experimental version!";
- readonly string _blockedIP = "0.0.0.0";
- readonly string _restartMessage = "Restart to apply changes?";
- readonly string _removeStartupItemsMessage = "Are you sure you want to delete all startup items?";
- readonly string _removeHostsEntriesMessage = "Are you sure you want to delete all hosts entries?";
- readonly string _removeDesktopItemsMessage = "Are you sure you want to delete all desktop items?";
- readonly string _removeModernAppsMessage = "Are you sure you want to uninstall the following app(s)?";
- readonly string _errorModernAppsMessage = "The following app(s) couldn't be uninstalled:\n";
- 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!";
- private string NewVersionMessage(string latestVersion)
- {
- 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());
- }
- private string NewDownloadLink(string latestVersion)
- {
- return string.Format("https://github.com/hellzerg/optimizer/releases/download/{0}/Optimizer-{0}.exe", latestVersion);
- }
- private void CheckForUpdate()
- {
- WebClient client = new WebClient
- {
- Encoding = Encoding.UTF8
- };
- string latestVersion = string.Empty;
- try
- {
- latestVersion = client.DownloadString(_latestVersionLink);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- if (!string.IsNullOrEmpty(latestVersion))
- {
- if (float.Parse(latestVersion) > Program.GetCurrentVersion())
- {
- if (MessageBox.Show(NewVersionMessage(latestVersion), "Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- // PATCHING PROCESS
- try
- {
- Assembly currentAssembly = Assembly.GetEntryAssembly();
- if (currentAssembly == null)
- {
- currentAssembly = Assembly.GetCallingAssembly();
- }
- string appFolder = Path.GetDirectoryName(currentAssembly.Location);
- string appName = Path.GetFileNameWithoutExtension(currentAssembly.Location);
- string appExtension = Path.GetExtension(currentAssembly.Location);
- string archiveFile = Path.Combine(appFolder, appName + "_old" + appExtension);
- string appFile = Path.Combine(appFolder, appName + appExtension);
- string tempFile = Path.Combine(appFolder, appName + "_tmp" + appExtension);
- // DOWNLOAD NEW VERSION
- client.DownloadFile(NewDownloadLink(latestVersion), tempFile);
- // DELETE PREVIOUS BACK-UP
- if (File.Exists(archiveFile))
- {
- File.Delete(archiveFile);
- }
- // MAKE BACK-UP
- File.Move(appFile, archiveFile);
- // PATCH
- File.Move(tempFile, appFile);
- Application.Restart();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- else if (float.Parse(latestVersion) == Program.GetCurrentVersion())
- {
- MessageBox.Show(_noNewVersionMessage, "No update available", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- MessageBox.Show(_betaVersionMessage, "No update available", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- }
- private void EnableToggleEvents()
- {
- toggleSwitch12.Click += new EventHandler(toggleSwitch12_Click);
- toggleSwitch11.Click += new EventHandler(toggleSwitch11_Click);
- toggleSwitch10.Click += new EventHandler(toggleSwitch10_Click);
- toggleSwitch9.Click += new EventHandler(toggleSwitch9_Click);
- toggleSwitch8.Click += new EventHandler(toggleSwitch8_Click);
- toggleSwitch6.Click += new EventHandler(toggleSwitch6_Click);
- toggleSwitch5.Click += new EventHandler(toggleSwitch5_Click);
- toggleSwitch4.Click += new EventHandler(toggleSwitch4_Click);
- toggleSwitch1.Click += new EventHandler(toggleSwitch1_Click);
- toggleSwitch3.Click += new EventHandler(toggleSwitch3_Click);
- toggleSwitch2.Click += new EventHandler(toggleSwitch2_Click);
- toggleSwitch27.Click += new EventHandler(toggleSwitch27_Click);
- toggleSwitch28.Click += new EventHandler(toggleSwitch28_Click);
- toggleSwitch29.Click += new EventHandler(toggleSwitch29_Click);
- toggleSwitch30.Click += new EventHandler(toggleSwitch30_Click);
- toggleSwitch22.Click += new EventHandler(toggleSwitch22_Click);
- toggleSwitch20.Click += new EventHandler(toggleSwitch20_Click);
- toggleSwitch21.Click += new EventHandler(toggleSwitch21_Click);
- toggleSwitch23.Click += new EventHandler(toggleSwitch23_Click);
- toggleSwitch24.Click += new EventHandler(toggleSwitch24_Click);
- toggleSwitch25.Click += new EventHandler(toggleSwitch25_Click);
- toggleSwitch26.Click += new EventHandler(toggleSwitch26_Click);
- toggleSwitch17.Click += new EventHandler(toggleSwitch17_Click);
- toggleSwitch16.Click += new EventHandler(toggleSwitch16_Click);
- toggleSwitch15.Click += new EventHandler(toggleSwitch15_Click);
- toggleSwitch14.Click += new EventHandler(toggleSwitch14_Click);
- toggleSwitch13.Click += new EventHandler(toggleSwitch13_Click);
- toggleSwitch31.Click += new EventHandler(toggleSwitch31_Click);
- toggleSwitch18.Click += new EventHandler(toggleSwitch18_Click);
- toggleSwitch19.Click += new EventHandler(toggleSwitch19_Click);
- toggleSwitch32.Click += new EventHandler(toggleSwitch32_Click);
- toggleSwitch33.Click += new EventHandler(ToggleSwitch33_Click);
- toggleSwitch34.Click += new EventHandler(ToggleSwitch34_Click);
- toggleSwitch35.Click += new EventHandler(ToggleSwitch35_Click);
- toggleSwitch36.Click += new EventHandler(ToggleSwitch36_Click);
- toggleSwitch37.Click += new EventHandler(ToggleSwitch37_Click);
- toggleSwitch38.Click += new EventHandler(ToggleSwitch38_Click);
- toggleSwitch39.Click += new EventHandler(ToggleSwitch39_Click);
- toggleSwitch40.Click += new EventHandler(ToggleSwitch40_Click);
- }
- private void ToggleSwitch40_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch40.Checked)
- {
- Optimize.RemoveCastToDevice();
- }
- else
- {
- Optimize.AddCastToDevice();
- }
- Options.CurrentOptions.RemoveCastToDevice = !toggleSwitch40.Checked;
- }
- private void ToggleSwitch39_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch39.Checked)
- {
- Optimize.EnableLongPaths();
- }
- else
- {
- Optimize.DisableLongPaths();
- }
- Options.CurrentOptions.EnableLongPaths = !toggleSwitch39.Checked;
- }
- private void ToggleSwitch38_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch38.Checked)
- {
- Optimize.DisableStickyKeys();
- }
- else
- {
- Optimize.EnableStickyKeys();
- }
- Options.CurrentOptions.DisableStickyKeys = !toggleSwitch38.Checked;
- }
- private void ToggleSwitch37_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch37.Checked)
- {
- Optimize.DisableCloudClipboard();
- }
- else
- {
- Optimize.EnableCloudClipboard();
- }
- Options.CurrentOptions.DisableCloudClipboard = !toggleSwitch37.Checked;
- }
- private void ToggleSwitch36_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch36.Checked)
- {
- Optimize.DisableSmartScreen();
- }
- else
- {
- Optimize.EnableSmartScreen();
- }
- Options.CurrentOptions.DisableSmartScreen = !toggleSwitch36.Checked;
- }
- private void ToggleSwitch35_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch35.Checked)
- {
- Optimize.DisableForcedFeatureUpdates();
- }
- else
- {
- Optimize.EnableForcedFeatureUpdates();
- }
- Options.CurrentOptions.DisableFeatureUpdates = !toggleSwitch35.Checked;
- }
- private void ToggleSwitch34_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch34.Checked)
- {
- Optimize.DisableInsiderService();
- }
- else
- {
- Optimize.EnableInsiderService();
- }
- Options.CurrentOptions.DisableInsiderService = !toggleSwitch34.Checked;
- }
- private void ToggleSwitch33_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch33.Checked)
- {
- Optimize.DisableFaxService();
- }
- else
- {
- Optimize.EnableFaxService();
- }
- Options.CurrentOptions.DisableFaxService = !toggleSwitch33.Checked;
- }
- private void LoadSettings()
- {
- switch (Options.CurrentOptions.Color)
- {
- case Theme.Caramel:
- radioCaramel.Checked = true;
- break;
- case Theme.Lime:
- radioLime.Checked = true;
- break;
- case Theme.Magma:
- radioMagma.Checked = true;
- break;
- case Theme.Minimal:
- radioMinimal.Checked = true;
- break;
- case Theme.Ocean:
- radioOcean.Checked = true;
- break;
- case Theme.Zerg:
- radioZerg.Checked = true;
- break;
- }
- }
- public MainForm()
- {
- InitializeComponent();
- EnableToggleEvents();
- CheckForIllegalCrossThreadCalls = false;
- Options.ApplyTheme(this);
- ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
- // initial states
- chkOnlyRemovable.Checked = true;
- checkDefaultIcon.Checked = true;
- radioProgram.Checked = true;
- radioTop.Checked = true;
- c64.Checked = Environment.Is64BitOperatingSystem;
- c32.Checked = !Environment.Is64BitOperatingSystem;
- if (Utilities.CurrentWindowsVersion == WindowsVersion.Unsupported)
- {
- tabCollection.TabPages.Remove(universalTab);
- tabCollection.TabPages.Remove(windowsVIIITab);
- tabCollection.TabPages.Remove(windowsXTab);
- tabCollection.TabPages.Remove(modernAppsTab);
- }
- if (Utilities.CurrentWindowsVersion == WindowsVersion.Windows7)
- {
- LoadUniversalToggleStates();
- tabCollection.TabPages.Remove(windowsVIIITab);
- tabCollection.TabPages.Remove(windowsXTab);
- tabCollection.TabPages.Remove(modernAppsTab);
- }
- if (Utilities.CurrentWindowsVersion == WindowsVersion.Windows8)
- {
- LoadUniversalToggleStates();
- LoadWindowsVIIIToggleStates();
- tabCollection.TabPages.Remove(windowsXTab);
- GetModernApps(false);
- }
- if (Utilities.CurrentWindowsVersion == WindowsVersion.Windows10)
- {
- LoadUniversalToggleStates();
- LoadWindowsXToggleStates();
- tabCollection.TabPages.Remove(windowsVIIITab);
- GetModernApps(false);
- }
- _columnSorter = new ListViewColumnSorter();
- listStartupItems.ListViewItemSorter = _columnSorter;
- GetStartupItems();
- GetHostsEntries();
- integratorTimer.Start();
- runDialogTime.Start();
- GetDesktopItems();
- GetCustomCommands();
- LoadSettings();
- txtVersion.Text = "Version: " + Program.GetCurrentVersionTostring();
- Program.MainForm = this;
- txtOS.Text = "Microsoft " + Utilities.GetOS();
- txtBitness.Text = Utilities.GetBitness();
- if (string.IsNullOrEmpty(Options.CurrentOptions.AppsFolder))
- {
- txtDownloadFolder.Text = Path.Combine(Application.StartupPath, "Optimizer Downloads");
- Options.CurrentOptions.AppsFolder = Path.Combine(Application.StartupPath, "Optimizer Downloads");
- Directory.CreateDirectory(Options.CurrentOptions.AppsFolder);
- Options.SaveSettings();
- }
- else
- {
- if (!Directory.Exists(Options.CurrentOptions.AppsFolder))
- {
- Directory.CreateDirectory(Options.CurrentOptions.AppsFolder);
- }
- txtDownloadFolder.Text = Options.CurrentOptions.AppsFolder;
- }
- }
- private void CleanPC()
- {
- try
- {
- if (checkTemp.Checked)
- {
- CleanHelper.CleanTemporaries();
- }
- if (checkUTorrent.Checked)
- {
- CleanHelper.CleanUTorrent();
- }
- if (checkFileZilla.Checked)
- {
- CleanHelper.CleanFileZilla();
- }
- if (checkMiniDumps.Checked)
- {
- CleanHelper.CleanMiniDumps();
- }
- if (checkPrefetch.Checked)
- {
- CleanHelper.CleanPrefetch();
- }
- if (checkMediaCache.Checked)
- {
- CleanHelper.CleanMediaPlayersCache();
- }
- if (checkLogs.Checked)
- {
- CleanHelper.CleanLogs();
- }
- if (checkErrorReports.Checked)
- {
- CleanHelper.CleanErrorReports();
- }
- if (checkBin.Checked)
- {
- CleanHelper.EmptyRecycleBin();
- }
- }
- catch { }
- finally
- {
- CleaningAnimation(false);
- }
- }
- private void CleaningAnimation(bool start)
- {
- if (start)
- {
- Utilities.SetControlPropertyThreadSafe(cleaningpanel, "Visible", true);
- Utilities.SetControlPropertyThreadSafe(progress2, "Visible", true);
- Utilities.SetControlPropertyThreadSafe(progress2, "Style", ProgressBarStyle.Marquee);
- Utilities.SetControlPropertyThreadSafe(progress2, "MarqueeAnimationSpeed", 1);
- Utilities.SetControlPropertyThreadSafe(label4, "Visible", true);
- Utilities.SetControlPropertyThreadSafe(button20, "Enabled", false);
- Utilities.SetControlPropertyThreadSafe(panel1, "Enabled", false);
- }
- else
- {
- Utilities.SetControlPropertyThreadSafe(cleaningpanel, "Visible", false);
- Utilities.SetControlPropertyThreadSafe(progress2, "Visible", false);
- Utilities.SetControlPropertyThreadSafe(progress2, "Value", 0);
- Utilities.SetControlPropertyThreadSafe(progress2, "Style", ProgressBarStyle.Blocks);
- Utilities.SetControlPropertyThreadSafe(progress2, "MarqueeAnimationSpeed", 1);
- Utilities.SetControlPropertyThreadSafe(label4, "Visible", false);
- Utilities.SetControlPropertyThreadSafe(button20, "Enabled", true);
- Utilities.SetControlPropertyThreadSafe(panel1, "Enabled", true);
- }
- }
- private bool FixRegistry()
- {
- bool changeDetected = false;
- try
- {
- if (checkFirewall.Checked)
- {
- Utilities.EnableFirewall();
- changeDetected = true;
- }
- if (checkCommandPrompt.Checked)
- {
- Utilities.EnableCommandPrompt();
- changeDetected = true;
- }
- if (checkControlPanel.Checked)
- {
- Utilities.EnableControlPanel();
- changeDetected = true;
- }
- if (checkFolderOptions.Checked)
- {
- Utilities.EnableFolderOptions();
- changeDetected = true;
- }
- if (checkRunDialog.Checked)
- {
- Utilities.EnableRunDialog();
- changeDetected = true;
- }
- if (checkContextMenu.Checked)
- {
- Utilities.EnableContextMenu();
- changeDetected = true;
- }
- if (checkTaskManager.Checked)
- {
- Utilities.EnableTaskManager();
- changeDetected = true;
- }
- if (checkRegistryEditor.Checked)
- {
- Utilities.EnableRegistryEditor();
- changeDetected = true;
- }
- }
- catch { }
- return changeDetected;
- }
- private void LoadUniversalToggleStates()
- {
- toggleSwitch1.Checked = Options.CurrentOptions.EnablePerformanceTweaks;
- toggleSwitch2.Checked = Options.CurrentOptions.DisableNetworkThrottling;
- toggleSwitch3.Checked = Options.CurrentOptions.DisableWindowsDefender;
- toggleSwitch4.Checked = Options.CurrentOptions.DisableSystemRestore;
- toggleSwitch5.Checked = Options.CurrentOptions.DisablePrintService;
- toggleSwitch6.Checked = Options.CurrentOptions.DisableMediaPlayerSharing;
- toggleSwitch8.Checked = Options.CurrentOptions.DisableErrorReporting;
- toggleSwitch9.Checked = Options.CurrentOptions.DisableHomeGroup;
- toggleSwitch10.Checked = Options.CurrentOptions.DisableSuperfetch;
- toggleSwitch11.Checked = Options.CurrentOptions.DisableTelemetryTasks;
- toggleSwitch12.Checked = Options.CurrentOptions.DisableOffice2016Telemetry;
- toggleSwitch32.Checked = Options.CurrentOptions.DisableCompatibilityAssistant;
- toggleSwitch33.Checked = Options.CurrentOptions.DisableFaxService;
- toggleSwitch36.Checked = Options.CurrentOptions.DisableSmartScreen;
- toggleSwitch38.Checked = Options.CurrentOptions.DisableStickyKeys;
- }
- private void LoadWindowsVIIIToggleStates()
- {
- toggleSwitch31.Checked = Options.CurrentOptions.DisableOneDrive;
- }
- private void LoadWindowsXToggleStates()
- {
- toggleSwitch13.Checked = Options.CurrentOptions.EnableLegacyVolumeSlider;
- toggleSwitch14.Checked = Options.CurrentOptions.UninstallOneDrive;
- toggleSwitch15.Checked = Options.CurrentOptions.DisableGameBar;
- toggleSwitch16.Checked = Options.CurrentOptions.DisableCortana;
- toggleSwitch17.Checked = Options.CurrentOptions.DisableXboxLive;
- toggleSwitch18.Checked = Options.CurrentOptions.DisableQuickAccessHistory;
- toggleSwitch19.Checked = Options.CurrentOptions.EnableTaskbarColor;
- toggleSwitch20.Checked = Options.CurrentOptions.DisableSensorServices;
- toggleSwitch21.Checked = Options.CurrentOptions.DisablePrivacyOptions;
- toggleSwitch22.Checked = Options.CurrentOptions.DisableSilentAppInstall;
- toggleSwitch23.Checked = Options.CurrentOptions.DisableTelemetryServices;
- toggleSwitch24.Checked = Options.CurrentOptions.DisableAutomaticUpdates;
- toggleSwitch25.Checked = Options.CurrentOptions.DisableMyPeople;
- toggleSwitch26.Checked = Options.CurrentOptions.DisableStartMenuAds;
- toggleSwitch27.Checked = Options.CurrentOptions.EnableDarkTheme;
- toggleSwitch28.Checked = Options.CurrentOptions.DisableSpellingTyping;
- toggleSwitch29.Checked = Options.CurrentOptions.DisableWindowsInk;
- toggleSwitch30.Checked = Options.CurrentOptions.ExcludeDrivers;
- toggleSwitch34.Checked = Options.CurrentOptions.DisableInsiderService;
- toggleSwitch35.Checked = Options.CurrentOptions.DisableFeatureUpdates;
- toggleSwitch37.Checked = Options.CurrentOptions.DisableCloudClipboard;
- toggleSwitch39.Checked = Options.CurrentOptions.EnableLongPaths;
- toggleSwitch40.Checked = Options.CurrentOptions.RemoveCastToDevice;
- }
- private void Main_Load(object sender, EventArgs e)
- {
-
- }
- private void GetDesktopItems()
- {
- _desktopItems = Integrator.GetDesktopItems();
- listDesktopItems.Items.Clear();
- for (int i = 0; i < _desktopItems.Count; i++)
- {
- if (!string.IsNullOrEmpty(_desktopItems[i]))
- {
- listDesktopItems.Items.Add(_desktopItems[i]);
- }
- }
- }
- private void GetHostsEntries()
- {
- ((Control)this.hostsEditorTab).Enabled = false;
- _hostsEntries = HostsHelper.GetHostsEntries();
- listHostEntries.Items.Clear();
- listHostEntries.Items.AddRange(_hostsEntries.ToArray());
- chkReadOnly.Checked = HostsHelper.GetReadOnly();
- button47.Enabled = !chkReadOnly.Checked;
- button46.Enabled = !chkReadOnly.Checked;
- button42.Enabled = !chkReadOnly.Checked;
- button41.Enabled = !chkReadOnly.Checked;
- linkLabel4.Enabled = !chkReadOnly.Checked;
- chkBlock.Enabled = !chkReadOnly.Checked;
- txtDomain.Enabled = !chkReadOnly.Checked;
- txtIP.Enabled = !chkReadOnly.Checked;
- button1.Enabled = !chkReadOnly.Checked;
- button2.Enabled = !chkReadOnly.Checked;
- button3.Enabled = !chkReadOnly.Checked;
- button4.Enabled = !chkReadOnly.Checked;
- ((Control)this.hostsEditorTab).Enabled = true;
- }
- private void GetStartupItems()
- {
- _startUpItems = Utilities.GetStartupItems();
- listStartupItems.Items.Clear();
- for (int i = 0; i < _startUpItems.Count; i++)
- {
- ListViewItem list = new ListViewItem(_startUpItems[i].Name);
- list.SubItems.Add(_startUpItems[i].FileLocation);
- list.SubItems.Add(_startUpItems[i].ToString());
- listStartupItems.Items.Add(list);
- }
- }
- private void GetModernApps(bool showAll)
- {
- button74.Enabled = false;
- button75.Enabled = false;
- listModernApps.Enabled = false;
- listModernApps.Items.Clear();
- _modernApps = Utilities.GetModernApps(showAll);
- foreach (string x in _modernApps)
- {
- listModernApps.Items.Add(x);
- }
- button74.Enabled = true;
- button75.Enabled = true;
- listModernApps.Enabled = true;
- }
- private async void UninstallModernApps()
- {
- string selectedApps = string.Empty;
- if (listModernApps.CheckedItems.Count > 0)
- {
- foreach (string x in listModernApps.CheckedItems)
- {
- if (string.IsNullOrEmpty(selectedApps))
- {
- selectedApps = x;
- }
- else
- {
- selectedApps += Environment.NewLine + x;
- }
- }
- if (MessageBox.Show(_removeModernAppsMessage + "\n\n" + selectedApps, "Optimizer", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- button74.Enabled = false;
- button75.Enabled = false;
- listModernApps.Enabled = false;
- bool errorOccured = false;
- string failedApps = string.Empty;
- foreach (string app in listModernApps.CheckedItems)
- {
- await Task.Run(() => errorOccured = Utilities.UninstallModernApp(app));
- if (errorOccured)
- {
- failedApps += Environment.NewLine + app;
- }
- }
- if (!string.IsNullOrEmpty(failedApps))
- {
- MessageBox.Show(_errorModernAppsMessage + failedApps, "Optimizer", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- GetModernApps(!chkOnlyRemovable.Checked);
- }
- }
- }
- private void GetCustomCommands()
- {
- _customCommands = Integrator.GetCustomCommands();
- listCustomCommands.Items.Clear();
- foreach (string s in _customCommands)
- {
- listCustomCommands.Items.Add(s);
- }
- }
- private void Main_FormClosing(object sender, EventArgs e)
- {
- Options.CurrentOptions.AppsFolder = txtDownloadFolder.Text;
- Options.SaveSettings();
- }
- private void button39_Click(object sender, EventArgs e)
- {
- HelperForm f = new HelperForm(this, MessageType.Restart, _restartMessage);
- f.ShowDialog();
- }
- private void button43_Click(object sender, EventArgs e)
- {
- HelperForm f = new HelperForm(this, MessageType.Restart, _restartMessage);
- f.ShowDialog();
- }
- private void button44_Click(object sender, EventArgs e)
- {
- HelperForm f = new HelperForm(this, MessageType.Restart, _restartMessage);
- f.ShowDialog();
- }
- private void button45_Click(object sender, EventArgs e)
- {
- HelperForm f = new HelperForm(this, MessageType.Restart, _restartMessage);
- f.ShowDialog();
- }
- private void button18_Click(object sender, EventArgs e)
- {
- EdgeForm f = new EdgeForm();
- f.ShowDialog();
- }
- private void checkSelectAll_CheckedChanged(object sender, EventArgs e)
- {
- checkTemp.Checked = checkSelectAll.Checked;
- checkUTorrent.Checked = checkSelectAll.Checked;
- checkFileZilla.Checked = checkSelectAll.Checked;
- checkMiniDumps.Checked = checkSelectAll.Checked;
- checkPrefetch.Checked = checkSelectAll.Checked;
- checkMediaCache.Checked = checkSelectAll.Checked;
- checkLogs.Checked = checkSelectAll.Checked;
- checkBin.Checked = checkSelectAll.Checked;
- checkErrorReports.Checked = checkSelectAll.Checked;
- }
- private void button20_Click(object sender, EventArgs e)
- {
- CleaningAnimation(true);
- Task t = new Task(() => CleanPC());
- t.Start();
- }
- private void button32_Click(object sender, EventArgs e)
- {
- if (listStartupItems.SelectedItems.Count == 1)
- {
- _startUpItems[listStartupItems.SelectedIndices[0]].Remove();
- GetStartupItems();
- }
- }
- internal void RemoveAllStartupItems()
- {
- foreach (ListViewItem i in listStartupItems.Items)
- {
- _startUpItems[i.Index].Remove();
- }
- GetStartupItems();
- }
- private void button22_Click(object sender, EventArgs e)
- {
- if (listStartupItems.Items.Count > 0)
- {
- HelperForm r = new HelperForm(this, MessageType.Startup, _removeStartupItemsMessage);
- r.ShowDialog(this);
- }
- }
- private void button31_Click(object sender, EventArgs e)
- {
- if (listStartupItems.SelectedItems.Count == 1)
- {
- _startUpItems[listStartupItems.SelectedIndices[0]].LocateFile();
- }
- }
- private void checkEnableAll_CheckedChanged(object sender, EventArgs e)
- {
- checkTaskManager.Checked = checkEnableAll.Checked;
- checkCommandPrompt.Checked = checkEnableAll.Checked;
- checkControlPanel.Checked = checkEnableAll.Checked;
- checkFolderOptions.Checked = checkEnableAll.Checked;
- checkRunDialog.Checked = checkEnableAll.Checked;
- checkContextMenu.Checked = checkEnableAll.Checked;
- checkFirewall.Checked = checkEnableAll.Checked;
- checkRegistryEditor.Checked = checkEnableAll.Checked;
- }
- private void button33_Click(object sender, EventArgs e)
- {
- bool flag = FixRegistry();
- if (flag)
- {
- panel2.Enabled = false;
- button33.Enabled = false;
- if (checkRestartExplorer.Checked)
- {
- Utilities.RestartExplorer();
- }
- panel2.Enabled = true;
- button33.Enabled = true;
- }
- }
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- AboutForm f = new AboutForm();
- f.ShowDialog(this);
- }
- private void button37_Click(object sender, EventArgs e)
- {
- GetStartupItems();
- }
- private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- HostsHelper.LocateHosts();
- }
- private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- HostsEditorForm f = new HostsEditorForm();
- f.ShowDialog(this);
- GetHostsEntries();
- }
- private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- HostsHelper.RestoreDefaultHosts();
- GetHostsEntries();
- }
- private void button47_Click(object sender, EventArgs e)
- {
- if ((txtIP.Text != string.Empty) && (txtDomain.Text != string.Empty))
- {
- string ip = txtIP.Text.Trim();
- string domain = txtDomain.Text.Trim();
- string recommendedDomain = string.Empty;
- if (!domain.StartsWith("www."))
- {
- recommendedDomain = "www." + domain;
- }
- else
- {
- recommendedDomain = domain.Replace("www.", string.Empty);
- }
- HostsHelper.AddEntry(HostsHelper.SanitizeEntry(ip) + " " + HostsHelper.SanitizeEntry(domain));
- if (!string.IsNullOrEmpty(recommendedDomain))
- {
- HostsHelper.AddEntry(HostsHelper.SanitizeEntry(ip) + " " + HostsHelper.SanitizeEntry(recommendedDomain));
- }
- GetHostsEntries();
- txtIP.Clear();
- txtDomain.Clear();
- chkBlock.Checked = false;
- }
- }
- private void button41_Click(object sender, EventArgs e)
- {
- GetHostsEntries();
- }
- private void button42_Click(object sender, EventArgs e)
- {
- if (listHostEntries.SelectedItems.Count == 1)
- {
- HostsHelper.RemoveEntry(listHostEntries.SelectedItem.ToString().Replace(" : ", " "));
- GetHostsEntries();
- }
- }
- private void button46_Click(object sender, EventArgs e)
- {
- if (listHostEntries.Items.Count > 0)
- {
- HelperForm r = new HelperForm(this, MessageType.Hosts, _removeHostsEntriesMessage);
- r.ShowDialog(this);
- }
- }
- internal void RemoveAllHostsEntries()
- {
- List<string> collection = new List<string>();
- foreach (string item in listHostEntries.Items)
- {
- collection.Add(item.Replace(" : ", " "));
- }
- HostsHelper.RemoveAllEntries(collection);
- GetHostsEntries();
- }
- private void aio_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (tabCollection.SelectedTab == hostsEditorTab)
- {
- txtIP.Focus();
- }
- }
- private void button48_Click(object sender, EventArgs e)
- {
- defineCommandDialog.ShowDialog();
- }
- private void button50_Click(object sender, EventArgs e)
- {
- if ((txtRunFile.Text != string.Empty) && (txtRunKeyword.Text != string.Empty))
- {
- Integrator.CreateCustomCommand(txtRunFile.Text, txtRunKeyword.Text);
- txtRunFile.Clear();
- txtRunKeyword.Clear();
- GetCustomCommands();
- }
- }
- private void DefineCmd_FileOk(object sender, CancelEventArgs e)
- {
- txtRunFile.Text = defineCommandDialog.FileName;
- txtRunKeyword.Text = Path.GetFileNameWithoutExtension(txtRunFile.Text).ToLower();
- }
- private void button58_Click(object sender, EventArgs e)
- {
- InfoForm r = new InfoForm(Integrator.powerinfo);
- r.ShowDialog(this);
- }
- private void button56_Click(object sender, EventArgs e)
- {
- InfoForm r = new InfoForm(Integrator.systemtoolsinfo);
- r.ShowDialog(this);
- }
- private void button52_Click(object sender, EventArgs e)
- {
- InfoForm r = new InfoForm(Integrator.windowsappsinfo);
- r.ShowDialog(this);
- }
- private void button49_Click(object sender, EventArgs e)
- {
- InfoForm r = new InfoForm(Integrator.systemshortcutsinfo);
- r.ShowDialog(this);
- }
- private void button55_Click(object sender, EventArgs e)
- {
- InfoForm r = new InfoForm(Integrator.desktopshortcutsinfo);
- r.ShowDialog(this);
- }
- private void button59_Click(object sender, EventArgs e)
- {
- Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\PowerMenu.reg");
- GetDesktopItems();
- }
- private void button53_Click(object sender, EventArgs e)
- {
- Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\SystemTools.reg");
- GetDesktopItems();
- }
- private void button54_Click(object sender, EventArgs e)
- {
- Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\WindowsApps.reg");
- GetDesktopItems();
- }
- private void button51_Click(object sender, EventArgs e)
- {
- Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\SystemShortcuts.reg");
- GetDesktopItems();
- }
- private void button57_Click(object sender, EventArgs e)
- {
- Utilities.ImportRegistryScript(Required.ReadyMadeMenusFolder + "\\DesktopShortcuts.reg");
- GetDesktopItems();
- }
- private void button60_Click(object sender, EventArgs e)
- {
- GetDesktopItems();
- }
- private void button61_Click(object sender, EventArgs e)
- {
- if (listDesktopItems.SelectedItems.Count == 1)
- {
- Integrator.RemoveItem(listDesktopItems.SelectedItem.ToString());
- GetDesktopItems();
- }
- }
- internal void RemoveAllDesktopItems()
- {
- List<string> collection = new List<string>();
- foreach (string item in listDesktopItems.Items)
- {
- collection.Add(item);
- }
- Integrator.RemoveAllItems(collection);
- GetDesktopItems();
- }
- private void button62_Click(object sender, EventArgs e)
- {
- if (listDesktopItems.Items.Count > 0)
- {
- HelperForm r = new HelperForm(this, MessageType.Integrator, _removeDesktopItemsMessage);
- r.ShowDialog(this);
- }
- }
- private void radioProgram_CheckedChanged(object sender, EventArgs e)
- {
- if (radioProgram.Checked)
- {
- btnBrowseItem.Enabled = true;
- txtItem.Clear();
- checkDefaultIcon.Checked = true;
- txtIcon.Enabled = false;
- btnBrowseIcon.Enabled = false;
- itemtoaddgroup.Text = "Program to add:";
- checkDefaultIcon.Visible = true;
- checkDefaultIcon.Text = "Use program's icon";
- txtItemName.Clear();
- txtItem.ReadOnly = true;
- txtIcon.ReadOnly = true;
- _desktopItemType = DesktopItemType.Program;
- }
- }
- private void radioFolder_CheckedChanged(object sender, EventArgs e)
- {
- if (radioFolder.Checked)
- {
- checkDefaultIcon.Checked = true;
- btnBrowseItem.Enabled = true;
- txtItem.Clear();
- itemtoaddgroup.Text = "Folder to add:";
- checkDefaultIcon.Text = "Use default folder icon";
- txtItemName.Clear();
- txtItem.ReadOnly = true;
- txtIcon.ReadOnly = true;
- _desktopItemType = DesktopItemType.Folder;
- }
- }
- private void radioLink_CheckedChanged(object sender, EventArgs e)
- {
- if (radioLink.Checked)
- {
- checkDefaultIcon.Checked = true;
- checkDefaultIcon.Text = "Download website icon (favicon)";
- btnBrowseItem.Enabled = false;
- itemtoaddgroup.Text = "Web address to add:";
- checkDefaultIcon.Visible = true;
- txtItem.Text = "http://";
- txtItemName.Clear();
- txtItem.ReadOnly = false;
- txtIcon.ReadOnly = true;
- _desktopItemType = DesktopItemType.Link;
- }
- }
- private void radioFile_CheckedChanged(object sender, EventArgs e)
- {
- if (radioFile.Checked)
- {
- checkDefaultIcon.Checked = true;
- checkDefaultIcon.Text = "No icon";
- btnBrowseItem.Enabled = true;
- itemtoaddgroup.Text = "File to add:";
- checkDefaultIcon.Visible = true;
- txtItem.Clear();
- txtItemName.Clear();
- txtItem.ReadOnly = true;
- txtIcon.ReadOnly = true;
- _desktopItemType = DesktopItemType.File;
- }
- }
- private void radioCommand_CheckedChanged(object sender, EventArgs e)
- {
- if (radioCommand.Checked)
- {
- btnBrowseItem.Enabled = false;
- txtItem.Clear();
- checkDefaultIcon.Checked = true;
- txtIcon.Enabled = false;
- btnBrowseIcon.Enabled = false;
- itemtoaddgroup.Text = "Command to add:";
- checkDefaultIcon.Visible = true;
- checkDefaultIcon.Text = "No icon";
- txtItemName.Clear();
- txtItem.ReadOnly = false;
- txtIcon.ReadOnly = true;
- _desktopItemType = DesktopItemType.Command;
- }
- }
- private void checkDefaultIcon_CheckedChanged(object sender, EventArgs e)
- {
- if (checkDefaultIcon.Checked)
- {
- txtIcon.Clear();
- txtIcon.Enabled = false;
- btnBrowseIcon.Enabled = false;
- }
- else
- {
- txtIcon.Clear();
- txtIcon.Enabled = true;
- btnBrowseIcon.Enabled = true;
- }
- }
- private void btnBrowseItem_Click(object sender, EventArgs e)
- {
- switch (_desktopItemType)
- {
- case DesktopItemType.Program:
- defineProgramDialog.ShowDialog();
- break;
- case DesktopItemType.Folder:
- defineFolderDialog.ShowDialog();
- txtItem.Text = defineFolderDialog.SelectedPath;
- int i = defineFolderDialog.SelectedPath.LastIndexOf("\\");
- txtItemName.Text = defineFolderDialog.SelectedPath.Remove(0, i + 1);
- break;
- case DesktopItemType.File:
- defineFileDialog.ShowDialog();
- break;
- }
- }
- private void DefineProgramDialog_FileOk(object sender, CancelEventArgs e)
- {
- txtItem.Text = defineProgramDialog.FileName;
- txtItemName.Text = defineProgramDialog.SafeFileName.Replace(".exe", string.Empty);
- }
- private void DefineFileDialog_FileOk(object sender, CancelEventArgs e)
- {
- txtItem.Text = defineFileDialog.FileName;
- txtItemName.Text = defineFileDialog.SafeFileName;
- }
- private void btnBrowseIcon_Click(object sender, EventArgs e)
- {
- switch (_desktopItemType)
- {
- case DesktopItemType.Program:
- DefineProgramIconDialog.ShowDialog();
- break;
- case DesktopItemType.Folder:
- DefineFolderIconDialog.ShowDialog();
- break;
- case DesktopItemType.Link:
- DefineURLIconDialog.ShowDialog();
- break;
- case DesktopItemType.File:
- DefineFileIconDialog.ShowDialog();
- break;
- case DesktopItemType.Command:
- DefineCommandIconDialog.ShowDialog();
- break;
- }
- }
- private void DefineProgramIconDialog_FileOk(object sender, CancelEventArgs e)
- {
- txtIcon.Text = DefineProgramIconDialog.FileName;
- if (txtIcon.Text.Contains(".exe"))
- {
- string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineProgramIconDialog.FileName);
- txtIcon.Text = iconpath;
- }
- }
- private void DefineFolderIconDialog_FileOk(object sender, CancelEventArgs e)
- {
- txtIcon.Text = DefineFolderIconDialog.FileName;
- if (txtIcon.Text.Contains(".exe"))
- {
- string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineFolderIconDialog.FileName);
- txtIcon.Text = iconpath;
- }
- }
- private void DefineURLIconDialog_FileOk(object sender, CancelEventArgs e)
- {
- txtIcon.Text = DefineURLIconDialog.FileName;
- if (txtIcon.Text.Contains(".exe"))
- {
- string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineURLIconDialog.FileName);
- txtIcon.Text = iconpath;
- }
- }
- private void DefineFileIconDialog_FileOk(object sender, CancelEventArgs e)
- {
- txtIcon.Text = DefineFileIconDialog.FileName;
- if (txtIcon.Text.Contains(".exe"))
- {
- string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineFileIconDialog.FileName);
- txtIcon.Text = iconpath;
- }
- }
- private void DefineCommandIconDialog_FileOk(object sender, CancelEventArgs e)
- {
- txtIcon.Text = DefineCommandIconDialog.FileName;
- if (txtIcon.Text.Contains(".exe"))
- {
- string iconpath = Integrator.ExtractIconFromExecutable(txtItemName.Text, DefineCommandIconDialog.FileName);
- txtIcon.Text = iconpath;
- }
- }
- private void btnAddItem_Click(object sender, EventArgs e)
- {
- string icon = string.Empty;
- switch (_desktopItemType)
- {
- case DesktopItemType.Program:
- if (checkDefaultIcon.Checked)
- {
- icon = txtItem.Text;
- }
- else
- {
- icon = txtIcon.Text;
- }
- Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.Program);
- break;
- case DesktopItemType.Folder:
- if (checkDefaultIcon.Checked)
- {
- icon = Integrator.FolderDefaultIcon;
- }
- else
- {
- icon = txtIcon.Text;
- }
- Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.Folder);
- break;
- case DesktopItemType.Link:
- if (checkDefaultIcon.Checked)
- {
- icon = Integrator.DownloadFavicon(txtItem.Text, txtItemName.Text);
- }
- else
- {
- icon = txtIcon.Text;
- }
- Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.Link);
- break;
- case DesktopItemType.File:
- if (!checkDefaultIcon.Checked)
- {
- icon = txtIcon.Text;
- }
- Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.File);
- break;
- case DesktopItemType.Command:
- if (!checkDefaultIcon.Checked)
- {
- icon = txtIcon.Text;
- }
- Integrator.AddItem(txtItemName.Text, txtItem.Text, icon, _desktopItemPosition, checkShift.Checked, DesktopItemType.Command);
- break;
- }
- GetDesktopItems();
- ResetIntegratorForm();
- }
- private void integratorTimer_Tick(object sender, EventArgs e)
- {
- if ((txtItem.Text != "") && (txtItemName.Text != "") && (txtIcon.Text != "") && (!checkDefaultIcon.Checked))
- {
- btnAddItem.Enabled = true;
- }
- else if ((txtItem.Text != "") && (txtItemName.Text != "") && (checkDefaultIcon.Checked))
- {
- btnAddItem.Enabled = true;
- }
- else
- {
- btnAddItem.Enabled = false;
- }
- }
- private void runDialogTimer_Tick(object sender, EventArgs e)
- {
- if ((txtRunFile.Text != "") && (txtRunKeyword.Text != ""))
- {
- btnCreateCustomCommand.Enabled = true;
- }
- else
- {
- btnCreateCustomCommand.Enabled = false;
- }
- }
- private void radioTop_CheckedChanged(object sender, EventArgs e)
- {
- if (radioTop.Checked)
- {
- _desktopItemPosition = DesktopTypePosition.Top;
- }
- }
- private void radioMiddle_CheckedChanged(object sender, EventArgs e)
- {
- if (radioMiddle.Checked)
- {
- _desktopItemPosition = DesktopTypePosition.Middle;
- }
- }
- private void radioBottom_CheckedChanged(object sender, EventArgs e)
- {
- if (radioBottom.Checked)
- {
- _desktopItemPosition = DesktopTypePosition.Bottom;
- }
- }
- private void ResetIntegratorForm()
- {
- txtItem.Clear();
- txtIcon.Clear();
- checkDefaultIcon.Checked = true;
- txtItemName.Clear();
- if (radioLink.Checked)
- {
- txtItem.Text = "http://";
- }
- }
- private void radioOcean_CheckedChanged(object sender, EventArgs e)
- {
- Options.CurrentOptions.Color = Theme.Ocean;
- Options.ApplyTheme(this);
- }
- private void radioMagma_CheckedChanged(object sender, EventArgs e)
- {
- Options.CurrentOptions.Color = Theme.Magma;
- Options.ApplyTheme(this);
- }
- private void radioZerg_CheckedChanged(object sender, EventArgs e)
- {
- Options.CurrentOptions.Color = Theme.Zerg;
- Options.ApplyTheme(this);
- }
- private void radioMinimal_CheckedChanged(object sender, EventArgs e)
- {
- Options.CurrentOptions.Color = Theme.Minimal;
- Options.ApplyTheme(this);
- }
- private void radioCaramel_CheckedChanged(object sender, EventArgs e)
- {
- Options.CurrentOptions.Color = Theme.Caramel;
- Options.ApplyTheme(this);
- }
- private void radioLime_CheckedChanged(object sender, EventArgs e)
- {
- Options.CurrentOptions.Color = Theme.Lime;
- Options.ApplyTheme(this);
- }
- private void button64_Click(object sender, EventArgs e)
- {
- if (listStartupItems.SelectedItems.Count == 1)
- {
- _startUpItems[listStartupItems.SelectedIndices[0]].LocateKey();
- }
- }
- private void button66_Click(object sender, EventArgs e)
- {
- Integrator.TakeOwnership(false);
- }
- private void button65_Click(object sender, EventArgs e)
- {
- Integrator.TakeOwnership(true);
- }
- private void listStartupItems_ColumnClick(object sender, ColumnClickEventArgs e)
- {
- if (e.Column == _columnSorter.CurrentColumn)
- {
- if (_columnSorter.SortOrder == SortOrder.Ascending)
- {
- _columnSorter.SortOrder = SortOrder.Descending;
- }
- else
- {
- _columnSorter.SortOrder = SortOrder.Ascending;
- }
- }
- else
- {
- _columnSorter.CurrentColumn = e.Column;
- _columnSorter.SortOrder = SortOrder.Ascending;
- }
- listStartupItems.Sort();
- }
- private void chkBlock_CheckedChanged(object sender, EventArgs e)
- {
- if (chkBlock.Checked)
- {
- txtIP.Text = _blockedIP;
- txtIP.Enabled = false;
- }
- else
- {
- txtIP.Clear();
- txtIP.Enabled = true;
- }
- }
- private void button8_Click(object sender, EventArgs e)
- {
- GetCustomCommands();
- }
- private void button26_Click(object sender, EventArgs e)
- {
- if (listCustomCommands.SelectedItems.Count == 1)
- {
- Integrator.DeleteCustomCommand(listCustomCommands.SelectedItem.ToString());
- GetCustomCommands();
- }
- }
- private void button75_Click(object sender, EventArgs e)
- {
- GetModernApps(!chkOnlyRemovable.Checked);
- }
- private void button74_Click(object sender, EventArgs e)
- {
- UninstallModernApps();
- }
- private void chkSelectAllModernApps_CheckedChanged(object sender, EventArgs e)
- {
- for (int i = 0; i < listModernApps.Items.Count; i++)
- {
- listModernApps.SetItemChecked(i, chkSelectAllModernApps.Checked);
- }
- }
- private void btnResetConfig_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show(_resetMessage, "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- Utilities.ResetConfiguration();
- }
- }
- private void toggleSwitch1_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch1.Checked)
- {
- Optimize.EnablePerformanceTweaks();
- }
- else
- {
- Optimize.DisablePerformanceTweaks();
- }
- Options.CurrentOptions.EnablePerformanceTweaks = !toggleSwitch1.Checked;
- }
- private void toggleSwitch2_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch2.Checked)
- {
- Optimize.DisableNetworkThrottling();
- }
- else
- {
- Optimize.EnableNetworkThrottling();
- }
- Options.CurrentOptions.DisableNetworkThrottling = !toggleSwitch2.Checked;
- }
- private void toggleSwitch3_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch3.Checked)
- {
- Optimize.DisableDefender();
- }
- else
- {
- Optimize.EnableDefender();
- }
- Options.CurrentOptions.DisableWindowsDefender = !toggleSwitch3.Checked;
- }
- private void toggleSwitch4_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch4.Checked)
- {
- Optimize.DisableSystemRestore();
- }
- else
- {
- Optimize.EnableSystemRestore();
- }
- Options.CurrentOptions.DisableSystemRestore = !toggleSwitch4.Checked;
- }
- private void toggleSwitch5_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch5.Checked)
- {
- Optimize.DisablePrintService();
- }
- else
- {
- Optimize.EnablePrintService();
- }
- Options.CurrentOptions.DisablePrintService = !toggleSwitch5.Checked;
- }
- private void toggleSwitch6_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch6.Checked)
- {
- Optimize.DisableMediaPlayerSharing();
- }
- else
- {
- Optimize.EnableMediaPlayerSharing();
- }
- Options.CurrentOptions.DisableMediaPlayerSharing = !toggleSwitch6.Checked;
- }
- private void toggleSwitch8_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch8.Checked)
- {
- Optimize.DisableErrorReporting();
- }
- else
- {
- Optimize.EnableErrorReporting();
- }
- Options.CurrentOptions.DisableErrorReporting = !toggleSwitch8.Checked;
- }
- private void toggleSwitch9_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch9.Checked)
- {
- Optimize.DisableHomeGroup();
- }
- else
- {
- Optimize.EnableHomeGroup();
- }
- Options.CurrentOptions.DisableHomeGroup = !toggleSwitch9.Checked;
- }
- private void toggleSwitch10_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch10.Checked)
- {
- Optimize.DisableSuperfetch();
- }
- else
- {
- Optimize.EnableSuperfetch();
- }
- Options.CurrentOptions.DisableSuperfetch = !toggleSwitch10.Checked;
- }
- private void toggleSwitch11_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch11.Checked)
- {
- Optimize.DisableTelemetryTasks();
- }
- else
- {
- Optimize.EnableTelemetryTasks();
- }
- Options.CurrentOptions.DisableTelemetryTasks = !toggleSwitch11.Checked;
- }
- private void toggleSwitch12_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch12.Checked)
- {
- Optimize.DisableOffice2016Telemetry();
- }
- else
- {
- Optimize.EnableOffice2016Telemetry();
- }
- Options.CurrentOptions.DisableOffice2016Telemetry = !toggleSwitch12.Checked;
- }
- private void toggleSwitch13_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch13.Checked)
- {
- Optimize.EnableLegacyVolumeSlider();
- }
- else
- {
- Optimize.DisableLegacyVolumeSlider();
- }
- Options.CurrentOptions.EnableLegacyVolumeSlider = !toggleSwitch13.Checked;
- }
- private void toggleSwitch19_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch19.Checked)
- {
- Optimize.EnableTaskbarColor();
- }
- else
- {
- Optimize.DisableTaskbarColor();
- }
- Options.CurrentOptions.EnableTaskbarColor = !toggleSwitch19.Checked;
- }
- private void toggleSwitch18_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch18.Checked)
- {
- Optimize.DisableQuickAccessHistory();
- }
- else
- {
- Optimize.EnableQuickAccessHistory();
- }
- Options.CurrentOptions.DisableQuickAccessHistory = !toggleSwitch18.Checked;
- }
- private void toggleSwitch26_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch26.Checked)
- {
- Optimize.DisableStartMenuAds();
- }
- else
- {
- Optimize.EnableStartMenuAds();
- }
- Options.CurrentOptions.DisableStartMenuAds = !toggleSwitch26.Checked;
- }
- private void toggleSwitch27_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch27.Checked)
- {
- Optimize.EnableDarkTheme();
- }
- else
- {
- Optimize.EnableLightTheme();
- }
- Options.CurrentOptions.EnableDarkTheme = !toggleSwitch27.Checked;
- }
- private void toggleSwitch14_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch14.Checked)
- {
- Task t = new Task(() => Optimize.UninstallOneDrive());
- t.Start();
- }
- else
- {
- Task t = new Task(() => Optimize.InstallOneDrive());
- t.Start();
- }
- Options.CurrentOptions.UninstallOneDrive = !toggleSwitch14.Checked;
- }
- private void toggleSwitch25_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch25.Checked)
- {
- Optimize.DisableMyPeople();
- }
- else
- {
- Optimize.EnableMyPeople();
- }
- Options.CurrentOptions.DisableMyPeople = !toggleSwitch25.Checked;
- }
- private void toggleSwitch24_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch24.Checked)
- {
- Optimize.DisableAutomaticUpdates();
- }
- else
- {
- Optimize.EnableAutomaticUpdates();
- }
- Options.CurrentOptions.DisableAutomaticUpdates = !toggleSwitch24.Checked;
- }
- private void toggleSwitch30_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch30.Checked)
- {
- Optimize.ExcludeDrivers();
- }
- else
- {
- Optimize.IncludeDrivers();
- }
- Options.CurrentOptions.ExcludeDrivers = !toggleSwitch30.Checked;
- }
- private void toggleSwitch23_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch23.Checked)
- {
- Optimize.DisableTelemetryServices();
- }
- else
- {
- Optimize.EnableTelemetryServices();
- }
- Options.CurrentOptions.DisableTelemetryServices = !toggleSwitch23.Checked;
- }
- private void toggleSwitch21_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch21.Checked)
- {
- Optimize.DisablePrivacyOptions();
- }
- else
- {
- Optimize.EnablePrivacyOptions();
- }
- Options.CurrentOptions.DisablePrivacyOptions = !toggleSwitch21.Checked;
- }
- private void toggleSwitch22_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch22.Checked)
- {
- Optimize.DisableSilentAppInstall();
- }
- else
- {
- Optimize.EnableSilentAppInstall();
- }
- Options.CurrentOptions.DisableSilentAppInstall = !toggleSwitch22.Checked;
- }
- private void toggleSwitch16_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch16.Checked)
- {
- Optimize.DisableCortana();
- }
- else
- {
- Optimize.EnableCortana();
- }
- Options.CurrentOptions.DisableCortana = !toggleSwitch16.Checked;
- }
- private void toggleSwitch20_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch20.Checked)
- {
- Optimize.DisableSensorServices();
- }
- else
- {
- Optimize.EnableSensorServices();
- }
- Options.CurrentOptions.DisableSensorServices = !toggleSwitch20.Checked;
- }
- private void toggleSwitch29_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch29.Checked)
- {
- Optimize.DisableWindowsInk();
- }
- else
- {
- Optimize.EnableWindowsInk();
- }
- Options.CurrentOptions.DisableWindowsInk = !toggleSwitch29.Checked;
- }
- private void toggleSwitch28_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch28.Checked)
- {
- Optimize.DisableSpellingAndTypingFeatures();
- }
- else
- {
- Optimize.EnableSpellingAndTypingFeatures();
- }
- Options.CurrentOptions.DisableSpellingTyping = !toggleSwitch28.Checked;
- }
- private void toggleSwitch17_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch17.Checked)
- {
- Optimize.DisableXboxLive();
- }
- else
- {
- Optimize.EnableXboxLive();
- }
- Options.CurrentOptions.DisableXboxLive = !toggleSwitch17.Checked;
- }
- private void toggleSwitch15_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch15.Checked)
- {
- Optimize.DisableGameBar();
- }
- else
- {
- Optimize.EnableGameBar();
- }
- Options.CurrentOptions.DisableGameBar = !toggleSwitch15.Checked;
- }
- private void toggleSwitch31_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch31.Checked)
- {
- Optimize.DisableOneDrive();
- }
- else
- {
- Optimize.EnableOneDrive();
- }
- Options.CurrentOptions.DisableOneDrive = !toggleSwitch31.Checked;
- }
- private void toggleSwitch32_Click(object sender, EventArgs e)
- {
- if (!toggleSwitch32.Checked)
- {
- Optimize.DisableCompatibilityAssistant();
- }
- else
- {
- Optimize.EnableCompatibilityAssistant();
- }
- Options.CurrentOptions.DisableCompatibilityAssistant = !toggleSwitch32.Checked;
- }
- private void btnUpdate_Click(object sender, EventArgs e)
- {
- CheckForUpdate();
- }
- private void btnChangelog_Click(object sender, EventArgs e)
- {
- try
- {
- Process.Start(_changelogLink);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- private void chkReadOnly_CheckedChanged(object sender, EventArgs e)
- {
- HostsHelper.ReadOnly(chkReadOnly.Checked);
- button47.Enabled = !chkReadOnly.Checked;
- button46.Enabled = !chkReadOnly.Checked;
- button42.Enabled = !chkReadOnly.Checked;
- button41.Enabled = !chkReadOnly.Checked;
- linkLabel4.Enabled = !chkReadOnly.Checked;
- chkBlock.Enabled = !chkReadOnly.Checked;
- txtDomain.Enabled = !chkReadOnly.Checked;
- txtIP.Enabled = !chkReadOnly.Checked;
- button1.Enabled = !chkReadOnly.Checked;
- button2.Enabled = !chkReadOnly.Checked;
- button3.Enabled = !chkReadOnly.Checked;
- button4.Enabled = !chkReadOnly.Checked;
- txtIP.Focus();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- HostsHelper.AdblockBasic();
- GetHostsEntries();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- HostsHelper.AdBlockWithPorn();
- GetHostsEntries();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- HostsHelper.AdBlockWithSocial();
- GetHostsEntries();
- }
- private void button4_Click(object sender, EventArgs e)
- {
- HostsHelper.AdBlockWithSocial();
- GetHostsEntries();
- }
- private void RenderAppDownloaderBusy()
- {
- btnDownloadApps.Enabled = false;
- button5.Enabled = false;
- txtDownloadFolder.ReadOnly = true;
- linkLabel1.Visible = false;
- }
- private void RenderAppDownloaderFree()
- {
- btnDownloadApps.Enabled = true;
- button5.Enabled = true;
- txtDownloadFolder.ReadOnly = false;
- linkLabel1.Visible = !string.IsNullOrEmpty(downloadLog);
- txtDownloadStatus.Text = "Finished";
- }
- string appNameTemp = string.Empty;
- int maxCount = 0;
- int count = 0;
- Process p;
- string downloadLog = string.Empty;
- private async void btnDownloadApps_Click(object sender, EventArgs e)
- {
- if (!Directory.Exists(txtDownloadFolder.Text))
- {
- MessageBox.Show("Download folder specified is not valid!", "Invalid folder", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- RenderAppDownloaderBusy();
- maxCount = 0;
- count = 0;
- downloadLog = string.Empty;
- foreach (Control c in Utilities.GetSelfAndChildrenRecursive(appsTab))
- {
- if (c.Name == "cAutoInstall") continue;
- if (c is ColoredCheckBox && ((ColoredCheckBox)c).Checked) maxCount++;
- }
- ColoredCheckBox currentCheck;
- Control[] temp;
- foreach (AppInfo x in apps.Apps)
- {
- if (string.IsNullOrEmpty(x.Tag)) continue;
- temp = appsTab.Controls.Find(x.Tag, true);
- if (temp.Count() == 0) continue;
- currentCheck = (ColoredCheckBox)temp[0];
- if (currentCheck == null) continue;
- if (!currentCheck.Checked) continue;
- appNameTemp = x.Title;
- if (c64.Checked)
- {
- count++;
- if (string.IsNullOrEmpty(x.Link64))
- {
- downloadLog += "• " + x.Title + ":" + Environment.NewLine + "No 64-bit available, downloading 32-bit" + Environment.NewLine + Environment.NewLine;
- await DownloadApp(x, false);
- }
- else
- {
- await DownloadApp(x, true);
- }
- }
- else
- {
- count++;
- if (!string.IsNullOrEmpty(x.Link))
- {
- await DownloadApp(x, false);
- }
- else
- {
- downloadLog += "• " + x.Title + ":" + Environment.NewLine + "No 32-bit available, skipping" + Environment.NewLine + Environment.NewLine;
- }
- }
- }
- if (cAutoInstall.Checked)
- {
- count = 0;
- foreach (string a in Directory.GetFiles(txtDownloadFolder.Text, "*.*", SearchOption.TopDirectoryOnly))
- {
- using (p = new Process())
- {
- count++;
- p.StartInfo.FileName = a;
- p.EnableRaisingEvents = true;
- p.StartInfo.WorkingDirectory = txtDownloadFolder.Text;
- // APP-SPECIFIC HACKS //
- if (a.Contains("Sumatra")) p.StartInfo.Arguments = " -install";
- // *** //
- txtDownloadStatus.Text = string.Format("{0}/{1} - Installing {2} ...", count, maxCount, Path.GetFileNameWithoutExtension(a));
- await p.RunAsync();
- };
- }
- }
- RenderAppDownloaderFree();
- }
- string fileExtension = ".exe";
- private async Task DownloadApp(AppInfo app, bool pref64)
- {
- try
- {
- using (WebClient downloader = new WebClient())
- {
- downloader.Headers.Add("User-Agent: Other");
- downloader.Encoding = Encoding.UTF8;
- downloader.DownloadProgressChanged += Downloader_DownloadProgressChanged;
- downloader.DownloadFileCompleted += Downloader_DownloadFileCompleted;
- if (pref64)
- {
- if (app.Link64.Contains(".msi"))
- {
- fileExtension = ".msi";
- }
- else
- {
- fileExtension = ".exe";
- }
- await downloader.DownloadFileTaskAsync(new Uri(app.Link64), Path.Combine(txtDownloadFolder.Text, app.Title + "-x64" + fileExtension));
- }
- else
- {
- if (app.Link.Contains(".msi"))
- {
- fileExtension = ".msi";
- }
- else
- {
- fileExtension = ".exe";
- }
- await downloader.DownloadFileTaskAsync(new Uri(app.Link), Path.Combine(txtDownloadFolder.Text, app.Title + "-x86" + fileExtension));
- }
- }
- }
- catch (Exception)
- {
- downloadLog += "• " + app.Title + ":" + Environment.NewLine + "Link is no longer valid!" + Environment.NewLine + Environment.NewLine;
- if (pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x64.exe")); } catch { }
- if (!pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x86.exe")); } catch { }
- if (pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x64.msi")); } catch { }
- if (!pref64) try { File.Delete(Path.Combine(txtDownloadFolder.Text, app.Title + "-x86.msi")); } catch { }
- }
- }
- private void Downloader_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
- {
- this.BeginInvoke((MethodInvoker)delegate
- {
- txtDownloadStatus.Text = "Finished";
- });
- }
- int tempProgress;
- private void Downloader_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
- {
- this.BeginInvoke((MethodInvoker)delegate
- {
- double bytesIn = double.Parse(e.BytesReceived.ToString());
- double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
- double percentage = bytesIn / totalBytes * 100;
- tempProgress = int.Parse(Math.Truncate(percentage).ToString());
- // if Content-Length header is missing, just show an animation
- if (Math.Abs(tempProgress) > 100)
- {
- txtDownloadStatus.Text = string.Format("({1}/{2}) - {0} ...", appNameTemp, count, maxCount);
- progressDownloader.Style = ProgressBarStyle.Marquee;
- }
- // if not, show actual progress
- else
- {
- txtDownloadStatus.Text = string.Format("({1}/{2}) - {0} - {3} / {4}", appNameTemp, count, maxCount, ByteSize.FromBytes(e.BytesReceived).ToString("MB"), ByteSize.FromBytes(e.TotalBytesToReceive).ToString("MB"));
- progressDownloader.Style = ProgressBarStyle.Continuous;
- progressDownloader.Value = tempProgress;
- }
- });
- }
- private void button5_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog d = new FolderBrowserDialog();
- if (d.ShowDialog() == DialogResult.OK)
- {
- txtDownloadFolder.Text = d.SelectedPath;
- Options.CurrentOptions.AppsFolder = d.SelectedPath;
- Options.SaveSettings();
- }
- }
- private void button6_Click(object sender, EventArgs e)
- {
- Process.Start(txtDownloadFolder.Text);
- }
- private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- InfoForm lf = new InfoForm(downloadLog);
- lf.ShowDialog(this);
- }
- private void txtDownloadFolder_TextChanged(object sender, EventArgs e)
- {
- Options.CurrentOptions.AppsFolder = txtDownloadFolder.Text;
- Options.SaveSettings();
- }
- private void chkOnlyRemovable_CheckedChanged(object sender, EventArgs e)
- {
- GetModernApps(!chkOnlyRemovable.Checked);
- }
- }
- }
|