Exemple #1
0
        /// <summary>
        /// Delete a file.
        /// </summary>
        /// <param name="aPath">A path to the file.</param>
        /// <exception cref="Exception">
        /// <list type="bullet">
        /// <item>Thrown if VFS manager is null.</item>
        /// <item>The entry at aPath is not a file.</item>
        /// </list>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">Thrown when the specified path isn't a file</exception>
        public static void DeleteFile(string aPath)
        {
            ThrowIfNotRegistered();
            var xFile = mVFS.GetFile(aPath);

            if (xFile.mEntryType != DirectoryEntryTypeEnum.File)
            {
                throw new UnauthorizedAccessException("The specified path isn't a file");
            }

            mVFS.DeleteFile(xFile);
        }
Exemple #2
0
        /// <summary>
        /// Delete a file.
        /// </summary>
        /// <param name="aPath">A path to the file.</param>
        /// <exception cref="Exception">
        /// <list type="bullet">
        /// <item>Thrown if VFS manager is null.</item>
        /// <item>The entry at aPath is not a file.</item>
        /// </list>
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">Thrown when the specified path isn't a file</exception>
        public static void DeleteFile(string aPath)
        {
            if (mVFS == null)
            {
                throw new Exception("VFSManager isn't ready.");
            }

            var xFile = mVFS.GetFile(aPath);

            if (xFile.mEntryType != DirectoryEntryTypeEnum.File)
            {
                throw new UnauthorizedAccessException("The specified path isn't a file");
            }

            mVFS.DeleteFile(xFile);
        }