public bool WriteAllText(string path, string text, Encoding encoding) { try { using (StreamWriter sw = new StreamWriter(path, false, encoding)) { sw.Write(text); } } catch { return false; } return true; }