public static void SafeCreateDirectory(string path) { GeneralUtil.CatchAll(delegate { if (!System.IO.Directory.Exists(path)) { Directory.CreateDirectory(Path.GetDirectoryName(path)); } }); }
public static void SafeDeleteDirectory(string path) { GeneralUtil.CatchAll(delegate { string[] files = Directory.GetFiles(path); foreach (string str in files) { File.Delete(str); } Directory.Delete(path); }); }
public static string GetFileContent(string filePath) { return(GeneralUtil.CatchAll <string>(delegate { if (!File.Exists(filePath)) { return null; } StreamReader reader = new StreamReader(filePath, Encoding.Default); string str = reader.ReadToEnd(); reader.Close(); return str; })); }