public static string CombineToAppPath(this IFolder folder, params string[] paths) { folder.ArgumentNullExceptionByNullOrEmpty("folder"); folder.Root.ArgumentNullExceptionByNullOrEmpty("folder.Root"); return(PathUtility.PhysicsPathSeparatorCharConvertToVirtualPathSeparatorChar(Path.Combine(folder.Root.RootPath, folder.Combine(paths).TrimStart('/')))); }
public static string ReadFile(this IFolder folder, string path) { folder.ArgumentNullExceptionByNullOrEmpty("folder"); using (var stream = folder.OpenFile(path)) { using (var reader = new StreamReader(stream)) { return(reader.ReadToEnd()); } } }
public static void CreateFile(this IFolder folder, string path, string content) { folder.ArgumentNullExceptionByNullOrEmpty("folder"); using (var stream = folder.CreateFile(path)) { using (var tw = new StreamWriter(stream)) { tw.Write(content); } } }
public static bool TryDelete(this IFolder folder, string path, bool recursive) { folder.ArgumentNullExceptionByNullOrEmpty("folder"); try { folder.Delete(path, recursive); return(true); } catch { return(false); } }
public static void Delete(this IFolder folder, string path) { folder.ArgumentNullExceptionByNullOrEmpty("folder"); folder.Delete(path, true); }
public static IEnumerable <string> GetFiles(this IFolder folder, string path) { folder.ArgumentNullExceptionByNullOrEmpty("folder"); return(folder.GetFiles(path, false)); }