Esempio n. 1
0
        //选择源目录按钮
        private void SelectSourcePathButton_Click(object sender, EventArgs e)
        {
            try
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.Description  = "请选择源目录";
                dialog.SelectedPath = this.SelectSourcePathTextBox.Text.Trim();
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    //重新初始化
                    this.SubDirectoryListBox.Items.Clear();
                    this.FileTypeListBox.Items.Clear();
                    fileTypeMap                 = new HashSet <string>();
                    copyFilePathMap             = new HashSet <string>();
                    subDirectoryList            = new List <string>();
                    selectedSubDirectoryMap     = new HashSet <string>();
                    selectedFileTypeMap         = new HashSet <string>();
                    subDirectoryIndexList       = new List <int>();
                    filePathList                = new List <List <string> >();
                    fileNameList                = new List <List <string> >();
                    this.CopyProgressLabel.Text = "";
                    this.CopyProgressBar.Value  = 0;

                    selectSourcePath = dialog.SelectedPath;
                    //写入配置文件
                    ca.SetValue("selectSourcePath", selectSourcePath);
                    ca.Save();

                    this.SelectSourcePathTextBox.Text = selectSourcePath;

                    UpdatesubDirectoryListBox();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("可能原因:输入路径非有效路径\n" + exc, "发生错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public static void WriteValue(string key, string value, string section = "Others")
 {
     ca.SetValue(section, key, value);
 }