代码如下:

ProjectName = (InPath + "/Project/ProjectName/ProjectName.LMPN");
String line = String.Empty;
String ProjectPath;
using(StreamReader reader = new StreamReader(InPath + "/Project/ProjectName/ProjectName.LMPN"))
{
line = reader.ReadLine();
while(line != "" && line != null)
{
IfPath = (InPath + "/Project/ProjectPath");
if(IfPath == true)
{
IfPath = (InPath + "/Project/ProjectPath/" + line + ".LMPP");
if(IfPath == true)
{
ProjectPath = (InPath + "/Project/ProjectPath/" + line + ".LMPP");
switch (ProjectPath)
{
case "":
ListBox_历史项目.Items.Add(line + " 路径为空");
break;
case "DefaultProjectPath":
ListBox_历史项目.Items.Add(line + " 默认路径");
break;
default:
ListBox_历史项目.Items.Add(line + " " + ProjectPath);
break;
}
}else
{
ListBox_历史项目.Items.Add(line + " 项目路径文件不存在");
}
}else
{
MessageBox.Show("缺少ProjectPath文件夹及其相关文件!","警告");
this.Close();
}
// Console.WriteLine(line);
line = reader.ReadLine();
}
}
String line = String.Empty;
String ProjectPath;
using(StreamReader reader = new StreamReader(InPath + "/Project/ProjectName/ProjectName.LMPN"))
{
line = reader.ReadLine();
while(line != "" && line != null)
{
IfPath = (InPath + "/Project/ProjectPath");
if(IfPath == true)
{
IfPath = (InPath + "/Project/ProjectPath/" + line + ".LMPP");
if(IfPath == true)
{
ProjectPath = (InPath + "/Project/ProjectPath/" + line + ".LMPP");
switch (ProjectPath)
{
case "":
ListBox_历史项目.Items.Add(line + " 路径为空");
break;
case "DefaultProjectPath":
ListBox_历史项目.Items.Add(line + " 默认路径");
break;
default:
ListBox_历史项目.Items.Add(line + " " + ProjectPath);
break;
}
}else
{
ListBox_历史项目.Items.Add(line + " 项目路径文件不存在");
}
}else
{
MessageBox.Show("缺少ProjectPath文件夹及其相关文件!","警告");
this.Close();
}
// Console.WriteLine(line);
line = reader.ReadLine();
}
}