public static void UninstallTheme(string name) { var theme = GetTheme(name); if (theme != null) { var themeDir = Portal.ResolvePath(ThemePath.PathCombine(theme.Name)); if (Directory.Exists(themeDir)) { Directory.Delete(themeDir, true); } DeleteResource(ThemePath.PathCombine(theme.Name + ".manifest")); } else { throw new Exception(string.Format(Localization.GetLocalization(LocalizationType.Exception, "NotFound.Error", "{0} not found.", "Core"), name)); } }
public static void InstallTheme(Models.Theme theme) { var filePath = Portal.ResolvePath(ThemePath); var fileName = filePath + theme.Name + ".manifest"; if (!System.IO.File.Exists(filePath + theme.Name + ".manifest")) { theme.Thumbnail = DownloadResource(theme.Thumbnail, ThemePath.PathCombine(theme.Name)); foreach (var file in theme.Files) { file.Path = DownloadResource(file.Path, ThemePath.PathCombine(theme.Name)); } theme.ToJson().WriteText(fileName); } else { throw new Exception(string.Format(Localization.GetLocalization(LocalizationType.Exception, "DuplicateResource.Error", "{0} already exists. Duplicates Not Allowed.", "Core"), "Theme")); } }