private bool MainProcess(string[] param) { bool rValue = false; try { string source = param[0]; string dest = param[1]; string filter = param[2]; string modifydate = param[3]; string arguments = "\"" + source + "\" \"" + dest + "\" " + filter + " /S /MAXAGE:" + modifydate; ProcessStartInfo ps = new ProcessStartInfo(); ps.FileName = cmdfile; ps.UseShellExecute = false; ps.RedirectStandardOutput = true; ps.CreateNoWindow = true; ps.Arguments = arguments; Process p = Process.Start(ps); //p.WaitForExit(); string output = p.StandardOutput.ReadToEnd(); SetOutput(""); SetOutput(output); p.Close(); //将使用过的路径信息存到配置数据库 narky 20100622 pathDB = new DataClass(configDB); pathDB.SavePath(Base64.EncodeBase64(source)); pathDB.SavePath(Base64.EncodeBase64(dest), 2); pathDB.Close(); MessageBox.Show("文件全部提取成功。所有文件已经提取到 "+dest+" 下。", "文件提取成功", MessageBoxButtons.OK, MessageBoxIcon.Information); rValue = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); //HideProcessStatus(); } return rValue; }
/// <summary> /// 初始化填充路径下拉列表 narky 20100622 /// </summary> private void Init_PathField() { try { pathDB = new DataClass(configDB); } catch (Exception ex) { MessageBox.Show(ex.Message, "严重错误", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(Environment.ExitCode); } DataTable dt = new DataTable(); //来源地址 dt = pathDB.PathData(); this.cbbox_Source.DataSource = dt; this.cbbox_Source.DisplayMember = "pathString"; //目标地址 dt = pathDB.PathData(2); this.cbbox_Dest.DataSource = dt; this.cbbox_Dest.DisplayMember = "pathString"; //文件名过滤器 dt = pathDB.FilterList(); this.cbbox_FilterFiles.DataSource = dt; this.cbbox_FilterFiles.DisplayMember = "filter"; pathDB.Close(); }
private void clearPath(int pathType) { string pathtxt=""; switch(pathType) { case 1: pathtxt="来源"; break; case 2: pathtxt="目标"; break; default: break; } if (DialogResult.OK == confirm("清除" + pathtxt + "目录列表?")) { DataClass dataclass = new DataClass(configDB); dataclass.clearPath(pathType); dataclass.Close(); MessageBox.Show("路径已经清空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void SettingsForm_Load(object sender, EventArgs e) { this.MaximumSize = this.Size; this.MinimumSize = this.Size; DataClass dataclass=new DataClass(configDB); Dictionary<string, string> myDic = dataclass.SettingsDict(); this.tb_pathnum.Text = myDic["path_list_num"]; DataTable dt = dataclass.FilterList(0); foreach (DataRow dr in dt.Rows) { this.list_Filter.Items.Add(dr["filter"].ToString()); } dataclass.Close(); }
private bool setFilter(string filter, int flag) { DataClass dataclass = new DataClass(configDB); return dataclass.setFilter(filter, flag); }
private void saveConf() { Dictionary<string, string> dict = new Dictionary<string, string>(); dict.Add("path_list_num", this.tb_pathnum.Text); //TODO:各种设置 DataClass dataclass = new DataClass(configDB); dataclass.saveSetting(dict); dataclass.Close(); }