コード例 #1
0
        private void ShowConfigurations(string selectConfiguration = "")
        {
            listBoxConfigs.BeginUpdate();
            string selectedConfig = selectConfiguration;

            if (String.IsNullOrEmpty(selectConfiguration))
            {
                selectedConfig = ClassFormConfig.ActiveConfiguration;
                if (listBoxConfigs.SelectedIndex >= 0)
                {
                    selectedConfig = (string)listBoxConfigs.SelectedItem;
                }
            }
            listBoxConfigs.Items.Clear();
            foreach (string configName in ClassFormConfig.ConfigurationSetNames())
            {
                int index = listBoxConfigs.Items.Add(configName);
                if (configName.Equals(selectedConfig))
                {
                    listBoxConfigs.SelectedIndex = index;
                }
            }
            listBoxConfigs.EndUpdate();
            textBoxActiveConfiguration.Text = ClassFormConfig.ActiveConfiguration;
        }
コード例 #2
0
        public FormMain(bool DebugLogging)
        {
            InitializeComponent();

            // Add our form configuration helper
            _formConfig = new ConfigurationManager.ClassFormConfig(this, true);
            _formConfig.AddControlTypeRecurseExclusion("SOAPe.XmlEditor");
            _formConfig.ExcludedControls.Add(groupBoxResponse);
            _formConfig.ExcludedControls.Add(xmlEditorResponse);
            _formConfig.ExcludedControls.Add(textBoxHTTPHeaderName);
            _formConfig.ExcludedControls.Add(textBoxHTTPHeaderValue);
            ClassFormConfig.ApplyConfiguration();

            // Configure log file
            if (String.IsNullOrEmpty(textBoxLogFolder.Text))
            {
                textBoxLogFolder.Text = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
            }
            if (String.IsNullOrEmpty(textBoxLogFileName.Text))
            {
                textBoxLogFileName.Text = "SOAPe.log";
            }
            _logger = new ClassLogger(LogFileName(), DebugLogging);

            LoadCertificate(textBoxAuthCertificate.Text);

            this.Text = Application.ProductName + " v" + Application.ProductVersion;
            _logger.DebugLog(this.Text);

            // Hook up the cert callback.
            ServicePointManager.ServerCertificateValidationCallback = ValidateCertificate;

            GetUserSMTPAddress();
            UpdateAuthUI();
            UpdateHTTPHeaderControls();
            UpdateHTTPCookieControls();
            xmlEditorResponse.XmlValidationComplete += xmlEditorResponse_XmlValidationComplete;

            try
            {
                if (!NativeMethods.IsProcessElevated())
                {
                    // The HTTP listener requires elevation, check if we have this  hTTPListenerToolStripMenuItem
                    hTTPListenerToolStripMenuItem.Image = NativeMethods.GetStockIcon(NativeMethods.SHSTOCKICONID.SIID_SHIELD, NativeMethods.SHGSI.SHGSI_ICON).ToBitmap();
                }
            }
            catch { }

            /*
             * if (System.Diagnostics.Debugger.IsAttached)
             * {
             *  FormUserControlTest oForm = new FormUserControlTest();
             *  oForm.Show(this);
             * }
             */
            _logger.DebugLog("Initialisation complete");

            this.Shown += FormMain_Shown;
        }
コード例 #3
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty((string)listBoxConfigs.SelectedItem))
     {
         return;
     }
     if (ClassFormConfig.DeleteConfiguration((string)listBoxConfigs.SelectedItem))
     {
         ShowConfigurations();
     }
 }
コード例 #4
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            FormConfigurationName formGetName = new FormConfigurationName();
            string configName = formGetName.GetConfigName(this);

            if (String.IsNullOrEmpty(configName))
            {
                return;
            }

            ClassFormConfig.SaveNewConfiguration(configName);
            ShowConfigurations();
        }
コード例 #5
0
        private void buttonRename_Click(object sender, EventArgs e)
        {
            if (listBoxConfigs.SelectedIndex < 0)
            {
                return;
            }
            FormConfigurationName formGetName = new FormConfigurationName();
            string configName = formGetName.GetConfigName(this, (string)listBoxConfigs.SelectedItem);

            if (String.IsNullOrEmpty(configName))
            {
                return;
            }
            if (ClassFormConfig.RenameConfiguration((string)listBoxConfigs.SelectedItem, configName))
            {
                ShowConfigurations(configName);
            }
        }
コード例 #6
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     ClassFormConfig.SaveActiveConfiguration();
 }
コード例 #7
0
 private void buttonApply_Click(object sender, EventArgs e)
 {
     ClassFormConfig.ApplyConfiguration((string)listBoxConfigs.SelectedItem);
     textBoxActiveConfiguration.Text = ClassFormConfig.ActiveConfiguration;
 }