Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
 }