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