AppInfo LoadApp(IAppHost host, string fullName, out Assembly includedAssembly, out Assembly resourcesAssembly) { resourcesAssembly = null; includedAssembly = LoadAssembly(fullName); Type appBaseType = typeof(AppMetadata); Type[] appTypes = includedAssembly.GetTypes(); Type appType = null; foreach (var type in appTypes) { if (appBaseType.IsAssignableFrom(type)) { appType = type; break; } } if (appType == null) { return(null); } string resourcesAssemblyName = fullName.Substring(0, fullName.Length - 3) + "Resources.dll"; if (File.Exists(resourcesAssemblyName)) { resourcesAssembly = LoadAssembly(resourcesAssemblyName); } AppMetadata metadata = Activator.CreateInstance(appType) as AppMetadata; PreProcessAppMetadata(ref metadata, host); return(new AppInfo(metadata)); }
void PreProcessAppMetadata(ref AppMetadata metadata, IAppHost currentHost) { if (null != metadata.MenuItems) { foreach (AppMenuItem menu in metadata.MenuItems) { menu.Url = ProcessAppMenuUrl(menu.Url, metadata.Id, currentHost); } } string[] fragments = new string[] { string.Empty, currentHost.DirName, metadata.Id, "App.png" }; metadata.Logo = string.Join("/", fragments); }
public AppInfo(AppMetadata appMetadata, bool isEnable) { Metadata = appMetadata; IsEnable = isEnable; }
public AppInfo(AppMetadata appMetadata) { Metadata = appMetadata; }