public Resource Get(AppSession session, string name, Dictionary <string, string> parameters)
        {
            var resourceName = name
                               .Replace("@", "_")
                               .Replace("-", "_")
                               .Replace("/", ".");
            var asmResource = _resources.Value
                              .FirstOrDefault(res => string.Compare(res.Key, resourceName, true, CultureInfo.InvariantCulture) == 0);

            if (asmResource.Key == null)
            {
                //Debug.WriteLine($"ResourceLoader({resourceName}): not found");
                return(null);
            }

            var resourceExtension = Path.GetExtension(resourceName);
            var resourceType      = ResourceType.GetByExtension(resourceExtension);

            if (resourceType == null)
            {
                Debug.WriteLine($"ResourceLoader({resourceName}): not found");
                return(null);
            }

            using (var stream = asmResource.Value.Assembly.GetManifestResourceStream(asmResource.Value.FullName))
            {
                if (stream != null)
                {
                    if (resourceType.IsBinary)
                    {
                        using (var reader = new BinaryReader(stream))
                        {
                            var data = reader.ReadBytes((int)stream.Length);
                            Debug.WriteLine($"ResourceLoader({resourceName}): {asmResource.Value.FullName}");
                            return(new Resource(resourceName, "res://" + asmResource.Value.FullName, resourceType, data, Resource.Cache.Revalidate));
                        }
                    }
                    else
                    {
                        using (var reader = new StreamReader(stream))
                        {
                            var text = reader.ReadToEnd();
                            Debug.WriteLine($"ResourceLoader({resourceName}): {asmResource.Value.FullName}");
                            if (resourceName.EndsWith("index.html", StringComparison.InvariantCultureIgnoreCase))
                            {
                                text = UserContentLinks.InsertUserCssLinks(_userAssembly, "", text, session.SubDomain);
                                text = UserContentLinks.InsertUserJsLinks(_userAssembly, "", text);
                            }
                            return(new Resource(resourceName, "res://" + asmResource.Value.FullName, resourceType, text, Resource.Cache.Revalidate));
                        }
                    }
                }
            }

            Debug.WriteLine($"ResourceLoader({resourceName}): not found");
            return(null);
        }
        public Resource Get(AppSession session, string name, Dictionary <string, string> parameters)
        {
            if (name.StartsWith("Events/"))
            {
                return(null);
            }

            var resourceName = GetAssemblyResourceName(name);

            var asmResource = _resources.Value
                              .FirstOrDefault(res => string.Compare(res.Key, resourceName, true, CultureInfo.InvariantCulture) == 0);

            if (asmResource.Key == null)
            {
                var shortName = GetShortResourceName(AppAssembly, ".app.", resourceName);
                asmResource = _resources.Value
                              .FirstOrDefault(res => string.Compare(res.Key, shortName, true, CultureInfo.InvariantCulture) == 0);
            }

            if (asmResource.Key == null)
            {
                _logger.LogInformation($"ResourceLoader({resourceName}): not found");
                return(null);
            }

            var resourceExtension = Path.GetExtension(resourceName);
            var resourceType      = ResourceType.GetByExtension(resourceExtension);

            if (resourceType == null)
            {
                _logger.LogInformation($"ResourceLoader({resourceName}): not found");
                return(null);
            }

            using (var stream = asmResource.Value.Assembly.GetManifestResourceStream(asmResource.Value.FullName))
            {
                if (stream != null)
                {
                    if (resourceType.IsBinary)
                    {
                        // ReSharper disable once ConvertToUsingDeclaration
                        using (var reader = new BinaryReader(stream))
                        {
                            var data = reader.ReadBytes((int)stream.Length);
                            _logger.LogDebug($"ResourceLoader({resourceName}): {asmResource.Value.FullName}");
                            return(new Resource(resourceName, "res://" + asmResource.Value.FullName, resourceType, data, Resource.Cache.Revalidate));
                        }
                    }
                    else
                    {
                        // ReSharper disable once ConvertToUsingDeclaration
                        using (var reader = new StreamReader(stream))
                        {
                            var text = reader.ReadToEnd();
                            _logger.LogDebug($"ResourceLoader({resourceName}): {asmResource.Value.FullName}");
                            text = text.Replace("{.min}", (session?.IsDebug ?? false) ? "" : ".min");
                            if (resourceName?.EndsWith("index.html", StringComparison.InvariantCultureIgnoreCase) ?? false)
                            {
                                text = UserContentLinks.InsertUserCssLinks(AppAssembly, "", text, session?.SubDomain ?? "");
                                text = UserContentLinks.InsertUserJsLinks(AppAssembly, "", text);
                            }
                            return(new Resource(resourceName, "res://" + asmResource.Value.FullName, resourceType, text, Resource.Cache.Revalidate));
                        }
                    }
                }
            }

            _logger.LogInformation($"ResourceLoader({resourceName}): not found");
            return(null);
        }