예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LongPathFileSystemInfo"/> class.
        /// </summary>
        /// <param name="data">File data.</param>
        /// <exception cref="ArgumentNullException"><paramref name="data"/> is <see langword="null"/>.</exception>
        internal LongPathFileSystemInfo(Win32FindData data)
        {
            this.entryData = data;

            this.OriginalPath   = this.entryData.Value.FileName;
            this.NormalizedPath = LongPathCommon.NormalizePath(this.entryData.Value.FileName);
            this.isDirectory    = LongPathCommon.IsDirectory(this.entryData.Value);
            this.initialized    = true;
        }
예제 #2
0
        public static bool Exists(string path, out bool isDirectory)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            string normalizedPath;

            if (LongPathCommon.TryNormalizeLongPath(path, out normalizedPath))
            {
                EFileAttributes attributes;
                if (LongPathCommon.TryGetFileAttributes(normalizedPath, out attributes))
                {
                    isDirectory = LongPathCommon.IsDirectory(attributes);
                    return(true);
                }
            }

            isDirectory = false;
            return(false);
        }
예제 #3
0
 /// <summary>
 /// Determines whether the specified attributes belong to a directory.
 /// </summary>
 /// <param name="findData">File or directory data object.</param>
 /// <returns><see langword="true"/> if the specified attributes belong to a directory; otherwise, <see langword="false"/>.
 /// </returns>
 internal static bool IsDirectory(Win32FindData findData)
 {
     return(LongPathCommon.IsDirectory(findData.FileAttributes));
 }