示例#1
0
        private void DoRegister(bool allUsers)
        {
            try
            {
                if (!allUsers)
                {
                    OverrideHKCR();
                }

                var rs = new RegistrationServices();
                rs.RegisterAssembly(Assembly.LoadFrom(Path.Combine(crtDir, @"LEContextMenuHandler.dll")),
                                    AssemblyRegistrationFlags.SetCodeBase);

                ShellExtensionManager.RegisterShellExtContextMenuHandler(allUsers);

                if (!allUsers)
                {
                    OverrideHKCR(true);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message + "\r\n\r\n" + e.StackTrace);
            }
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (Environment.OSVersion.Version.CompareTo(new Version(6, 0)) <= 0)
            {
                MessageBox.Show("Sorry, Locale Emulator is only for Windows 7, 8/8.1 and 10.",
                                "OS Outdated",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                Environment.Exit(0);
            }

            Text += " - V" + GetLEVersion();

            if (IsAdministrator())
            {
                Text += " (Administrator)";

                buttonInstall.Enabled = false;
            }

            DeleteOldFiles();
            ReplaceDll();

            AddShieldToButton(buttonInstallAllUsers);
            AddShieldToButton(buttonUninstallAllUsers);

            buttonUninstall.Enabled         = ShellExtensionManager.IsInstalled(false);
            buttonUninstallAllUsers.Enabled = ShellExtensionManager.IsInstalled(true);
        }