static void Main() { if (Environment.GetCommandLineArgs().Length == 4) { if (Environment.GetCommandLineArgs()[1] == "CWP") { if (System.IO.File.Exists(Environment.GetCommandLineArgs()[3])) { System.IO.File.Delete(Environment.GetCommandLineArgs()[3]); } System.IO.File.Move(Environment.GetCommandLineArgs()[2], Environment.GetCommandLineArgs()[3]); } if (Environment.GetCommandLineArgs()[1] == "INSTALL") { bool isX64 = Environment.GetCommandLineArgs()[2] == "X64"; Installer.InstallToSystem(isX64); if (Environment.GetCommandLineArgs()[3] != "?") { Installer.CreateRegConfig(Environment.GetCommandLineArgs()[3]); } if (!System.IO.File.Exists(Installer.GetConfigPath())) { Installer.DeployDefaultConfigFile(); } } Application.Exit(); return; } if (Environment.GetCommandLineArgs().Length == 3) { if (Environment.GetCommandLineArgs()[1] == "STARTUP") { if (Environment.GetCommandLineArgs()[2] == "?") { Installer.RemoveRegConfig(); } else { Installer.CreateRegConfig(Environment.GetCommandLineArgs()[2]); } } if (Environment.GetCommandLineArgs()[1] == "UNINSTALL") { Installer.UninstallFromSystem(Environment.GetCommandLineArgs()[2] != "0"); } if (Environment.GetCommandLineArgs()[1] == "EMT") { Installer.ExplorerImmersiveMenuUsing(Environment.GetCommandLineArgs()[2] != "0"); } Application.Exit(); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); }
private void FormMain_Load(object sender, EventArgs e) { this.Icon = IconManager.GetIcon("shell32.dll", 39, true); if (!System.IO.File.Exists(Installer.GetMenu98Path())) { Installer.ShowInstaller(this); } if (WinVer.IsWin10OrGreater()) { Win10Style.EnableBlur(this.Handle); } else { checkBoxNoExplorerImmersiveMenu.Enabled = false; checkBoxEnableImmersiveMenu.Enabled = false; checkBoxShowIcon.Enabled = false; checkBoxHideToggleOption.Enabled = false; } if (WinVer.IsVistaOrGreater()) { //DPI.SetCurrentProcessDPIAware(); Win7Style.EnableAero(this.Handle, panelExtended.Height, panelMain.Bottom, 0, 0); toolStrip.Renderer = new ToolStripNonClientRender(); } else { toolStrip.Renderer = new ToolStripNonClientRender(SystemColors.Control); toolStrip.Location = new Point(toolStrip.Location.X, toolStrip.Location.Y - 1); this.FormBorderStyle = FormBorderStyle.FixedSingle; this.ControlBox = true; this.Height -= panelMain.Location.Y; this.panelMain.Location = new Point(panelMain.Location.X, 0); this.Text = labelCaption.Text; } panelFrameB.Visible = false; panelFrameT.Visible = false; panelFrameR.Visible = false; panelFrameL.Visible = false; pictureBoxAppIcon.BackgroundImage = this.Icon.ToBitmap(); contextMenuStrip.Renderer = new ToolStripNonClientRender(); comboBoxStyle.SelectedIndex = 0; FormUtils.ShowShield(buttonUpdateStartupCommand.Handle, true); FormUtils.ShowShield(buttonRemoveStartUp.Handle, true); for (int i = 0; i <= MenuControl.OSList.Length; i++) { comboBoxSysVer.Items.Add(MenuControl.GetOSFromIndex(i)); } comboBoxSysVer.SelectedIndex = MenuControl.Os2ListIndex(WinVer.SystemVersion); checkBoxNoExplorerImmersiveMenu.Checked = Installer.ExplorerImmersiveMenuRemoved(); if (System.IO.File.Exists(Installer.GetConfigPath())) { XML_Load(Installer.GetConfigPath()); } else { switch (Installer.ShowSelectConfigFileBox(this)) { case DialogResult.Yes: Installer.DeployDefaultConfigFile(); XML_Load(Installer.GetConfigPath()); break; case DialogResult.No: if (!OpenConfigUsingDialog()) { this.Close(); } break; case DialogResult.Cancel: this.Close(); break; } } }