读取记事本中的文字
protected void Page_Load(object sender, EventArgs e)
{
this.labV.Text = "V" + getVerstion(@"soft\VersionInfo.txt");
}
//VersionOperation VO = new VersionOperation();
// VO.getVerstion(@"soft\VersionInfo.txt");
public string getVerstion(string fileName)
{
string str = "";
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + fileName))
{
StreamReader sr = File.OpenText(AppDomain.CurrentDomain.BaseDirectory + fileName);
str = sr.ReadToEnd();//[Main]\r\nVersion=6.0.2\r\nURL=\"http://fuyi.net\
int startindex = str.IndexOf("Version") + 8;
int endIndex = str.IndexOf("URL") - 2;
str = str.Substring(startindex, endIndex - startindex);
sr.Close();
sr.Dispose();
}
return str;
}