Merge pull request #30 from oqtane/master

sync
This commit is contained in:
Shaun Walker 2020-05-29 10:53:46 -04:00 committed by GitHub
commit b1a007491f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 15 deletions

View File

@ -195,7 +195,7 @@ namespace Oqtane.Repository
if (modulecontroltype.Name == "ModuleBase"
|| modulecontroltype.IsGenericType
|| modulecontroltype.IsAbstract
|| Attribute.IsDefined(modulecontroltype, typeof(OqtaneIgnoreAttribute))
|| modulecontroltype.IsOqtaneIgnore()
) continue;
string moduleNamespace = modulecontroltype.Namespace;

View File

@ -50,20 +50,31 @@ namespace Oqtane.Repository
// Check if type should be ignored
if (themeControlType.Name == "ThemeBase"
|| themeControlType.IsGenericType
|| Attribute.IsDefined(themeControlType, typeof(OqtaneIgnoreAttribute))
|| themeControlType.IsOqtaneIgnore()
) continue;
string themeNamespace = themeControlType.Namespace;
string qualifiedModuleType = themeNamespace + ", " + themeControlType.Assembly.GetName().Name;
// 2dm disabled - not used anywhere in code
//string qualifiedModuleType = themeNamespace + ", " + themeControlType.Assembly.GetName().Name;
int index = themes.FindIndex(item => item.ThemeName == themeNamespace);
// Find all types in the assembly which have the same namespace-root as the theme file
// Check with "." in the end to
List<Type> typesInTheme = assembly.GetTypes()
.Where(item=>!item.IsOqtaneIgnore())
.Where(item => item.Namespace != null)
// Namespace must be the same or start with "xxx." to ensure that
// similar namespaces like "MyTheme" and "MyTheme2" don't match in StartsWith(...)
.Where(item => item.Namespace == themeNamespace
|| item.Namespace.StartsWith(themeNamespace + "."))
.ToList();
if (index == -1)
{
// determine if this theme implements ITheme
Type themetype = assembly.GetTypes()
.Where(item => item.Namespace != null)
.Where(item => item.Namespace.StartsWith(themeNamespace))
.Where(item => item.GetInterfaces().Contains(typeof(ITheme))).FirstOrDefault();
Type themetype = typesInTheme
.FirstOrDefault(item => item.GetInterfaces().Contains(typeof(ITheme)));
if (themetype != null)
{
var themeobject = Activator.CreateInstance(themetype) as ITheme;
@ -90,9 +101,7 @@ namespace Oqtane.Repository
theme.ThemeControls += (themeControlType.FullName + ", " + themeControlType.Assembly.GetName().Name + ";");
// layouts
Type[] layouttypes = assembly.GetTypes()
.Where(item => item.Namespace != null)
.Where(item => item.Namespace.StartsWith(themeNamespace))
Type[] layouttypes = typesInTheme
.Where(item => item.GetInterfaces().Contains(typeof(ILayoutControl))).ToArray();
foreach (Type layouttype in layouttypes)
{
@ -104,9 +113,7 @@ namespace Oqtane.Repository
}
// containers
Type[] containertypes = assembly.GetTypes()
.Where(item => item.Namespace != null)
.Where(item => item.Namespace.StartsWith(themeNamespace))
Type[] containertypes = typesInTheme
.Where(item => item.GetInterfaces().Contains(typeof(IContainerControl))).ToArray();
foreach (Type containertype in containertypes)
{

View File

@ -79,5 +79,10 @@ namespace System.Reflection
.Where(a => a.GetTypes<IModuleControl>().Any() || a.GetTypes<IThemeControl>().Any() || a.GetTypes<IClientStartup>().Any())
.Where(a => Utilities.GetFullTypeName(a.GetName().Name) != "Oqtane.Client");
}
public static bool IsOqtaneIgnore(this Type type)
{
return Attribute.IsDefined(type, typeof(OqtaneIgnoreAttribute));
}
}
}

View File

@ -51,9 +51,11 @@ V1.0.0 (MVP)
# Background
Oqtane was created by [Shaun Walker](https://www.linkedin.com/in/shaunbrucewalker/) and is inspired by the DotNetNuke web application framework. Initially created as a proof of concept, Oqtane is a native Blazor application written from the ground up using modern .NET Core technology. It is a modular application framework offering a fully dynamic page compositing model, multi-site support, designer friendly templates (skins), and extensibility via third party modules.
# Release Announcement
# Release Announcements
[Announcing Oqtane... a Modular Application Framework for Blazor!](https://www.oqtane.org/Resources/Blog/PostId/520/announcing-oqtane-a-modular-application-framework-for-blazor)
[Oqtane 1.0](https://www.oqtane.org/Resources/Blog/PostId/540/announcing-oqtane-10-a-modular-application-framework-for-blazor)
[Oqtane POC](https://www.oqtane.org/Resources/Blog/PostId/520/announcing-oqtane-a-modular-application-framework-for-blazor)
# Example Screenshots