public StrongNamer(StrongNameOptions options)
 {
     this.Options = options;
 }
        private void btnOK_Click(object sender, EventArgs e)
        {
            //if (SimpleMessage.ShowInfo("Are you sure to remove Strong Name of selected assemblies?",
            //    "Confirm",
            //    MessageBoxButtons.YesNo, MessageBoxIcon.Question,
            //    MessageBoxDefaultButton.Button2) == DialogResult.No)
            //{
            //    return;
            //}

            if (_sourceDir != null && _sourceDir.Equals(txtOutputDir.Text))
                Config.SNOutputDir = String.Empty;
            else
                Config.SNOutputDir = txtOutputDir.Text;


            if (rbSign.Checked)
            {
                string keyFile = txtKeyFile.Text;
                if (String.IsNullOrEmpty(keyFile))
                {
                    SimpleMessage.ShowInfo("Please choose key file.");
                    return;
                }

                if (!String.IsNullOrEmpty(keyFile) && !File.Exists(keyFile))
                {
                    SimpleMessage.ShowInfo("Invalid key file");
                    return;
                }

                if (!String.IsNullOrEmpty(keyFile))
                {
                    Config.StrongKeyFile = keyFile;
                }
            }

            Config.SNAdditionalOptions = txtAdditionalOptions.Text;

            bool resolveDirAdded1 = false;
            bool resolveDirAdded2 = false;
            try
            {
                resolveDirAdded1 = _host.AddAssemblyResolveDir(this._sourceDir);
                resolveDirAdded2 = _host.AddAssemblyResolveDir(txtOutputDir.Text);

                Utils.EnableUI(this.Controls, false);

                StrongNameOptions options = new StrongNameOptions();

                options.Host = _host;
                options.Rows = _rows;
                options.SourceDir = _sourceDir;
                options.OutputDir = txtOutputDir.Text;
                options.TextInfoBox = txtInfo;
                options.AdditionalOptions = txtAdditionalOptions.Text;

                options.chkQuietChecked = chkQuiet.Checked;
                options.chkOverwriteOriginalFileChecked = chkOverwrite.Checked;
                options.rbRemoveChecked = rbRemoveSN.Checked;
                options.rbSignChecked = rbSign.Checked;
                options.rbVrChecked = rbVr.Checked;
                options.rbVlChecked = rbVl.Checked;
                options.rbvfChecked = rbvf.Checked;
                options.rbVxChecked = rbVx.Checked;
                options.rbVuChecked = rbVu.Checked;
                options.rbRaChecked = false;
                options.rbCustomChecked = rbCustom.Checked;
                options.rbGacInstallChecked = rbGacInstall.Checked;
                options.rbGacRemoveChecked = rbGacRemove.Checked;
                options.KeyFile = txtKeyFile.Text;

                new StrongNamer(options).Go();

            }
            catch(Exception ex)
            {
                SimpleMessage.ShowException(ex);
            }
            finally
            {
                if(resolveDirAdded1)
                    _host.RemoveAssemblyResolveDir(this._sourceDir);
                if(resolveDirAdded2)
                    _host.RemoveAssemblyResolveDir(txtOutputDir.Text);
                Utils.EnableUI(this.Controls, true);
            }
        }