コード例 #1
0
 /// <summary>
 /// 保存文件到指定路径
 /// </summary>
 /// <param name="Path">文件物理路径</param>
 /// <param name="Text">写入内容</param>
 /// <param name="Coding">文件编码</param>
 public void SaveFile(string Path, string Text, string Coding)
 {
     if (File.Exists(Path))
     {
         DirFile.DeleteFile(Path);
     }
     try
     {
         sw = new StreamWriter(Path, false, Encoding.GetEncoding(Coding));
         sw.WriteLine(Text);
         sw.Flush();
         sw.Close();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }