From 2095a8d1d6efc6769c06167f00cb1aa0d63db6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 28 Nov 2024 16:30:41 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=B7=BB=E5=8A=A0=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3=E5=AE=9E=E7=8E=B0=202.=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E8=AF=BB?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/Job/FileMonitor.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/OpenAuth.App/ServiceApp/Job/FileMonitor.cs b/OpenAuth.App/ServiceApp/Job/FileMonitor.cs index d769f9a..9259a16 100644 --- a/OpenAuth.App/ServiceApp/Job/FileMonitor.cs +++ b/OpenAuth.App/ServiceApp/Job/FileMonitor.cs @@ -1,27 +1,19 @@ using System.Text; using Infrastructure.Helpers; -using Microsoft.Extensions.Configuration; using Newtonsoft.Json; -using NUnit.Framework; using OpenAuth.Repository.Domain; using Quartz; namespace OpenAuth.App.ServiceApp.Job; -class FileMonitor +class FileMonitor: IJob { - [Test] - public async System.Threading.Tasks.Task Execute() + public async System.Threading.Tasks.Task Execute(IJobExecutionContext context) { - var builder = new ConfigurationBuilder() - .SetBasePath("D:\\vs\\project_git\\Infrastructure\\OpenAuth.WebApi") - .AddJsonFile("appsettings.json"); - // 构建配置 - var configuration = builder.Build(); - // 目标目录 - var targetDirectory = configuration.GetSection("Insight:Dir").Value; - //var targetDirectory = ConfigHelper.GetConfigRoot().GetSection("Insight:Dir").Value; - var tifExtensions = new[] { ".tif", ".tfw", ".ovr", ".aux", ".xml" }; + + + var targetDirectory = ConfigHelper.GetConfigRoot().GetSection("Insight:Dir").Value; + var tifExtensions = new[] { ".tif", ".tfw", ".ovr", ".aux"}; // 相关文件扩展名 var shpExtensions = new[] { ".shp", ".shx", ".dbf", ".prj", ".cpg" }; var targetExtensions = new[] { ".tif", ".shp" }; @@ -215,4 +207,5 @@ class FileMonitor return false; } + } \ No newline at end of file