示例#1
0
 public static bool CreateDir(string directoryPath)
 {
     CooperationWrapper.IsNullOrEmpty(directoryPath);
     if (Directory.Exists(directoryPath))
     {
         CooperationWrapper.WriteLog(new IOException(string.Format("{0} directory exist", directoryPath)));
         return(true);
     }
     else
     {
         DirectoryInfo info = null;
         try
         {
             info = Directory.CreateDirectory(directoryPath);
         }
         catch (IOException ex)
         {
             CooperationWrapper.WriteLog(ex);
         }
         return(info == null?false:true);
     }
 }
示例#2
0
 public static bool DeleteDir(string directoryPath)
 {
     CooperationWrapper.IsNullOrEmpty(directoryPath);
     if (!Directory.Exists(directoryPath))
     {
         CooperationWrapper.WriteLog(new IOException(string.Format("{0} directory isn't exist", directoryPath)));
         return(true);
     }
     else
     {
         try
         {
             Directory.Delete(directoryPath, true);
         }
         catch (IOException ex)
         {
             CooperationWrapper.WriteLog(ex);
             return(false);
         }
         return(true);
     }
 }
示例#3
0
 public static bool IsExistFile(string filename)
 {
     CooperationWrapper.IsNullOrEmpty(filename);
     return(File.Exists(filename));
 }
示例#4
0
 public static bool IsExistDirectory(string directoryPath)
 {
     CooperationWrapper.IsNullOrEmpty(directoryPath);
     return(Directory.Exists(directoryPath));
 }