摘要: 1.获取和设置当前目录的完全限定路径。string str = System.Environment.CurrentDirectory;Result: C:\xxx\xxx2.获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。string str = System.Windows.Forms.Application.StartupPath;Result: C:\xxx\xxx3.获取新... 阅读全文
posted @ 2010-06-06 20:43 greencolor 阅读(212) 评论(0) 推荐(0)
摘要: public static void EditFile(int curLine, string newLineValue, string patch) { FileStream fs = new FileStream(patch, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs, Encoding.Get... 阅读全文
posted @ 2010-06-06 17:26 greencolor 阅读(185) 评论(0) 推荐(0)
摘要: using System.IO; FileStream fs = new FileStream(Application.StartupPath + "\\AlarmSet.txt", FileMode.Open, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs, Encoding.GetEncoding("utf-8"));... 阅读全文
posted @ 2010-06-06 16:38 greencolor 阅读(155) 评论(0) 推荐(0)
摘要: using System.IO; FileStream fs1 = new FileStream(Application.StartupPath + "\\text.txt", FileMode.Create, FileAccess.Write);//创建写入文件 StreamWriter sw = new StreamWriter(fs1,Encoding.GetEncoding("utf-8... 阅读全文
posted @ 2010-06-06 15:30 greencolor 阅读(146) 评论(0) 推荐(0)