/// <summary> /// Initializes a new instance of the <see cref="VirtualFile"/> class. /// </summary> /// <param name="mountPoint">The mount point that supplies this file.</param> /// <param name="fileInfo">Information about the physical file.</param> /// <param name="parent">The parent directory for this file..</param> public VirtualFile(GorgonFileSystemMountPoint mountPoint, IGorgonPhysicalFileInfo fileInfo, VirtualDirectory parent) { MountPoint = mountPoint; PhysicalFile = fileInfo; Directory = parent; Extension = Path.GetExtension(fileInfo.Name); BaseFileName = Path.GetFileNameWithoutExtension(fileInfo.Name); MountPoint = mountPoint; }
/// <summary> /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1" />. /// </summary> /// <param name="mountPoint">The mount point for the file.</param> /// <param name="fileInfo">The physical file information.</param> /// <returns>A new virtual file.</returns> public VirtualFile Add(GorgonFileSystemMountPoint mountPoint, IGorgonPhysicalFileInfo fileInfo) { if (_files.ContainsKey(fileInfo.Name)) { throw new IOException(string.Format(Resources.GORFS_ERR_FILE_EXISTS, fileInfo.FullPath)); } var result = new VirtualFile(mountPoint, fileInfo, _parent); // Create the entry. _files.Add(fileInfo.Name, result); return(result); }