Beispiel #1
0
        private void BuildFSDirectory(DirectoryEntry dirEntry, Directory fsDirectory)
        {
            fsDirectory.Name = dirEntry.Name;

            for (var i = 0; i < dirEntry.DirectoryCount; i++ )
            {
                var dir = new Directory();
                BuildFSDirectory(dirEntry.GetDirectory(i), dir);
                dir.ParentDirectory = fsDirectory;
                fsDirectory.AddObject(dir);
            }

            for (var i = 0; i < dirEntry.FileCount; i++ )
            {
                var fileEntry = dirEntry.GetFile(i);

                File file;
                file = new File( 
                                ()=> (_customData.ContainsKey(fileEntry.FullName) ? _customData[fileEntry.FullName] : fileEntry.GetData()),     
                                data => _customData[fileEntry.FullName] = data,
                                () => _customData.ContainsKey(fileEntry.FullName)
                            );

                file.CompressedSize = fileEntry.Size;
                file.IsCompressed = false;
                file.Name = fileEntry.Name;
                file.Size = fileEntry.Size;
                file.IsResource = fileEntry.IsResourceFile;
                file.ResourceType = fileEntry.ResourceType;
                file.ParentDirectory = fsDirectory;

                fsDirectory.AddObject(file);                
            }
        }
Beispiel #2
0
 public RealContext(DirectoryInfo directory)
 {
     _directory = directory;
     RootDirectory = new DirectoryEntry(this, _directory);
 }