private void localDirTextBox_TextChanged(object sender, EventArgs e) { return; string filepach = this.localDirTextBox.Text; AppCfg.setItem(AppCfg.localImgDir, filepach); }
private void rootDirComboBoxSelectedChanged(object sender, EventArgs e) { this.listViewData.Items.Clear(); this.listXlsx.Clear(); int index = this.rootDirComboBox.SelectedIndex; AppCfg.setItem("selectIndex", index.ToString()); }
private void localDirBtn_Click(object sender, EventArgs e) { FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.Description = "请选择图片存放文件夹"; if (dlg.ShowDialog() == DialogResult.OK) { string filepach = dlg.SelectedPath;//得到路径 this.localDirTextBox.Text = filepach; AppCfg.setItem(AppCfg.localImgDir, filepach); } ; }
// 选择bat文件 private void selectBatBtn_Click(object sender, EventArgs e) { OpenFileDialog fileDlg = new OpenFileDialog(); fileDlg.Title = "请选择bat文件"; fileDlg.Filter = "bat文件|*.bat|所有文件|*.*"; string cfgBatPath = AppCfg.getItem("batPath"); if (cfgBatPath == null)// 目录为空 { // 去json目录找 string path = AppData.exePath; int selectIndex = this.rootDirComboBox.SelectedIndex; if (selectIndex > 0) { // 选中了目录文件 string dir = this.rootListDir[selectIndex - 1]; path = AppData.exePath + "\\" + dir + "\\json"; } fileDlg.InitialDirectory = path; } else { fileDlg.InitialDirectory = cfgBatPath; } fileDlg.Multiselect = false; DialogResult result = fileDlg.ShowDialog(); if (result == DialogResult.OK) { string filename = System.IO.Path.GetFileName(fileDlg.FileName); //得到文件名 string filepach = System.IO.Path.GetDirectoryName(fileDlg.FileName); //得到路径 this.batPathTextBox.Text = fileDlg.FileName; AppCfg.setItem("batFile", fileDlg.FileName); AppCfg.setItem("batPath", filepach); } }
// 保存配置 public static void saveCfg() { int genType = (int)(AppData.genType); AppCfg.setItem(AppCfg.genType, genType.ToString()); }
public static void setGenType(EnumGenType type) { AppData.genType = type; AppCfg.setItem(AppCfg.genType, type.ToString()); }