Example #1
0
        public static bool IsPathAllowed(this IPathListBoundHandler handler, Object asset,
                                         IAssetOrResourceLoadedContext context)
        {
            var pth = PathList.Normalize(context.GetUniqueFileSystemAssetPath(asset).Replace(".unity3d", string.Empty));

            return(IsPathAllowed(handler, pth, true));
        }
Example #2
0
        public static bool IsPathAllowed(this IPathListBoundHandler handler, string path, bool isPathNormalized = false)
        {
            var search = isPathNormalized ? path : PathList.Normalize(path);

            TextResourceRedirector.Logger.DebugLogDebug($"IsPathAllowed: {search}");
            // run shorter test first
            if (handler.WhiteListPaths.Count < handler.BlackListPaths.Count)
            {
                return(IsPathWhitelisted(handler, search, true) && !IsPathBlacklisted(handler, search, true));
            }

            return(!IsPathBlacklisted(handler, search, true) && IsPathWhitelisted(handler, search, true));
        }
Example #3
0
        public static bool IsPathAllowed(this IPathListBoundHandler handler, string path, bool isPathNormalized = false)
        {
            var search = isPathNormalized ? path : PathList.Normalize(path);
            var result = true;

            try
            {
                // run shorter test first
                if (handler.WhiteListPaths.Count < handler.BlackListPaths.Count)
                {
                    return(result = IsPathWhitelisted(handler, search, true) &&
                                    !IsPathBlacklisted(handler, search, true));
                }

                return(result = !IsPathBlacklisted(handler, search, true) &&
                                IsPathWhitelisted(handler, search, true));
            }
            finally
            {
                Logger.DebugLogDebug("{0}.{1}: {2} => {3}", handler.GetType(), nameof(IsPathAllowed), search, result);
            }
        }
Example #4
0
 public static bool IsPathBlocked(this IPathListBoundHandler handler, Object asset,
                                  IAssetOrResourceLoadedContext context)
 {
     return(!IsPathAllowed(handler, asset, context));
 }
Example #5
0
 public static bool IsPathBlocked(this IPathListBoundHandler handler, string path, bool isPathNormalized = false)
 {
     return(!IsPathAllowed(handler, path, isPathNormalized));
 }
Example #6
0
 public static bool IsPathBlacklisted(this IPathListBoundHandler handler, string path,
                                      bool isPathNormalized = false)
 {
     return(handler.BlackListPaths.Count != 0 && handler.BlackListPaths.IsPathListed(path, isPathNormalized));
 }
Example #7
0
 public static bool IsPathWhitelisted(this IPathListBoundHandler handler, string path,
                                      bool isPathNormalized = false)
 {
     return(handler.WhiteListPaths.Count == 0 || handler.WhiteListPaths.IsPathListed(path, isPathNormalized));
 }