| | |
| | | FileStream f = File.Create(Path); |
| | | f.Close(); |
| | | } |
| | | StreamWriter f2 = new StreamWriter(Path, false, System.Text.Encoding.GetEncoding("gb2312")); |
| | | StreamWriter f2 = new StreamWriter(Path, false, System.Text.Encoding.UTF8); |
| | | f2.Write(Strings); |
| | | f2.Close(); |
| | | f2.Dispose(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 写文件 |
| | | /// </summary> |
| | | /// <param name="Path">文件路径</param> |
| | | /// <param name="Strings">文件内容</param> |
| | | public static void WriteFileAndDelOldFile(string Path, string Strings) |
| | | { |
| | | if (!File.Exists(Path)) |
| | | { |
| | | FileStream f = File.Create(Path); |
| | | f.Close(); |
| | | } |
| | | else |
| | | { |
| | | File.Delete(Path); |
| | | } |
| | | StreamWriter f2 = new StreamWriter(Path, false, System.Text.Encoding.UTF8); |
| | | f2.Write(Strings); |
| | | f2.Close(); |
| | | f2.Dispose(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 写文件 |
| | | /// </summary> |