Exemple #1
0
        void XML_Load(string path, bool isContent = false)
        {
            readImmersiveMenuSettings();

            imageList_Init();
            treeView.Nodes.Clear();

            if (!isContent)
            {
                currentFile = path;
            }

            XmlDocument doc = new XmlDocument();

            if (isContent)
            {
                doc.LoadXml(path);
            }
            else
            {
                doc.Load(path);
            }
            XmlNode rootNode = doc.SelectSingleNode("root");

            XML_Config_Load(rootNode);
            XML_AddMenuItems(rootNode, null);


            if (path.ToLower() == Installer.GetConfigPath().ToLower())
            {
                FormUtils.ShowShield(buttonApply.Handle, true);
            }
        }
Exemple #2
0
        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());
        }
Exemple #3
0
        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;
                }
            }
        }
Exemple #4
0
 private void buttonLoadSysCfg_Click(object sender, EventArgs e)
 {
     XML_Load(Installer.GetConfigPath());
 }