Ejemplo n.º 1
0
 public static void SafeCreateDirectory(string path)
 {
     GeneralUtil.CatchAll(delegate
     {
         if (!System.IO.Directory.Exists(path))
         {
             Directory.CreateDirectory(Path.GetDirectoryName(path));
         }
     });
 }
Ejemplo n.º 2
0
        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);
            });
        }
Ejemplo n.º 3
0
 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;
     }));
 }