コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: AppInfo.cs プロジェクト: vebin/We7CMS_2010
 public AppInfo(AppMetadata appMetadata, bool isEnable)
 {
     Metadata = appMetadata;
     IsEnable = isEnable;
 }
コード例 #4
0
ファイル: AppInfo.cs プロジェクト: vebin/We7CMS_2010
 public AppInfo(AppMetadata appMetadata)
 {
     Metadata = appMetadata;
 }