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)); }
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)); }
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); } }