Ejemplo n.º 1
0
        protected ZipFolderItem CreateFolderOnFileSystem2(ZipFolderItem folder)
        {
            Action action = () => NodeRepository.ZipFile.AddDirectoryByName(folder.QualifiedIdentifier);

            NodeRepository.PerformWriteAction(action);

            return(NodeRepository.GetFolderItem(folder.QualifiedIdentifier));
        }
Ejemplo n.º 2
0
        protected void DeleteFolderOnFileSystem2(ZipFolderItem folder)
        {
            Action action = () => {
                var entriesToRemove = folder.Node.GetDescendants(true).Select(n => n.FileEntry).ToArray();
                NodeRepository.ZipFile.RemoveEntries(entriesToRemove);
            };

            NodeRepository.PerformWriteAction(action);
        }
Ejemplo n.º 3
0
        protected void MoveFolderOnFileSystem2(ZipFolderItem sourceFolder, ZipFolderItem targetFolder)
        {
            //rewrite path information on all items (just replace the path part of the folder)
            Action action = () => {
                var nodes = sourceFolder.Node.GetDescendants(true);
                foreach (var node in nodes)
                {
                    var entry = node.FileEntry;

                    //use the ReplaceFirst extension in case we have path duplicates
                    //(e.g. data/files/x/data/files/
                    entry.FileName = entry.FileName.ReplaceFirst(sourceFolder.QualifiedIdentifier,
                                                                 targetFolder.QualifiedIdentifier, StringComparison.InvariantCultureIgnoreCase);
                }
            };

            NodeRepository.PerformWriteAction(action);
        }
Ejemplo n.º 4
0
 protected List<string> GetResourceLockChain2(ZipFolderItem folder) {
     return folder.Node.GetAncestors(false, false)
       .Select(n => n.FullName)
       .ToList();
 }
Ejemplo n.º 5
0
 protected void CopyFolderOnFileSystem2(ZipFolderItem sourceFolder, ZipFolderItem targetFolder) {
     //recurse
     NodeRepository.PerformWriteAction(() => CopyFolderContents(sourceFolder.Node, targetFolder.QualifiedIdentifier));
 }
Ejemplo n.º 6
0
        protected void MoveFolderOnFileSystem2(ZipFolderItem sourceFolder, ZipFolderItem targetFolder) {
            //rewrite path information on all items (just replace the path part of the folder)
            Action action = () => {
                var nodes = sourceFolder.Node.GetDescendants(true);
                foreach (var node in nodes) {
                    var entry = node.FileEntry;

                    //use the ReplaceFirst extension in case we have path duplicates
                    //(e.g. data/files/x/data/files/
                    entry.FileName = entry.FileName.ReplaceFirst(sourceFolder.QualifiedIdentifier,
                                                            targetFolder.QualifiedIdentifier, StringComparison.InvariantCultureIgnoreCase);

                }
            };

            NodeRepository.PerformWriteAction(action);
        }
Ejemplo n.º 7
0
        protected void DeleteFolderOnFileSystem2(ZipFolderItem folder) {
            Action action = () => {
                var entriesToRemove = folder.Node.GetDescendants(true).Select(n => n.FileEntry).ToArray();
                NodeRepository.ZipFile.RemoveEntries(entriesToRemove);
            };

            NodeRepository.PerformWriteAction(action);
        }
Ejemplo n.º 8
0
        protected ZipFolderItem CreateFolderOnFileSystem2(ZipFolderItem folder) {
            Action action = () => NodeRepository.ZipFile.AddDirectoryByName(folder.QualifiedIdentifier);
            NodeRepository.PerformWriteAction(action);

            return NodeRepository.GetFolderItem(folder.QualifiedIdentifier);
        }
Ejemplo n.º 9
0
 protected IEnumerable<string> GetChildFilePathsInternal2(ZipFolderItem parentFolder) {
     return parentFolder.Node.ChildFiles.Select(cf => cf.FullName);
 }
Ejemplo n.º 10
0
 protected IEnumerable<string> GetChildFolderPathsInternal2(ZipFolderItem parentFolder) {
     return parentFolder.Node.ChildDirectories.Select(cd => cd.FullName);
 }
Ejemplo n.º 11
0
 protected List <string> GetResourceLockChain2(ZipFolderItem folder)
 {
     return(folder.Node.GetAncestors(false, false)
            .Select(n => n.FullName)
            .ToList());
 }
Ejemplo n.º 12
0
 protected void CopyFolderOnFileSystem2(ZipFolderItem sourceFolder, ZipFolderItem targetFolder)
 {
     //recurse
     NodeRepository.PerformWriteAction(() => CopyFolderContents(sourceFolder.Node, targetFolder.QualifiedIdentifier));
 }
Ejemplo n.º 13
0
 protected IEnumerable <string> GetChildFilePathsInternal2(ZipFolderItem parentFolder)
 {
     return(parentFolder.Node.ChildFiles.Select(cf => cf.FullName));
 }
Ejemplo n.º 14
0
 protected IEnumerable <string> GetChildFolderPathsInternal2(ZipFolderItem parentFolder)
 {
     return(parentFolder.Node.ChildDirectories.Select(cd => cd.FullName));
 }