private void btnHelp_Click(object sender, EventArgs e)
        {
            AsmOptions options = new AsmOptions();

            options.Host        = _host;
            options.SourceDir   = _sourceDir;
            options.TextInfoBox = txtInfo;

            new Assembler(options).Help();
        }
 public Assembler(AsmOptions options)
     : base(options)
 {
 }
 public Assembler(AsmOptions options)
     : base(options)
 {
 }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_rows == null || _rows.Length == 0)
            {
                SimpleMessage.ShowInfo("No file found");
                return;
            }

            string outputDir = txtOutputDir.Text;

            if (!Directory.Exists(outputDir))
            {
                SimpleMessage.ShowInfo("Please choose output directory");
                return;
            }

            string keyFile = rbSNSign.Checked ? txtKeyFile.Text : String.Empty;

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

            if (_sourceDir != null && _sourceDir.Equals(outputDir))
            {
                Config.AsmOutputDir = String.Empty;
            }
            else
            {
                Config.AsmOutputDir = outputDir;
            }

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


            if (chkReplaceToken.Checked)
            {
                if (txtOldToken.Text.Trim().Length != 16 ||
                    txtNewToken.Text.Trim().Length != 16
                    )
                {
                    SimpleMessage.ShowInfo("Invalid public key token");
                    return;
                }
                if (txtOldToken.Text.Trim().Equals(txtNewToken.Text.Trim(), StringComparison.CurrentCultureIgnoreCase))
                {
                    SimpleMessage.ShowInfo("Public key token cannot be same.");
                    txtNewToken.Text = String.Empty;
                    return;
                }
            }


            Config.AsmAdditionalOptions = txtAdditionalOptions.Text;

            try
            {
                Utils.EnableUI(this.Controls, false);

                AsmOptions options = new AsmOptions();

                options.Host        = _host;
                options.Rows        = _rows;
                options.SourceDir   = _sourceDir;
                options.OutputDir   = outputDir;
                options.TextInfoBox = txtInfo;

                options.chkQuietChecked    = chkQuiet.Checked;
                options.rbDllChecked       = rbTypeDll.Checked;
                options.rbExeChecked       = rbTypeExe.Checked;
                options.rbDebugChecked     = rbDbg.Checked;
                options.rbDebugImplChecked = rbDbgImpl.Checked;
                options.rbDebugOptChecked  = rbDbgOpt.Checked;
                options.chkClockChecked    = chkClock.Checked;
                options.chkNoLogoChecked   = chkNoLogo.Checked;
                options.chkOptimizeChecked = chkOptimize.Checked;
                options.chkItaniumChecked  = chkItanium.Checked;
                options.chkX64Checked      = chkX64.Checked;

                if (rbSNSign.Checked)
                {
                    options.KeyFile = txtKeyFile.Text;
                }
                options.rbRemoveStrongNameChecked       = rbSNRemove.Checked;
                options.chkRemoveLicenseProviderChecked = chkRemoveLicenseProvider.Checked;
                options.chkReplaceTokenChecked          = chkReplaceToken.Checked;
                if (chkReplaceToken.Checked)
                {
                    options.txtOldTokenText = txtOldToken.Text;
                    options.txtNewTokenText = txtNewToken.Text;
                    options.ReplKeyFile     = _replKeyFile;
                }
                options.AdditionalOptions = txtAdditionalOptions.Text;

                new Assembler(options).Go();
            }
            catch
            {
                throw;
            }
            finally
            {
                Utils.EnableUI(this.Controls, true);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_rows == null || _rows.Length == 0)
            {
                SimpleMessage.ShowInfo("No file found");
                return;
            }

            string outputDir = txtOutputDir.Text;
            if (!Directory.Exists(outputDir))
            {
                SimpleMessage.ShowInfo("Please choose output directory");
                return;
            }

            string keyFile = rbSNSign.Checked ? txtKeyFile.Text : String.Empty;
            if (!String.IsNullOrEmpty(keyFile) && !File.Exists(keyFile))
            {
                SimpleMessage.ShowInfo("Invalid key file");
                return;
            }

            if (_sourceDir != null && _sourceDir.Equals(outputDir))
                Config.AsmOutputDir = String.Empty;
            else
                Config.AsmOutputDir = outputDir;

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

            if (chkReplaceToken.Checked)
            {
                if (txtOldToken.Text.Trim().Length != 16 ||
                    txtNewToken.Text.Trim().Length != 16
                    )
                {
                    SimpleMessage.ShowInfo("Invalid public key token");
                    return;
                }
                if (txtOldToken.Text.Trim().Equals(txtNewToken.Text.Trim(), StringComparison.CurrentCultureIgnoreCase))
                {
                    SimpleMessage.ShowInfo("Public key token cannot be same.");
                    txtNewToken.Text = String.Empty;
                    return;
                }
            }


            Config.AsmAdditionalOptions = txtAdditionalOptions.Text;

            try
            {
                Utils.EnableUI(this.Controls, false);

                AsmOptions options = new AsmOptions();

                options.Host = _host;
                options.Rows = _rows;
                options.SourceDir = _sourceDir;
                options.OutputDir = outputDir;
                options.TextInfoBox = txtInfo;

                options.chkQuietChecked = chkQuiet.Checked;
                options.rbDllChecked = rbTypeDll.Checked;
                options.rbExeChecked = rbTypeExe.Checked;
                options.rbDebugChecked = rbDbg.Checked;
                options.rbDebugImplChecked = rbDbgImpl.Checked;
                options.rbDebugOptChecked = rbDbgOpt.Checked;
                options.chkClockChecked = chkClock.Checked;
                options.chkNoLogoChecked = chkNoLogo.Checked;
                options.chkOptimizeChecked = chkOptimize.Checked;
                options.chkItaniumChecked = chkItanium.Checked;
                options.chkX64Checked = chkX64.Checked;

                if (rbSNSign.Checked)
                {
                    options.KeyFile = txtKeyFile.Text;
                }
                options.rbRemoveStrongNameChecked = rbSNRemove.Checked;
                options.chkRemoveLicenseProviderChecked = chkRemoveLicenseProvider.Checked;
                options.chkReplaceTokenChecked = chkReplaceToken.Checked;
                if (chkReplaceToken.Checked)
                {
                    options.txtOldTokenText = txtOldToken.Text;
                    options.txtNewTokenText = txtNewToken.Text;
                    options.ReplKeyFile = _replKeyFile;
                }
                options.AdditionalOptions = txtAdditionalOptions.Text;

                new Assembler(options).Go();

            }
            catch
            {
                throw;
            }
            finally
            {
                Utils.EnableUI(this.Controls, true);
            }
            
        }  
        private void btnHelp_Click(object sender, EventArgs e)
        {
            AsmOptions options = new AsmOptions();

            options.Host = _host;
            options.SourceDir = _sourceDir;
            options.TextInfoBox = txtInfo;

            new Assembler(options).Help();
        }