mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-30 20:20:34 +12:00
fixed #834: Indexer catch unauthorized access exception
This commit is contained in:
parent
6d6e338bf1
commit
e2746e47e3
|
@ -196,7 +196,7 @@ public static bool IsBlurPossible(int radius)
|
|||
Version version = Environment.OSVersion.Version;
|
||||
bool isWindows8OrHigher = (version.Major == 6 && version.Minor >= 2) || version.Major > 6;
|
||||
|
||||
return !isWindows8OrHigher || radius >= 20; ;
|
||||
return !isWindows8OrHigher || radius >= 20;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -77,31 +77,37 @@ protected FolderInfo GetFolderInfo(string folderPath, int level = 0)
|
|||
|
||||
if (config.MaxDepthLevel == 0 || level < config.MaxDepthLevel)
|
||||
{
|
||||
DirectoryInfo currentDirectoryInfo = new DirectoryInfo(folderPath);
|
||||
|
||||
foreach (DirectoryInfo directoryInfo in currentDirectoryInfo.GetDirectories())
|
||||
try
|
||||
{
|
||||
if (config.SkipHiddenFolders && directoryInfo.Attributes.HasFlag(FileAttributes.Hidden))
|
||||
DirectoryInfo currentDirectoryInfo = new DirectoryInfo(folderPath);
|
||||
|
||||
foreach (DirectoryInfo directoryInfo in currentDirectoryInfo.GetDirectories())
|
||||
{
|
||||
continue;
|
||||
if (config.SkipHiddenFolders && directoryInfo.Attributes.HasFlag(FileAttributes.Hidden))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FolderInfo subFolderInfo = GetFolderInfo(directoryInfo.FullName, level + 1);
|
||||
folderInfo.Folders.Add(subFolderInfo);
|
||||
subFolderInfo.Parent = folderInfo;
|
||||
}
|
||||
|
||||
FolderInfo subFolderInfo = GetFolderInfo(directoryInfo.FullName, level + 1);
|
||||
folderInfo.Folders.Add(subFolderInfo);
|
||||
subFolderInfo.Parent = folderInfo;
|
||||
}
|
||||
|
||||
foreach (FileInfo fileInfo in currentDirectoryInfo.GetFiles())
|
||||
{
|
||||
if (config.SkipHiddenFiles && fileInfo.Attributes.HasFlag(FileAttributes.Hidden))
|
||||
foreach (FileInfo fileInfo in currentDirectoryInfo.GetFiles())
|
||||
{
|
||||
continue;
|
||||
if (config.SkipHiddenFiles && fileInfo.Attributes.HasFlag(FileAttributes.Hidden))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
folderInfo.Files.Add(fileInfo);
|
||||
}
|
||||
|
||||
folderInfo.Files.Add(fileInfo);
|
||||
folderInfo.Files.Sort((x, y) => x.Name.CompareTo(y.Name));
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
}
|
||||
|
||||
folderInfo.Files.Sort((x, y) => x.Name.CompareTo(y.Name));
|
||||
}
|
||||
|
||||
return folderInfo;
|
||||
|
|
Loading…
Reference in a new issue