private static bool _WriterText(List <string> content, string path, bool append, Encoding encoding) { bool RETURN = false; StreamWriter sw = null; try { sw = new StreamWriter(path, append, encoding); foreach (string temp in content) { sw.WriteLine(temp); } sw.Flush(); RETURN = true; } catch (Exception ex) { RuntimeLog.WriteRuntimeErrorLog(ex); } finally { sw.Close(); } return(RETURN); }
private static string _ReadText(string path, Encoding encoding) { string temp = ""; try { StreamReader sr = new StreamReader(path, encoding); temp = sr.ReadToEnd(); sr.Close(); } catch (Exception ex) { RuntimeLog.WriteRuntimeErrorLog(ex); } return(temp); }
private static string[] _ReadAllLines(string path, Encoding encoding) { List <string> lines = new List <string>(); try { StreamReader sr = new StreamReader(path, Encoding.Default); while (sr.Peek() > -1) { lines.Add(sr.ReadLine()); } sr.Close(); } catch (Exception ex) { RuntimeLog.WriteRuntimeErrorLog(ex); } return(lines.ToArray()); }