コード例 #1
0
ファイル: Iso9960Device.cs プロジェクト: ezhangle/RomScanner
        private VfsEntry ResolveParent(DiscFileInfo file, VfsEntry root)
        {
            var targetEntryName = file.Name;
            var pathParts       = file.FullName.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries);

            VfsEntry currentEntry = root;

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

                if (!currentEntry.TryGetChild(part, out var targetEntry))
                {
                    var targetPath      = Path.Combine(currentEntry.FullPath, part);
                    var targetDirectory = _isoReader.GetDirectoryInfo(targetPath);

                    targetEntry = new Iso9960Directory(targetDirectory, this, currentEntry);
                }

                currentEntry = targetEntry;
            }

            return(currentEntry);
        }
コード例 #2
0
ファイル: Iso9960Device.cs プロジェクト: ezhangle/RomScanner
        protected override VfsDirectory BuildFileHierarchy()
        {
            var root = new Iso9960Directory(this);

            var files = _isoReader.Root.GetFiles("*.*", SearchOption.AllDirectories);

            foreach (var file in files)
            {
                var parent = ResolveParent(file, root);
                new Iso9960File(file, this, parent);
            }

            return(root);
        }