public Module(ModuleXml moduleXml, ModuleFramework moduleFramework) { this.ModuleFramework = moduleFramework; this.ModuleXml = moduleXml; this.ModuleType = (ModuleType)Enum.Parse(typeof(ModuleType), this.ModuleXml.ModuleType, true); this.ConnectionString = this.ModuleXml.ConnectionString ?? moduleFramework.ModuleInformation.ConnectionString; this.ModuleName = this.ModuleXml.ModuleName; this.AppName = this.ModuleXml.AppName; this.Version = this.ModuleXml.ModuleVersion; this.MainAssemblyName = this.ModuleXml.MainAssemblyName; this.Links = this.GetLinks(this.ModuleXml); this.ModuleLocation = Path.GetDirectoryName(this.ModuleXml.XmlLocation); }
/// <summary> /// 加载存在的所有模块 /// </summary> /// <returns></returns> private List <ModuleXml> LoadModuleXml() { List <ModuleXml> loadModuleXmls = new List <ModuleXml>(); string[] xmlLocations = Directory.GetFiles(this.ModuleInformation.AppLocation, "Module.Xml", SearchOption.AllDirectories); foreach (string xmlLocation in xmlLocations) { ModuleXml moduleXml = new ModuleXml(xmlLocation); moduleXml.Initialize(); loadModuleXmls.Add(moduleXml); } return(loadModuleXmls); }
private List <Link> GetLinks(ModuleXml moduleXml) { List <Link> links = new List <Link>(); foreach (ModuleMenu mm in moduleXml.ModuleMenus) { Link link = new Link(); link.AppName = mm.AppName; link.ModuleName = moduleXml.ModuleName; link.ViewPageLocation = mm.ViewPageLocation; links.Add(link); } return(links); }