Beispiel #1
0
        private VfsEntry ResolveParent(ZipArchiveEntry entry, VfsEntry root)
        {
            // TODO: This is icky
            var entryPath       = entry.GetFixedPath();
            var targetEntryName = entry.GetEntryName();
            var pathParts       = entryPath.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries);


            VfsEntry currentEntry = root;

            foreach (var part in pathParts)
            {
                if (part == targetEntryName)
                {
                    break;
                }

                if (!currentEntry.TryGetChild(part, out var targetEntry))
                {
                    ThrowUnresolvedParentException(entry.FullName);
                }

                currentEntry = targetEntry;
            }

            return(currentEntry);
        }
Beispiel #2
0
 internal ZipFile(ZipArchiveEntry entry, ZipDevice device, VfsEntry parent = null)
     : base(entry.GetEntryName(), device, parent)
 {
     _entry = entry;
     Size   = entry.Length;
 }
Beispiel #3
0
 internal ZipDirectory(ZipArchiveEntry entry, ZipDevice device, VfsEntry parent = null)
     : base(entry.GetEntryName(), device, parent)
 {
     Attributes = FileAttributes.Directory;
 }