📄 formexecute.cs
字号:
/// <param name="e"></param>
private void txtInPath_TextChanged(object sender, System.EventArgs e)
{
m_strInPath = this.txtInPath.Text;
}
/// <summary>
/// 输出路径更改事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtOutPath_TextChanged(object sender, System.EventArgs e)
{
m_strOutPath = this.txtOutPath.Text;
}
/// <summary>
/// 输入路径按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnInPath_Click(object sender, System.EventArgs e)
{
string _strTmp = IOIntegrate.GetDateKeyWord(m_strInPath);
if(Directory.Exists(_strTmp))
this.FBDlgInPath.SelectedPath = _strTmp;
if(this.FBDlgInPath.ShowDialog(this) == DialogResult.OK)
{
_strTmp = this.FBDlgInPath.SelectedPath;
if(!_strTmp.EndsWith(@"\"))
this.txtInPath.Text = _strTmp + @"\";
else
this.txtInPath.Text = _strTmp;
}
}
/// <summary>
/// 输出路径按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnOutPath_Click(object sender, System.EventArgs e)
{
string _strTmp = IOIntegrate.GetDateKeyWord(m_strOutPath);
if(Directory.Exists(_strTmp))
this.FBDlgOutPath.SelectedPath = _strTmp;
if(this.FBDlgOutPath.ShowDialog(this) == DialogResult.OK)
{
_strTmp = this.FBDlgOutPath.SelectedPath;
if(!_strTmp.EndsWith(@"\"))
this.txtOutPath.Text = _strTmp + @"\";
else
this.txtOutPath.Text = _strTmp;
}
}
/// <summary>
/// 文件测试进度
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void m_pPlugInClsMain_OnFileTesting(object sender, FileTestArgs e)
{
this.Text = m_strCaption + " " + e.PassCount.ToString() + "(" + e.FailCount.ToString() + ")/" +
e.TotleCount.ToString();
if(e.Finished)
{
this.btnAdd.Enabled = true;
this.btnCancle.Enabled = true;
this.btnDelete.Enabled = true;
this.btnExecute.Enabled = true;
this.btnExit.Enabled = true;
this.btnFileLocation.Enabled = true;
this.btnInPath.Enabled = true;
this.btnOutPath.Enabled = true;
this.btnSave.Enabled = true;
this.MdiParent.WindowState = FormWindowState.Normal;
if(m_blAutoExit)
this.MdiParent.Close();
}
}
/// <summary>
/// 窗体大小改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FormExecute_Resize(object sender, EventArgs e)
{
this.cHFileName.Width = this.lvFileList.Width - 142;
}
/// <summary>
/// 测试项目更改事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cbTestProject_SelectedIndexChanged(object sender, System.EventArgs e)
{
m_nTestProject = this.cbTestProject.SelectedIndex;
}
/// <summary>
/// 是否用安静模式
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void chbShowWin_CheckedChanged(object sender, System.EventArgs e)
{
if(m_blShowWin && this.chbShowWin.Checked)
m_blShowWin = true;
else if(!m_blShowWin && !this.chbShowWin.Checked)
m_blShowWin = false;
else if(m_blShowWin && !this.chbShowWin.Checked)
m_blShowWin = false;
else
m_blShowWin = true;
}
#endregion
#region 程序启动和关闭事件
/// <summary>
/// 程序启动事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FormExecute_Load(object sender, System.EventArgs e)
{
ReadConfig();
if(m_blAutoStart)
this.btnExecute_Click(null, null);
}
/// <summary>
/// 程序关闭事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FormExecute_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
SaveConfig();
}
#endregion
#region 读取和保存配置
/// <summary>
/// 读取配置
/// </summary>
/// <returns>返回读取是否成功</returns>
private bool ReadConfig()
{
this.cbTestProject.SelectedIndex = 0;
XmlDocument m_pXmlDocu = new XmlDocument();
if(File.Exists(m_strCfgFileName))
{
m_pXmlDocu.Load(m_strCfgFileName);
XmlElement m_pDocuRootEle = m_pXmlDocu.DocumentElement;
// 读取选项设置信息[4/6/2005]
XmlNode m_pXmlOptionNode = m_pDocuRootEle.SelectSingleNode("PasswordTest/Option");
if(m_pXmlOptionNode != null)
{
XmlNode _pXmlTmpNode = m_pXmlOptionNode.SelectSingleNode("TestProject");
if(_pXmlTmpNode != null)
this.cbTestProject.SelectedIndex = Convert.ToInt32(_pXmlTmpNode.InnerText);
_pXmlTmpNode = m_pXmlOptionNode.SelectSingleNode("ShowWin");
if(_pXmlTmpNode != null && _pXmlTmpNode.InnerText == "True")
this.chbShowWin.Checked = true;
_pXmlTmpNode = m_pXmlOptionNode.SelectSingleNode("InFile");
if(_pXmlTmpNode != null)
m_strInFile = _pXmlTmpNode.InnerText;
_pXmlTmpNode = m_pXmlOptionNode.SelectSingleNode("InPath");
if(_pXmlTmpNode != null)
m_strInPath = _pXmlTmpNode.InnerText;
_pXmlTmpNode = m_pXmlOptionNode.SelectSingleNode("OutPath");
if(_pXmlTmpNode != null)
m_strOutPath = _pXmlTmpNode.InnerText;
}
XmlNode m_pXmlFileListNode = m_pDocuRootEle.SelectSingleNode("PasswordTest/Files");
if(m_pXmlFileListNode != null)
{
foreach(XmlNode _pXmlSubNode in m_pXmlFileListNode.SelectNodes("File"))
{
LoggerInf _pLogInf = new LoggerInf(_pXmlSubNode.LocalName, _pXmlSubNode.InnerText);
_pLogInf.LogNodeAttrs.Add(new LogNodeAttr("ID",
_pXmlSubNode.Attributes["ID"].Value));
_pLogInf.LogNodeAttrs.Add(new LogNodeAttr("FileName",
_pXmlSubNode.Attributes["FileName"].Value));
m_pLogInfs.SubLoggerInfs.Add(_pLogInf);
string[] _strFile = {_pXmlSubNode.Attributes["ID"].Value,
_pXmlSubNode.Attributes["FileName"].Value, _pXmlSubNode.InnerText};
ListViewItem _pLvItem = new ListViewItem(_strFile);
this.lvFileList.Items.Add(_pLvItem);
}
}
this.txtInPath.Text = m_strInPath;
this.txtOutPath.Text = m_strOutPath;
return true;
}
else
return false;
}
/// <summary>
/// 保存配置
/// </summary>
private void SaveConfig()
{
LoggerInf m_pTotalLogInf = new LoggerInf("PasswordTest", String.Empty);
LoggerInf _pOptionInf = new LoggerInf("Option", String.Empty);
_pOptionInf.SubLoggerInfs.Add(new LoggerInf("TestProject", m_nTestProject.ToString()));
_pOptionInf.SubLoggerInfs.Add(new LoggerInf("ShowWin", m_blShowWin.ToString()));
_pOptionInf.SubLoggerInfs.Add(new LoggerInf("InFile", m_strInFile));
_pOptionInf.SubLoggerInfs.Add(new LoggerInf("InPath", m_strInPath));
_pOptionInf.SubLoggerInfs.Add(new LoggerInf("OutPath", m_strOutPath));
m_pTotalLogInf.SubLoggerInfs.Add(_pOptionInf);
m_pTotalLogInf.SubLoggerInfs.Add(m_pLogInfs);
m_pLoggerMain.LoggerOut(m_pTotalLogInf);
}
#endregion
#region 各项目的密码测试函数
/// <summary>
/// WPS项目的密码测试
/// </summary>
private void WPSPasswordTest()
{
PlugInClassWPSMain m_pPlugInClsMain = new PlugInClassWPSMain();
m_pPlugInClsMain.SetCaptureException = m_pCapEx;
m_pPlugInClsMain.OnFileTesting += new FileTestProgress(m_pPlugInClsMain_OnFileTesting);
m_pPlugInClsMain.ShowWin = m_blShowWin;
m_pPlugInClsMain.CharPassFileName = m_strCharPassFileName;
m_pPlugInClsMain.InPath = IOIntegrate.GetDateKeyWord(m_strInPath);
m_pPlugInClsMain.OutPath = IOIntegrate.GetDateKeyWord(m_strOutPath);
m_pPlugInClsMain.FileList = m_pLogInfs;
m_pPlugInClsMain.ExcuteTest_Entry();
}
/// <summary>
/// WPP项目的密码测试
/// </summary>
private void WPPPasswordTest()
{
PlugInClassWPPMain m_pPlugInClsMain = new PlugInClassWPPMain();
m_pPlugInClsMain.SetCaptureException = m_pCapEx;
m_pPlugInClsMain.OnFileTesting += new FileTestProgress(m_pPlugInClsMain_OnFileTesting);
m_pPlugInClsMain.ShowWin = m_blShowWin;
m_pPlugInClsMain.CharPassFileName = m_strCharPassFileName;
m_pPlugInClsMain.InPath = IOIntegrate.GetDateKeyWord(m_strInPath);
m_pPlugInClsMain.OutPath = IOIntegrate.GetDateKeyWord(m_strOutPath);
m_pPlugInClsMain.FileList = m_pLogInfs;
m_pPlugInClsMain.ExcuteTest_Entry();
}
/// <summary>
/// ET项目的密码测试
/// </summary>
private void ETPasswordTest()
{
PlugInClassETMain m_pPlugInClsMain = new PlugInClassETMain();
m_pPlugInClsMain.SetCaptureException = m_pCapEx;
m_pPlugInClsMain.OnFileTesting += new FileTestProgress(m_pPlugInClsMain_OnFileTesting);
m_pPlugInClsMain.ShowWin = m_blShowWin;
m_pPlugInClsMain.CharPassFileName = m_strCharPassFileName;
m_pPlugInClsMain.InPath = IOIntegrate.GetDateKeyWord(m_strInPath);
m_pPlugInClsMain.OutPath = IOIntegrate.GetDateKeyWord(m_strOutPath);
m_pPlugInClsMain.FileList = m_pLogInfs;
m_pPlugInClsMain.ExcuteTest_Entry();
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -