DeadByDaylightBackup.Utility/FileUtility.cs
/// <summary>
/// Check if its possible to acces (read/write) to a folder
/// </summary>
/// <param name="directory">the directory to search</param>
/// <returns>true if you can acces is</returns>
Check if its possible to acces (read/write) to a folder
Check if its possible to acces ( read / write ) to a folder
private static bool AccessableDirectory(string directory)
        {
            if (IsDirectoryBlacklisted(directory))
            { return false; }
            else if (directory.Count(y => y.Equals('\\')) > 10)
            {
                return false;
            }
            else
            {
                try
                {
                    var permission = new FileIOPermission(FileIOPermissionAccess.Write, directory);
                    permission.Demand();
                    return true;
                }
                catch
                {
                    return false;
                }
            }
        }
private static bool AccessableDirectory ( string directory ) { if ( IsDirectoryBlacklisted ( directory ) ) { return false ; } else if ( directory . Count ( y => y . Equals ( ' \\ ' ) ) > 10 ) { return false ; } else { try { var permission = new FileIOPermission ( FileIOPermissionAccess . Write , directory ) ; permission . Demand ( ) ; return true ; } catch { return false ; } } }
Check if its possible to acces (read/write) to a folder
Check if its possible to acces ( read / write ) to a folder
true if you can acces is
true if you can acces is
directory
string
the directory to search
the directory to search