/// <summary>
        /// Function to update the information about this file.
        /// </summary>
        /// <param name="fileSize">Size of the file.</param>
        /// <param name="fileOffset">Offset of the file in a packed file file system.</param>
        /// <param name="createDate">Date of creation for the file.</param>
        /// <param name="mountPoint">Mount point for the file.</param>
        /// <param name="physicalPath">Physical path for the file.</param>
        /// <param name="provider">Provider that can access the file.</param>
        internal void Update(long?fileSize, int?fileOffset, DateTime?createDate, string mountPoint,
                             string physicalPath, GorgonFileSystemProvider provider)
        {
            if (fileSize.HasValue)
            {
                Size = fileSize.Value;
            }

            if (fileOffset.HasValue)
            {
                Offset = fileOffset.Value;
            }

            if (createDate.HasValue)
            {
                CreateDate = createDate.Value;
            }

            if (!string.IsNullOrWhiteSpace(mountPoint))
            {
                MountPoint = mountPoint;
            }

            if (provider != null)
            {
                Provider = provider;
            }

            if (!string.IsNullOrWhiteSpace(physicalPath))
            {
                PhysicalFileSystemPath = physicalPath;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonFileSystemFileEntry"/> class.
        /// </summary>
        /// <param name="provider">The file system provider that owns this file.</param>
        /// <param name="directory">The directory that holds this file.</param>
        /// <param name="fileName">The file name of the file.</param>
        /// <param name="mountPoint">The mount point that holds the file.</param>
        /// <param name="physicalPath">Path to the file on the physical file system.</param>
        /// <param name="fileSize">Size of the file in bytes.</param>
        /// <param name="offset">Offset of the file within a packed file.</param>
        /// <param name="createDate">Create date for the file.</param>
        internal GorgonFileSystemFileEntry(GorgonFileSystemProvider provider, GorgonFileSystemDirectory directory, string fileName, string mountPoint, string physicalPath, long fileSize, long offset, DateTime createDate)
            : base(fileName.RemoveIllegalFilenameChars())
        {
            Provider     = provider;
            Directory    = directory;
            Extension    = Path.GetExtension(Name);
            BaseFileName = Path.GetFileNameWithoutExtension(fileName);

            if (string.IsNullOrEmpty(physicalPath))
            {
                PhysicalFileSystemPath = Name;
                MountPoint             = mountPoint;
            }
            else
            {
                MountPoint             = mountPoint;
                PhysicalFileSystemPath = physicalPath;
            }

            Offset     = offset;
            Size       = fileSize;
            CreateDate = createDate;
        }
Exemple #3
0
        /// <summary>
        /// Function to update the file information for a file.
        /// </summary>
        /// <param name="fileSize">The file size.  Pass NULL (Nothing in VB.Net) to leave unchanged.</param>
        /// <param name="fileOffset">The offset of the file within a packed file.  Pass NULL (Nothing in VB.Net) to leave unchanged.</param>
        /// <param name="createDate">The date/time the file was created.  Pass NULL (Nothing in VB.Net) to leave unchanged.</param>
        /// <param name="physicalPath">A new file system provider for the file.  Pass NULL (Nothing in VB.Net) or an empty string to leave unchanged.</param>
        /// <param name="provider">A new file system provider for the file.  Pass NULL (Nothing in VB.Net) to leave unchanged.</param>
        protected void UpdateFileInfo(long?fileSize, int?fileOffset, DateTime?createDate, string physicalPath, GorgonFileSystemProvider provider)
        {
            if (FileEntry == null)
            {
                return;
            }

            FileEntry.Update(fileSize, fileOffset, createDate, null, physicalPath, provider);
        }
Exemple #4
0
 /// <summary>
 /// Function to create a new or return an existing file system provider instance.
 /// </summary>
 /// <returns>The file system provider.</returns>
 internal GorgonFileSystemProvider CreateProvider()
 {
     return(_provider ?? (_provider = OnCreateProvider()));
 }