private void ReadConfiguration()
 {
     string[] serverNameArray = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "sqlserver", "ServerName", ".").Split(',');
     comboBox2.Text = serverNameArray[0];
     comboBox2.Items.Clear();
     foreach (var item in serverNameArray)
     {
         if (!string.IsNullOrEmpty(item))
         {
             comboBox2.Items.Add(item);
         }
     }
     comboBox3.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "sqlserver", "Authentication", "Windows Authentication");
     string[] saLoginArray = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "sqlserver", "SaLogin", "sa").Split(',');
     comboBox4.Items.Clear();
     foreach (var item in saLoginArray)
     {
         if (!string.IsNullOrEmpty(item))
         {
             comboBox4.Items.Add(item);
         }
     }
     if (comboBox3.Text.Equals("SQL Server Authentication"))
     {
         comboBox4.Text = saLoginArray[0];
         textBox1.Text  = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "sqlserver", "SaPassword", "123456");
     }
 }
        private void WriteConfiguration()
        {
            //保存5条信息,默认取第一条,新登录的顶到第一条,删除最后一条,逗号分隔 1,2,3,'',''
            string[] serverNameArray    = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "sqlserver", "ServerName", ".").Split(',');
            string[] newServerNameArray = new string[] { comboBox2.Text, "", "", "", "" };//save 5 lines
            int      newServerNameIndex = 1;

            foreach (var item in serverNameArray)
            {
                if (!newServerNameArray.Contains(item))
                {
                    newServerNameArray[newServerNameIndex] = item;
                    newServerNameIndex++;
                }
            }
            IO_Helper_DG.Ini_Update(CommonVariables.configFilePath, "sqlserver", "ServerName", string.Join(",", newServerNameArray));
            IO_Helper_DG.Ini_Update(CommonVariables.configFilePath, "sqlserver", "Authentication", comboBox3.Text);
            if (checkBox1.Checked)
            {
                string[] saLoginArray    = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "sqlserver", "SaLogin", ".").Split(',');
                string[] newSaLoginArray = new string[] { comboBox4.Text, "", "", "", "" };//save 5 lines
                int      newsaLoginIndex = 1;
                foreach (var item in saLoginArray)
                {
                    if (!newSaLoginArray.Contains(item))
                    {
                        newSaLoginArray[newsaLoginIndex] = item;
                        newsaLoginIndex++;
                    }
                }
                IO_Helper_DG.Ini_Update(CommonVariables.configFilePath, "sqlserver", "SaLogin", string.Join(",", newSaLoginArray));
                IO_Helper_DG.Ini_Update(CommonVariables.configFilePath, "sqlserver", "SaPassword", textBox1.Text);
            }
        }
 private void ReadConfiguration()
 {
     textBox1.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "mysql", "ServerName", "localhost");
     textBox2.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "mysql", "Port", "3306");
     textBox3.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "mysql", "Login", "");
     textBox4.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "mysql", "Password", "");
 }
Beispiel #4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                // set copyright
                label_Author.Text      += Info.Author;
                label_Version.Text     += Info.VersionNum;
                label_Description.Text += Info.Description;

                //set config
                comboBox2.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "config", "outputType");//output type

                //set code builder config
                // textBox3.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "usings").Replace('&','\n'); //using
                textBox2.Text  = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "namespace");              //namespace
                textBox10.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "namespaceCommonPlus");    //namespace
                textBox9.Text  = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "TableName");              //table name
                textBox5.Text  = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "class");                  //class name
                textBox7.Text  = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "ClassNamePlus");          //ClassExtends
                textBox8.Text  = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "ClassExtends");           //ClassExtends
                textBox4.Text  = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "fileName");               //fileName
                comboBox1.Text = IO_Helper_DG.Ini_SelectStringValue(CommonVariables.configFilePath, "code", "fileNameSuffix", ".txt"); //fileNameSuffix

                textBox6.Text = dir + "\\qixiaoCodeBuilder\\";
                colorRichTextBox1.Language = CSharp_FlowchartToCode_DG.Controls.ColorRichTextBox.Languages.SQL;
                colorRichTextBox1.Language = CSharp_FlowchartToCode_DG.Controls.ColorRichTextBox.Languages.SQL;

                dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                dataGridView2.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.AllCells;
                dataGridView1.ColumnHeadersHeight = 22;

                timer1.Interval = 50;//progress refresh time
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }