public EmbeddedViewVirtualPathProvider(EmbeddedResourceTable embeddedViews)
 {
     if (embeddedViews == null)
     {
         throw new ArgumentNullException("embeddedViews");
     }
     this.embeddedViews = embeddedViews;
 }
Exemple #2
0
        private void GetEmbeddedResources()
        {
            scripts = new EmbeddedResourceTable();
            styles  = new EmbeddedResourceTable();
            views   = new EmbeddedResourceTable();

            var assemblies = typeFinder.GetAssemblies();

            if (assemblies.IsNullOrEmpty())
            {
                return;
            }

            foreach (var assembly in assemblies)
            {
                var names = GetNamesOfAssemblyResources(assembly);

                if (names.IsNullOrEmpty())
                {
                    continue;
                }

                foreach (var name in names)
                {
                    var key = name.ToLowerInvariant();

                    if (key.Contains(".views."))
                    {
                        views.AddResource(name, assembly.FullName);
                    }
                    else if (key.Contains(".scripts."))
                    {
                        scripts.AddResource(name, assembly.FullName);
                    }
                    else if (key.Contains(".content."))
                    {
                        styles.AddResource(name, assembly.FullName);
                    }
                }
            }
        }