Ejemplo n.º 1
0
        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('/'))));
        }
Ejemplo n.º 2
0
        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());
                }
            }
        }
Ejemplo n.º 3
0
        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);
                }
            }
        }
Ejemplo n.º 4
0
        public static bool TryDelete(this IFolder folder, string path, bool recursive)
        {
            folder.ArgumentNullExceptionByNullOrEmpty("folder");

            try
            {
                folder.Delete(path, recursive);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        public static void Delete(this IFolder folder, string path)
        {
            folder.ArgumentNullExceptionByNullOrEmpty("folder");

            folder.Delete(path, true);
        }
Ejemplo n.º 6
0
        public static IEnumerable <string> GetFiles(this IFolder folder, string path)
        {
            folder.ArgumentNullExceptionByNullOrEmpty("folder");

            return(folder.GetFiles(path, false));
        }