using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace NX.ERP.U8 { public class FileHelp { public static string ReadFile(string strFileName) { if (!File.Exists(strFileName)) { return string.Empty; } using (StreamReader streamReader = new StreamReader(strFileName, Encoding.Default)) { return streamReader.ReadToEnd(); } } public static bool WriteFile(string strContentToFile, string strFilePathName, Encoding encoding) { using (StreamWriter streamWriter = new StreamWriter(strFilePathName, append: false, encoding)) { streamWriter.Write(strContentToFile); return true; } } public static bool WriteFile(string strContentToFile, string strFilePathName) { using (StreamWriter streamWriter = new StreamWriter(strFilePathName, append: false, Encoding.Default)) { streamWriter.Write(strContentToFile); return true; } } } }