예제 #1
0
        private void InstallPlugin_Click(object sender, EventArgs e)
        {
            _plugins.Checked = true;
            if (!IsPluginDirectoryValid())
            {
                MessageBox.Show("Your plugin directory is not valid. It is either blank or doesn't exist.\r\n\r\nPlease ensure this is configured before installing a plugin.", "Invalid plugin directory", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            using (PluginForm form = new PluginForm())
            {
                try
                {
                    form.OK.FlatStyle = FlatStyle.System;
                    SendMessage(form.OK.Handle, BCM_SETSHIELD, 0, 0xFFFFFFFF);
                }
                catch
                {
                }

                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string           agentKey   = _agentKey.Text;
                string           installKey = form.InstallKey.Text;
                ProcessStartInfo info       = new ProcessStartInfo(PluginHelperExe);
                info.UseShellExecute = true;
                info.Verb            = "runas";
                info.Arguments       = string.Format("{0} \"{1}\" {2} \"{3}\" \"{4}\" {5} {6} {7} \"{8}\" {9} \"{10}\"",
                                                     _url.Text,
                                                     _agentKey.Text,
                                                     _iis.Checked,
                                                     _plugins.Checked ? _pluginDirectory.Text : string.Empty,
                                                     _mongoDB.Checked ? _mongoDBConnectionString.Text : string.Empty,
                                                     _dbStats.Checked,
                                                     _replSet.Checked,
                                                     _sqlServer.Checked,
                                                     _customPrefix.Checked ? _customPrefixValue.Text : string.Empty,
                                                     _eventViewer.Checked,
                                                     installKey);

                try
                {
                    Process p = new Process();
                    p.StartInfo = info;
                    p.Start();
                    Close();
                }
                catch
                {
                    MessageBox.Show("There was an error installing your plugin.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #2
0
        private void InstallPlugin_Click(object sender, EventArgs e)
        {
            _plugins.Checked = true;
            if (!IsPluginDirectoryValid())
            {
                MessageBox.Show("Your plugin directory is not valid. It is either blank or doesn't exist.\r\n\r\nPlease ensure this is configured before installing a plugin.", "Invalid plugin directory", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            using (PluginForm form = new PluginForm())
            {
                try
                {
                    form.OK.FlatStyle = FlatStyle.System;
                    SendMessage(form.OK.Handle, BCM_SETSHIELD, 0, 0xFFFFFFFF);
                }
                catch
                {
                }

                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string agentKey = _agentKey.Text;
                string installKey = form.InstallKey.Text;
                ProcessStartInfo info = new ProcessStartInfo(PluginHelperExe);
                info.UseShellExecute = true;
                info.Verb = "runas";
                info.Arguments = string.Format("{0} \"{1}\" {2} \"{3}\" \"{4}\" {5} {6} {7} \"{8}\" {9} \"{10}\"",
                    _url.Text,
                    _agentKey.Text,
                    _iis.Checked,
                    _plugins.Checked ? _pluginDirectory.Text : string.Empty,
                    _mongoDB.Checked ? _mongoDBConnectionString.Text : string.Empty,
                    _dbStats.Checked,
                    _replSet.Checked,
                    _sqlServer.Checked,
                    _customPrefix.Checked ? _customPrefixValue.Text : string.Empty,
                    _eventViewer.Checked,
                    installKey);

                try
                {
                    Process p = new Process();
                    p.StartInfo = info;
                    p.Start();
                    Close();
                }
                catch
                {
                    MessageBox.Show("There was an error installing your plugin.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }