public static ModuleInfo Get(string moduleName) { ModulePath modulePath = new ModulePath(moduleName); if (!Directory.Exists(modulePath.PhysicalPath)) { throw new Exception(string.Format("The module does not exist.Module name:{0}".Localize(), moduleName)); } ModuleItemPath moduleInfoPath = GetModuleInfoPath(moduleName); var moduleInfo = DataContractSerializationHelper.Deserialize <ModuleInfo>(moduleInfoPath.PhysicalPath); moduleInfo.ModuleName = moduleName; return(moduleInfo); }
private static void CopyAssembies(ModuleInfo moduleInfo, ref StringBuilder log) { ModulePath modulePath = new ModulePath(moduleInfo.ModuleName); ModuleItemPath moduleBinPath = new ModuleItemPath(moduleInfo.ModuleName, "Bin"); var binPath = Settings.BinDirectory; if (Directory.Exists(moduleBinPath.PhysicalPath)) { foreach (var file in Directory.EnumerateFiles(moduleBinPath.PhysicalPath)) { string fileName = Path.GetFileName(file); if (!Assemblies.Defaults.Any(it => it.EqualsOrNullEmpty(fileName, StringComparison.CurrentCultureIgnoreCase))) { File.Copy(file, Path.Combine(binPath, fileName), true); } } } }
public virtual IEnumerable<string> All() { var baseDirectory = ModulePath.BaseDirectory; if (Directory.Exists(baseDirectory)) { foreach (var dir in IO.IOUtility.EnumerateDirectoriesExludeHidden(baseDirectory)) { var moduleName = dir.Name; var moduleConfigFile = new ModuleItemPath(moduleName, ModuleInfo.ModuleInfoFileName); if (File.Exists(moduleConfigFile.PhysicalPath)) { yield return moduleName; } } } }
private static Menu GetModuleMenu(string moduleName, ControllerContext controllerContext) { var areaName = string.Format("module-{0}", moduleName); if (!MenuFactory.ContainsAreaMenu(areaName)) { lock (lockerHelper) { if (!MenuFactory.ContainsAreaMenu(areaName)) { ModuleItemPath moduleMenuFile = new ModuleItemPath(moduleName, "menu.config"); MenuFactory.RegisterAreaMenu(areaName, moduleMenuFile.PhysicalPath); } } } var menu = MenuFactory.BuildMenu(controllerContext, areaName); return menu; }
private static Menu GetModuleMenu(string moduleName, ControllerContext controllerContext) { var areaName = string.Format("module-{0}", moduleName); if (!MenuFactory.ContainsAreaMenu(areaName)) { lock (lockerHelper) { if (!MenuFactory.ContainsAreaMenu(areaName)) { ModuleItemPath moduleMenuFile = new ModuleItemPath(moduleName, "menu.config"); MenuFactory.RegisterAreaMenu(areaName, moduleMenuFile.PhysicalPath); } } } var menu = MenuFactory.BuildMenu(controllerContext, areaName); return(menu); }
private static void RemoveAssemblies(string moduleName) { ModulePath modulePath = new ModulePath(moduleName); ModuleItemPath moduleBinPath = new ModuleItemPath(moduleName, "Bin"); var binPath = Settings.BinDirectory; if (Directory.Exists(moduleBinPath.PhysicalPath)) { foreach (var file in Directory.EnumerateFiles(moduleBinPath.PhysicalPath)) { string fileName = Path.GetFileName(file); if (!Assemblies.Defaults.Any(it => it.EqualsOrNullEmpty(fileName, StringComparison.CurrentCultureIgnoreCase))) { var binFile = Path.Combine(binPath, fileName); if (File.Exists(binFile)) { File.Delete(binFile); } } } } }
public virtual IEnumerable<ModuleItemPath> AllScripts(string moduleName) { ModuleItemPath scriptsPath = new ModuleItemPath(moduleName, "Scripts"); if (Directory.Exists(scriptsPath.PhysicalPath)) { foreach (var file in Directory.EnumerateFiles(scriptsPath.PhysicalPath, "*.js")) { yield return new ModuleItemPath(scriptsPath, Path.GetFileName(file)); } } }
private static string GetSitesModuleRelationDataFile(string moduleName) { ModuleItemPath entryPath = new ModuleItemPath(moduleName, "Sites.config"); return entryPath.PhysicalPath; }
private string ThemeRuleBody(string moduleName, string themeName) { ModuleItemPath themePath = GetThemePath(moduleName, themeName); ModuleItemPath themeRuleFile = new ModuleItemPath(themePath, "Theme.rule"); if (File.Exists(themeRuleFile.PhysicalPath)) { return File.ReadAllText(themeRuleFile.PhysicalPath); } return string.Empty; }
public virtual IEnumerable<ModuleItemPath> AllScripts(string moduleName) { ModuleItemPath scriptsPath = new ModuleItemPath(moduleName, "Scripts"); if (Directory.Exists(scriptsPath.PhysicalPath)) { var files = Directory.EnumerateFiles(scriptsPath.PhysicalPath, "*.js").Select(it => Path.GetFileName(it)); var orderFilePath = Path.Combine(scriptsPath.PhysicalPath, FileOrderHelper.OrderFileName); if (File.Exists(orderFilePath)) { files = FileOrderHelper.OrderFiles(orderFilePath, files); } foreach (var file in files) { yield return new ModuleItemPath(scriptsPath, file); } } }
public ModuleItemPath(ModuleItemPath parent, string entryName) { EntryName = entryName; PhysicalPath = Path.Combine(parent.PhysicalPath, EntryName); VirtualPath = UrlUtility.Combine(parent.VirtualPath, EntryName); }
public static void Save(ModuleInfo moduleInfo) { ModuleItemPath moduleInfoPath = GetModuleInfoPath(moduleInfo.ModuleName); DataContractSerializationHelper.Serialize(moduleInfo, moduleInfoPath.PhysicalPath); }