예제 #1
0
        /// <summary>
        /// Builds a list of files in a folder under Win32.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="path"></param>
        private void Win32GetFiles(List <FindFileData> result, string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(path);
            }
            path = String.Format("{0}{1}*", path, path.EndsWith(_PathSeparator) ? "" : _PathSeparator);

            IntPtr       findHandle = IntPtr.Zero;
            FindFileData fileData;

            try {
                findHandle = FindFirstFile(path, out fileData);
                if (findHandle.ToInt32() != -1)
                {
                    do
                    {
                        if ((fileData.dwFileAttributes & 0x00000010) == 0)
                        {
                            result.Add(fileData);                                                // 0x10 is FILE_ATTRIBUTE_DIRECTORY
                        }
                        fileData = new FindFileData();
                    } while(FindNextFile(findHandle, out fileData));
                }
            } finally {
                if (findHandle != IntPtr.Zero && findHandle.ToInt32() != -1)
                {
                    FindClose(findHandle);
                }
            }
        }
 public DefaultDirectoryCacheProviderFileInfo(FindFileData findFileData)
 {
     Name = findFileData.Name;
     LastWriteTimeUtc = findFileData.LastWriteTimeUtc;
 }
예제 #3
0
 static extern bool FindNextFile(IntPtr hndFindFile, out FindFileData data);
예제 #4
0
 static extern IntPtr FindFirstFile(string fileName, out FindFileData data);
예제 #5
0
        /// <summary>
        /// Builds a list of files in a folder under Win32.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="path"></param>
        private void Win32GetFiles(List<FindFileData> result, string path)
        {
            if(path == null) throw new ArgumentNullException(path);
            path = String.Format("{0}{1}*", path, path.EndsWith(_PathSeparator) ? "" : _PathSeparator);

            IntPtr findHandle = IntPtr.Zero;
            FindFileData fileData;
            try {
                findHandle = FindFirstFile(path, out fileData);
                if(findHandle.ToInt32() != -1) {
                    do {
                        if((fileData.dwFileAttributes & 0x00000010) == 0) result.Add(fileData);  // 0x10 is FILE_ATTRIBUTE_DIRECTORY
                        fileData = new FindFileData();
                    } while(FindNextFile(findHandle, out fileData));
                }
            } finally {
                if(findHandle != IntPtr.Zero && findHandle.ToInt32() != -1) FindClose(findHandle);
            }
        }
예제 #6
0
 static extern bool FindNextFile(IntPtr hndFindFile, out FindFileData data);
예제 #7
0
 static extern IntPtr FindFirstFile(string fileName, out FindFileData data);