internal DiscFileSystemInfo(DiscFileSystem fileSystem, string path) { if (path == null) { throw new ArgumentNullException("path"); } _fileSystem = fileSystem; _path = path.Trim('\\'); }
/// <summary> /// Create a new differencing disk, possibly within an existing disk. /// </summary> /// <param name="fileSystem">The file system to create the disk on</param> /// <param name="path">The path (or URI) for the disk to create</param> /// <returns>The newly created disk</returns> public abstract VirtualDisk CreateDifferencingDisk(DiscFileSystem fileSystem, string path);
/// <summary> /// Opens an existing virtual disk, possibly from within an existing disk. /// </summary> /// <param name="fs">The file system to open the disk on</param> /// <param name="path">The path of the virtual disk to open</param> /// <param name="access">The desired access to the disk</param> /// <returns>The Virtual Disk, or <c>null</c> if an unknown disk format</returns> public static VirtualDisk OpenDisk(DiscFileSystem fs, string path, FileAccess access) { if (fs == null) { return OpenDisk(path, access); } string extension = Path.GetExtension(path).ToUpperInvariant(); if (extension.StartsWith(".", StringComparison.Ordinal)) { extension = extension.Substring(1); } VirtualDiskFactory factory; if (ExtensionMap.TryGetValue(extension, out factory)) { return factory.OpenDisk(fs, path, access); } return null; }
/// <summary> /// Create a new virtual disk, possibly within an existing disk. /// </summary> /// <param name="fileSystem">The file system to create the disk on</param> /// <param name="type">The type of disk to create (see <see cref="SupportedDiskTypes"/>)</param> /// <param name="variant">The variant of the type to create (see <see cref="GetSupportedDiskVariants"/>)</param> /// <param name="path">The path (or URI) for the disk to create</param> /// <param name="capacity">The capacity of the new disk</param> /// <param name="geometry">The geometry of the new disk (or null).</param> /// <param name="parameters">Untyped parameters controlling the creation process (TBD)</param> /// <returns>The newly created disk</returns> public static VirtualDisk CreateDisk(DiscFileSystem fileSystem, string type, string variant, string path, long capacity, Geometry geometry, Dictionary<string, string> parameters) { VirtualDiskFactory factory = TypeMap[type]; VirtualDiskParameters diskParams = new VirtualDiskParameters() { AdapterType = GenericDiskAdapterType.Scsi, Capacity = capacity, Geometry = geometry, }; if (parameters != null) { foreach (var key in parameters.Keys) { diskParams.ExtendedParameters[key] = parameters[key]; } } return factory.CreateDisk(new DiscFileLocator(fileSystem, Utilities.GetDirectoryFromPath(path)), variant.ToLowerInvariant(), Utilities.GetFileFromPath(path), diskParams); }
/// <summary> /// Indicates if <paramref name="obj"/> is equivalent to this object. /// </summary> /// <param name="obj">The object to compare</param> /// <returns><c>true</c> if <paramref name="obj"/> is equivalent, else <c>false</c></returns> public override bool Equals(object obj) { DiscFileSystemInfo asInfo = obj as DiscFileSystemInfo; if (obj == null) { return(false); } return(string.Compare(Path, asInfo.Path, StringComparison.Ordinal) == 0 && DiscFileSystem.Equals(FileSystem, asInfo.FileSystem)); }
public VirtualDisk OpenDisk(DiscFileSystem fileSystem, string path, FileAccess access) { return OpenDisk(new DiscFileLocator(fileSystem, @"\"), path, access); }
public DiscFileLocator(DiscFileSystem fileSystem, string basePath) { _fileSystem = fileSystem; _basePath = basePath; }
/// <summary> /// Create a new differencing disk, possibly within an existing disk. /// </summary> /// <param name="fileSystem">The file system to create the disk on</param> /// <param name="path">The path (or URI) for the disk to create</param> /// <returns>The newly created disk</returns> public abstract VirtualDisk CreateDifferencingDisk(DiscFileSystem fileSystem, string path);
internal DiscFileInfo(DiscFileSystem fileSystem, string path) : base(fileSystem, path) { }
internal DiscFileInfo(DiscFileSystem fileSystem, string path) : base(fileSystem, path) { }
public DiscFileLocator(DiscFileSystem fileSystem, string basePath) { _fileSystem = fileSystem; _basePath = basePath; }
public VirtualDisk OpenDisk(DiscFileSystem fileSystem, string path, FileAccess access) { return(OpenDisk(new DiscFileLocator(fileSystem, @"\"), path, access)); }