src/ZKEACMS/PackageManger/FilePackageInstaller.cs
(开头部分) 4KB这里只显示每个文件的开头 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 Easy.Extend;
using Easy.Serializer;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using ZKEACMS.Common.Service;
namespace ZKEACMS.PackageManger
{
public class FilePackageInstaller : IPackageInstaller
{
public FilePackageInstaller(IWebHostEnvironment hostingEnvironment)
{
HostingEnvironment = hostingEnvironment;
}
public IWebHostEnvironment HostingEnvironment;
public virtual string PackageInstaller
{
get
{
return "FilePackageInstaller";
}
}
public virtual string MapPath(string path)
{
if (HostingEnvironment.IsProduction())
{
return Path.Combine(HostingEnvironment.WebRootPath, path.Replace("~/", "").ToFilePath());
}
else
{
string[] pathArry = path.Replace("~/", "").Split(new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
if (pathArry.Length > 0 && pathArry[0] == Easy.Mvc.Plugin.Loader.PluginFolder)
{
return Path.Combine(new DirectoryInfo(HostingEnvironment.ContentRootPath).Parent.FullName, Path.Combine(pathArry.Skip(1).ToArray()));
}
else
{
return Path.Combine(HostingEnvironment.WebRootPath, path.Replace("~/", "").ToFilePath());
}
}
}
public virtual object Install(Package package)
{
var filePackage = package as FilePackage;
if (filePackage != null)
{
if (filePackage.Files != null)
{
filePackage.Files.ForEach(file =>
{
string filePath = MapPath(file.FilePath);
后面还有 55 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。