public void SaveFile(string path,string name,string information)
{
StreamWriter sw;
FileInfo t = new FileInfo(path+"//"+name);
if (!t.Exists)
{
sw = t.CreateText();
}
else
{
sw = t.AppendText();//打开文件
}
sw.WriteLine(information);
sw.Close();
sw.Dispose();
}
public ArrayList LoadFile(string path, string name)
{
StreamReader sr = null;
FileInfo t = new FileInfo(path + "//" + name);
if (t.Exists)
{
try
{
sr = File.OpenText(path + "//" + name);
}
catch (Exception exp)
{
Debug.Log("LoadFile 读取数据出错:" + exp);
return null;
}
string line;
ArrayList arraylist = new ArrayList();
while ((line = sr.ReadLine()) != null)
{
arraylist.Add(line);
}
sr.Close();
sr.Dispose();
return arraylist;
}
return null;
}
public void DeleteFile(string path,string name)
{
File.Delete(path+"//"+name);
}