日期:2014-05-17 浏览次数:20816 次
string sLine = "";
if (File.Exists(Application.StartupPath + "\\Password.ini"))
{
StreamReader aFile = new StreamReader(Application.StartupPath + "\\Password.ini");
if (sLine != null)
{
sLine = aFile.ReadLine();
}
else sLine = "";
aFile.Close();
}
else
{
FileStream aFile1 = new FileStream(Application.StartupPath + "\\Password.ini", FileMode.OpenOrCreate);
StreamWriter MyWriter1 = new StreamWriter(aFile1);
MyWriter1.Write("");
aFile1.Close();
}
if (textBox1.Text == sLine)
{
this.Close();
Application.Exit();
}
else
{
label1.Text = "输入密码不正确,请重新输入。";
textBox1.Clear();
textBox1.Focus();
}