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); } }
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); } }
public static bool IsExistFile(string filename) { CooperationWrapper.IsNullOrEmpty(filename); return(File.Exists(filename)); }
public static bool IsExistDirectory(string directoryPath) { CooperationWrapper.IsNullOrEmpty(directoryPath); return(Directory.Exists(directoryPath)); }