You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.IO.Compression;
|
|
|
|
|
|
|
|
|
|
namespace EntrustSettle.Extensions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 将前端UI压缩文件进行解压
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class UiFilesZipSetup
|
|
|
|
|
{
|
|
|
|
|
public static void AddUiFilesZipSetup(this IServiceCollection services, IWebHostEnvironment _env)
|
|
|
|
|
{
|
|
|
|
|
if (services == null) throw new ArgumentNullException(nameof(services));
|
|
|
|
|
|
|
|
|
|
string wwwrootFolderPath = Path.Combine(_env.ContentRootPath, "wwwroot");
|
|
|
|
|
string zipUiItemFiles = Path.Combine(wwwrootFolderPath, "ui.zip");
|
|
|
|
|
if (!File.Exists(Path.Combine(wwwrootFolderPath, "ui", "index.html")))
|
|
|
|
|
{
|
|
|
|
|
ZipFile.ExtractToDirectory(zipUiItemFiles, wwwrootFolderPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|