src/ZKEACMS/Theme/ThemePackageInstaller.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/* http://www.zkea.net/
* Copyright (c) ZKEASOFT. All rights reserved.
* http://www.zkea.net/licenses */
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Hosting;
using ZKEACMS.PackageManger;
namespace ZKEACMS.Theme
{
public class ThemePackageInstaller : FilePackageInstaller
{
private const string ThemePath = "~/themes";
private readonly IThemeService _themeService;
public ThemePackageInstaller(IWebHostEnvironment hostingEnvironment, IThemeService themeService) : base(hostingEnvironment)
{
_themeService = themeService;
}
public override string PackageInstaller
{
get
{
return "ThemePackageInstaller";
}
}
private string ResetPath(string path)
{
return path.Replace("~/Themes", ThemePath);
}
public override object Install(Package package)
{
var filePackage = package as FilePackage;
if (filePackage != null && filePackage.Files != null)
{
filePackage.Files.ForEach(file =>
{
file.FilePath = ResetPath(file.FilePath);
});
}
base.Install(package);
var themePackage = package as ThemePackage;
if (themePackage != null)
{
var newTheme = themePackage.Theme;
newTheme.Url = ResetPath(newTheme.Url);
newTheme.UrlDebugger = ResetPath(newTheme.UrlDebugger);
newTheme.Thumbnail = ResetPath(newTheme.Thumbnail);
newTheme.IsActived = false;
if (_themeService.Count(m => m.ID == newTheme.ID) == 0)
{
_themeService.Add(newTheme);
}
else
{
后面还有 30 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。