private void ViewDiffExternal(string currentFilePath, string destFilePath) { if (compareApplicationPath != "") { if (File.Exists(compareApplicationPath)) { try { System.Diagnostics.Process.Start(compareApplicationPath, string.Format("\"{0}\" \"{1}\"", currentFilePath, destFilePath)); } catch (Exception ex) { MessageBox.Show(string.Format("在运行程序{0}时产生异常:" + ex.Message, compareApplicationPath), "文件比较", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("请先配置默认的比对程序!", "文件比较", MessageBoxButtons.OK, MessageBoxIcon.Information); ConfigForm cForm = new ConfigForm(compareApplicationPath); if (cForm.ShowDialog() == DialogResult.OK) { UpdateConfigInfo(cForm); if (File.Exists(compareApplicationPath)) { try { System.Diagnostics.Process.Start(compareApplicationPath, string.Format("{0} {1}", currentFilePath, destFilePath)); } catch (Exception ex) { MessageBox.Show(string.Format("在运行程序{0}时产生异常:" + ex.Message, compareApplicationPath), "文件比较", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }
/// <summary> /// 配置程序参数 /// </summary> /// <param name="sender">事件发送者</param> /// <param name="e">事件参数</param> private void bSet_Click(object sender, EventArgs e) { ConfigForm cForm = new ConfigForm(compareApplicationPath); if (cForm.ShowDialog() == DialogResult.OK) { UpdateConfigInfo(cForm); } }
/// <summary> /// 更新配置信息 /// </summary> /// <param name="cForm">配置窗体对象</param> private void UpdateConfigInfo(ConfigForm cForm) { compareApplicationPath = cForm.FilePath; compareTabFile = cForm.CompareTabFile; compareTxtFile = cForm.CompareTxtFile; compareIniFile = cForm.CompareIniFile; compareLuaFile = cForm.CompareLuaFile; compareLSFile = cForm.CompareLSFile; compareLHFile = cForm.CompareLHFile; compareLogicalFile = cForm.CompareLogicalFile; compareOtherFile = cForm.CompareOtherFile; FileFolderHelper.WriteIniFile("General", "compareApplicationPath", compareApplicationPath, Application.StartupPath + "/config.ini"); }