Shun 2 лет назад
Родитель
Сommit
3e9237fec9
43 измененных файлов с 475 добавлено и 281 удалено
  1. 2 2
      src/YSAI.DAQ/YSAI.Can/YSAI.Can.csproj
  2. 1 1
      src/YSAI.DAQ/YSAI.Core/YSAI.Core.csproj
  3. 1 1
      src/YSAI.DAQ/YSAI.Core/data/AddressHandler.cs
  4. 2 2
      src/YSAI.DAQ/YSAI.DB/YSAI.DB.csproj
  5. 228 131
      src/YSAI.DAQ/YSAI.DaqManage/DaqManageOperate.cs
  6. 1 1
      src/YSAI.DAQ/YSAI.DaqManage/YSAI.DaqManage.csproj
  7. 1 1
      src/YSAI.DAQ/YSAI.Kafka/KafkaOperate.cs
  8. 2 2
      src/YSAI.DAQ/YSAI.Kafka/YSAI.Kafka.csproj
  9. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Can.Pack/YSAI.Can.dll
  10. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Can.Pack/YSAI.Can.pdb
  11. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Can.Pack/YSAI.Core.dll
  12. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.DB.Pack/YSAI.Core.dll
  13. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.DB.Pack/YSAI.DB.dll
  14. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.DB.Pack/YSAI.DB.pdb
  15. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Kafka.Pack/YSAI.Core.dll
  16. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Kafka.Pack/YSAI.Kafka.dll
  17. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Kafka.Pack/YSAI.Kafka.pdb
  18. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Modbus.Pack/YSAI.Core.dll
  19. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Modbus.Pack/YSAI.Modbus.dll
  20. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Modbus.Pack/YSAI.Modbus.pdb
  21. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Mqtt.Pack/YSAI.Core.dll
  22. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Mqtt.Pack/YSAI.Mqtt.dll
  23. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Mqtt.Pack/YSAI.Mqtt.pdb
  24. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Opc.Pack/YSAI.Core.dll
  25. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Opc.Pack/YSAI.Opc.dll
  26. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.Opc.Pack/YSAI.Opc.pdb
  27. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.RabbitMQ.Pack/YSAI.Core.dll
  28. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.RabbitMQ.Pack/YSAI.RabbitMQ.dll
  29. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.RabbitMQ.Pack/YSAI.RabbitMQ.pdb
  30. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.S7.Pack/YSAI.Core.dll
  31. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.S7.Pack/YSAI.S7.dll
  32. BIN
      src/YSAI.DAQ/YSAI.Lib/YSAI.S7.Pack/YSAI.S7.pdb
  33. 1 1
      src/YSAI.DAQ/YSAI.Manage/Controllers/FileOperateController.cs
  34. 2 2
      src/YSAI.DAQ/YSAI.Modbus/YSAI.Modbus.csproj
  35. 2 2
      src/YSAI.DAQ/YSAI.Mqtt/YSAI.Mqtt.csproj
  36. 1 1
      src/YSAI.DAQ/YSAI.Mqtt/client/MqttClientOperate.cs
  37. 2 2
      src/YSAI.DAQ/YSAI.Opc/YSAI.Opc.csproj
  38. 1 1
      src/YSAI.DAQ/YSAI.RabbitMQ/RabbitMQOperate.cs
  39. 2 2
      src/YSAI.DAQ/YSAI.RabbitMQ/YSAI.RabbitMQ.csproj
  40. 222 125
      src/YSAI.DAQ/YSAI.RelayManage/RelayManageOperate.cs
  41. 1 1
      src/YSAI.DAQ/YSAI.RelayManage/YSAI.RelayManage.csproj
  42. 2 2
      src/YSAI.DAQ/YSAI.S7/YSAI.S7.csproj
  43. 1 1
      src/YSAI.DAQ/YSAI.Test/YSAI.Test.csproj

+ 2 - 2
src/YSAI.DAQ/YSAI.Can/YSAI.Can.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.6</Version>
+	  <Version>1.0.0.7</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>
@@ -24,7 +24,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+    <PackageReference Include="YSAI.Core" Version="1.0.0.26" />
   </ItemGroup>
 
   <!--<ItemGroup>

+ 1 - 1
src/YSAI.DAQ/YSAI.Core/YSAI.Core.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
     <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-    <Version>1.0.0.25</Version>
+    <Version>1.0.0.26</Version>
     <Authors>Shun</Authors>
     <Company>YSAI</Company>
     <Product>SCADA</Product>

+ 1 - 1
src/YSAI.DAQ/YSAI.Core/data/AddressHandler.cs

@@ -63,7 +63,7 @@ namespace YSAI.Core.data
                     if (!operateResult.State)
                     {
                         //转发失败存入本地记录
-                        LogHelper.Verbose($"\"Value\":\"{addressValue.ToJson()}\",\"State\":\"{operateResult.State}\",\"Exception\":\"{operateResult.Message}\"", FailDataLog);
+                        LogHelper.Verbose("{" + $"\"Value\":\"{addressValue.ToJson()}\",\"State\":\"{operateResult.State}\",\"Exception\":\"{operateResult.Message}\"" + "}", FailDataLog);
                     }
                 }
 

+ 2 - 2
src/YSAI.DAQ/YSAI.DB/YSAI.DB.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.6</Version>
+	  <Version>1.0.0.7</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>
@@ -18,7 +18,7 @@
 		<PackageReference Include="System.Data.OracleClient" Version="1.0.8" />
 		<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
 		<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
-		<PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+		<PackageReference Include="YSAI.Core" Version="1.0.0.26" />
 	</ItemGroup>
 	<!--<ItemGroup>
 		<ProjectReference Include="..\YSAI.Core\YSAI.Core.csproj" />

+ 228 - 131
src/YSAI.DAQ/YSAI.DaqManage/DaqManageOperate.cs

@@ -8,6 +8,7 @@ using YSAI.Unility;
 using static YSAI.DaqManage.DaqManageData;
 using YSAI.Core.@enum;
 using Microsoft.Extensions.FileSystemGlobbing;
+using System.IO;
 
 namespace YSAI.DaqManage
 {
@@ -168,13 +169,10 @@ namespace YSAI.DaqManage
                     Search();
 
 
-
                     //文件夹监控
                     watcherLibFolder = new FileSystemWatcher(basics.LibFolder);
-                    //监控的配置
-                    watcherLibFolder.Filter = basics.DllWatcherFormat;
                     // 设置监控类型
-                    watcherLibFolder.NotifyFilter = 
+                    watcherLibFolder.NotifyFilter =
                     NotifyFilters.FileName |                    //文件的名称
                     NotifyFilters.DirectoryName |               //目录名
                     NotifyFilters.Attributes |                  //文件或文件夹的属性
@@ -190,14 +188,13 @@ namespace YSAI.DaqManage
                     //启动监听
                     watcherLibFolder.EnableRaisingEvents = true;
 
-                  
 
                     //文件夹监视
                     watcherLibConfigFolder = new FileSystemWatcher(basics.LibConfigFolder);
                     //监控的配置
                     watcherLibConfigFolder.Filter = basics.ConfigWatcherFormat;
                     // 设置监控类型
-                    watcherLibConfigFolder.NotifyFilter =
+                    watcherLibFolder.NotifyFilter =
                     NotifyFilters.FileName |                    //文件的名称
                     NotifyFilters.DirectoryName |               //目录名
                     NotifyFilters.Attributes |                  //文件或文件夹的属性
@@ -220,77 +217,228 @@ namespace YSAI.DaqManage
                 }
             });
         }
+
         /// <summary>
-        /// 当文件夹中删除文件
+        /// 数据队列
         /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        /// <param name="Type">【0:库文件】【1:配置文件】</param>
-        private void Watcher_Deleted(object sender, FileSystemEventArgs e, int Type)
+        private ConcurrentQueue<WatcherData> WatcherQueue;
+        /// <summary>
+        /// 监控开关 
+        /// </summary>
+        private CancellationTokenSource WatcherToken;
+        /// <summary>
+        /// 文件监控数据
+        /// </summary>
+        private class WatcherData
         {
-            //程序集ISn
-            string TypeIocSN = string.Empty;
-            switch (Type)
+            public FileSystemEventArgs e { get; set; }
+            public int Type { get; set; }
+            public WatcherType WType { get; set; }
+            public enum WatcherType
             {
-                case 0:
-                    //程序集ISn
-                    TypeIocSN = e.Name.Replace(".dll", string.Empty);
+                Deleted,
+                Created
+            }
+        }
 
-                    foreach (var item in InstanceIoc)
-                    {
-                        if (item.Key.Contains(TypeIocSN))
-                        {
-                            InstanceIoc[item.Key].Dispose();
-                            if (InstanceIoc.Remove(item.Key, out _))
-                            {
-                                OnEventHandler(this, new EventResult(true, $"{e.Name} 移除配置实例 {item.Key} 成功"));
-                            }
-                            else
-                            {
-                                OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例 {item.Key} 失败"));
-                            }
-                        }
-                    }
+        /// <summary>
+        /// 监控任务
+        /// </summary>
+        /// <returns></returns>
+        public Task WatcherTask()
+        {
+            return Task.Factory.StartNew(() => {
+                while (!WatcherToken.IsCancellationRequested)
+                {
+                    //队列数据
+                    WatcherData? watcherData;
 
-                    foreach (var item in TypeIoc)
-                    {
-                        if (item.Key.Contains(TypeIocSN))
-                        {
-                            if (TypeIoc.Remove(item.Key, out _))
-                            {
-                                OnEventHandler(this, new EventResult(true, $"{e.Name} 移除程序集 {item.Key} 成功"));
-                            }
-                            else
-                            {
-                                OnEventHandler(this, new EventResult(false, $"{e.Name} 移除程序集 {item.Key} 失败"));
-                            }
-                        }
-                    }
-                    break;
-                case 1:
-                    OnEventHandler(this, new EventResult(true, $"{e.Name} 文件被删除,移除对应配置实例"));
-                    //实例的ISn
-                    string InstanceIocSN = e.Name.Replace(basics.ConfigReplaceFormat, string.Empty);
-                    //程序集ISn
-                    TypeIocSN = InstanceIocSN.Replace($".{InstanceIocSN.Split('.')[InstanceIocSN.Split('.').Length - 1]}", string.Empty);
-                    if (InstanceIoc.ContainsKey(InstanceIocSN))
+                    while (WatcherQueue.TryDequeue(out watcherData))
                     {
-                        InstanceIoc[InstanceIocSN].Dispose();
-                        if (InstanceIoc.Remove(InstanceIocSN, out _))
-                        {
-                            OnEventHandler(this, new EventResult(true, $"{e.Name} 移除配置实例成功"));
-                        }
-                        else
+                        Thread.Sleep(1000);
+
+                        FileSystemEventArgs e = watcherData.e;
+                        int Type = watcherData.Type;
+                        //程序集ISn
+                        string TypeIocSN = string.Empty;
+                        switch (watcherData.WType)
                         {
-                            OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例失败"));
+                            case WatcherData.WatcherType.Deleted:
+
+                                switch (Type)
+                                {
+                                    case 0:
+                                        //这是文件夹
+                                        if (Directory.Exists(e.FullPath))
+                                        {
+                                            //检索里面的文件
+                                            List<string> libs = Directory.GetFiles(e.FullPath, basics.DllWatcherFormat, SearchOption.AllDirectories).ToList();
+                                            //检索文件
+                                            foreach (var lib in libs)
+                                            {
+                                                //文件名称
+                                                string fileName = FileTool.GetFileName(lib);
+
+                                                //程序集ISn
+                                                TypeIocSN = fileName.Replace(".dll", string.Empty);
+
+                                                //检索实例容器
+                                                foreach (var item in InstanceIoc)
+                                                {
+                                                    if (item.Key.Contains(TypeIocSN))
+                                                    {
+                                                        InstanceIoc[item.Key].Dispose();
+                                                        if (InstanceIoc.Remove(item.Key, out _))
+                                                        {
+                                                            OnEventHandler(this, new EventResult(true, $"{e.Name} 移除配置实例 {item.Key} 成功"));
+                                                        }
+                                                        else
+                                                        {
+                                                            OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例 {item.Key} 失败"));
+                                                        }
+                                                    }
+                                                }
+                                                //检索库类型容器
+                                                foreach (var item in TypeIoc)
+                                                {
+                                                    if (item.Key.Contains(TypeIocSN))
+                                                    {
+                                                        if (TypeIoc.Remove(item.Key, out _))
+                                                        {
+                                                            OnEventHandler(this, new EventResult(true, $"{e.Name} 移除程序集 {item.Key} 成功"));
+                                                        }
+                                                        else
+                                                        {
+                                                            OnEventHandler(this, new EventResult(false, $"{e.Name} 移除程序集 {item.Key} 失败"));
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                        break;
+                                    case 1:
+                                        OnEventHandler(this, new EventResult(true, $"{e.Name} 文件被删除,移除对应配置实例"));
+                                        //实例的ISn
+                                        string InstanceIocSN = e.Name.Replace(basics.ConfigReplaceFormat, string.Empty);
+                                        //程序集ISn
+                                        TypeIocSN = InstanceIocSN.Replace($".{InstanceIocSN.Split('.')[InstanceIocSN.Split('.').Length - 1]}", string.Empty);
+                                        if (InstanceIoc.ContainsKey(InstanceIocSN))
+                                        {
+                                            InstanceIoc[InstanceIocSN].Dispose();
+                                            if (InstanceIoc.Remove(InstanceIocSN, out _))
+                                            {
+                                                OnEventHandler(this, new EventResult(true, $"{e.Name} 移除配置实例成功"));
+                                            }
+                                            else
+                                            {
+                                                OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例失败"));
+                                            }
+                                        }
+                                        else
+                                        {
+                                            OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例失败 {TypeIocSN} 实例不存在"));
+                                        }
+                                        break;
+                                }
+
+                                break;
+                            case WatcherData.WatcherType.Created:
+
+
+                                switch (Type)
+                                {
+                                    case 0:
+                                        //这是文件夹
+                                        if (Directory.Exists(e.FullPath))
+                                        {
+                                            //检索里面的文件
+                                            Search(e.FullPath);
+                                        }
+                                        break;
+                                    case 1:
+                                        OnEventHandler(this, new EventResult(true, $"{e.Name} 文件新增,新增对应配置实例"));
+                                        #region 新增对应配置实例
+                                        int until = 5;
+                                        int i = 0;
+                                        bool success = false;
+                                        while (!success && i < until)
+                                        {
+                                            try
+                                            {
+                                                string path = String.Format(e.FullPath);
+                                                string? filename = Path.GetFileName(path);
+                                                using (Stream fs = System.IO.File.OpenRead(@path))
+                                                {
+                                                    StreamReader srdPreview = new StreamReader(fs);
+                                                    String temp = string.Empty;
+                                                    while (srdPreview.Peek() > -1)
+                                                    {
+                                                        String input = srdPreview.ReadLine();
+                                                        temp += input;
+                                                    }
+                                                    srdPreview.Close();
+                                                    srdPreview.Dispose();
+
+                                                    //实例的ISn
+                                                    string InstanceIocSN = e.Name.Replace(basics.ConfigReplaceFormat, string.Empty);
+                                                    //程序集ISn
+                                                    TypeIocSN = InstanceIocSN.Replace($".{InstanceIocSN.Split('.')[InstanceIocSN.Split('.').Length - 1]}", string.Empty);
+                                                    //判断是否存在此程序集ISn
+                                                    if (TypeIoc.ContainsKey(TypeIocSN))
+                                                    {
+                                                        if (!InstanceIoc.ContainsKey(InstanceIocSN))
+                                                        {
+                                                            ConfigCreateInstance(TypeIoc[TypeIocSN], temp);
+                                                        }
+                                                        else
+                                                        {
+                                                            OnEventHandler(this, new EventResult(false, $" {e.Name} 此配置实例已存在"));
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        OnEventHandler(this, new EventResult(false, $" {e.Name} 新增对应配置创建实例失败 {TypeIocSN} 程序集不存在"));
+                                                    }
+                                                    fs.Close();
+                                                    fs.Dispose();
+                                                }
+                                                success = true;
+                                            }
+                                            catch
+                                            {
+                                                i++;
+                                                Thread.Sleep(TimeSpan.FromSeconds(1));
+                                            }
+                                        }
+                                        #endregion
+                                        break;
+                                }
+
+
+                                break;
                         }
                     }
-                    else
-                    {
-                        OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例失败 {TypeIocSN} 实例不存在"));
-                    }
-                    break;
+                    Thread.Sleep(1000);
+                }
+            });
+        }
+
+        /// <summary>
+        /// 当文件夹中删除文件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <param name="Type">【0:库文件】【1:配置文件】</param>
+        private void Watcher_Deleted(object sender, FileSystemEventArgs e, int Type)
+        {
+            if (WatcherToken == null && WatcherQueue == null)
+            {
+                WatcherQueue = new ConcurrentQueue<WatcherData>();
+                WatcherToken = new CancellationTokenSource();
+                WatcherTask();
             }
+
+            WatcherQueue.Enqueue(new WatcherData { e = e, Type = Type, WType = WatcherData.WatcherType.Deleted });
         }
 
         /// <summary>
@@ -301,80 +449,29 @@ namespace YSAI.DaqManage
         /// <param name="Type">【0:库文件】【1:配置文件】</param>
         private void Watcher_Created(object sender, FileSystemEventArgs e, int Type)
         {
-            switch (Type)
+            if (WatcherToken == null && WatcherQueue == null)
             {
-                case 0:
-                    SearchType(e.FullPath);
-                    break;
-                case 1:
-                    OnEventHandler(this, new EventResult(true, $"{e.Name} 文件新增,新增对应配置实例"));
-                    #region 新增对应配置实例
-                    int until = 5;
-                    int i = 0;
-                    bool success = false;
-                    while (!success && i < until)
-                    {
-                        try
-                        {
-                            string path = String.Format(e.FullPath);
-                            string? filename = Path.GetFileName(path);
-                            using (Stream fs = System.IO.File.OpenRead(@path))
-                            {
-                                StreamReader srdPreview = new StreamReader(fs);
-                                String temp = string.Empty;
-                                while (srdPreview.Peek() > -1)
-                                {
-                                    String input = srdPreview.ReadLine();
-                                    temp += input;
-                                }
-                                srdPreview.Close();
-                                srdPreview.Dispose();
-
-                                //实例的ISn
-                                string InstanceIocSN = e.Name.Replace(basics.ConfigReplaceFormat, string.Empty);
-                                //程序集ISn
-                                string TypeIocSN = InstanceIocSN.Replace($".{InstanceIocSN.Split('.')[InstanceIocSN.Split('.').Length - 1]}", string.Empty);
-                                //判断是否存在此程序集ISn
-                                if (TypeIoc.ContainsKey(TypeIocSN))
-                                {
-                                    if (!InstanceIoc.ContainsKey(InstanceIocSN))
-                                    {
-                                        ConfigCreateInstance(TypeIoc[TypeIocSN], temp);
-                                    }
-                                    else
-                                    {
-                                        OnEventHandler(this, new EventResult(false, $" {e.Name} 此配置实例已存在"));
-                                    }
-                                }
-                                else
-                                {
-                                    OnEventHandler(this, new EventResult(false, $" {e.Name} 新增对应配置创建实例失败 {TypeIocSN} 程序集不存在"));
-                                }
-                                fs.Close();
-                                fs.Dispose();
-                            }
-                            success = true;
-                        }
-                        catch
-                        {
-                            i++;
-                            Thread.Sleep(TimeSpan.FromSeconds(1));
-                        }
-                    }
-                    #endregion
-                    break;
+                WatcherQueue = new ConcurrentQueue<WatcherData>();
+                WatcherToken = new CancellationTokenSource();
+                WatcherTask();
             }
+
+            WatcherQueue.Enqueue(new WatcherData { e = e, Type = Type, WType = WatcherData.WatcherType.Created });
         }
 
         /// <summary>
         /// 检索文件并创建实例
         /// </summary>
-        private void Search()
+        private void Search(string? path = null)
         {
             try
             {
+                if (string.IsNullOrWhiteSpace(path))
+                {
+                    path = basics.LibFolder;
+                }
                 //库
-                List<string> libs = Directory.GetFiles(basics.LibFolder, "YSAI.*.dll", SearchOption.AllDirectories).ToList();
+                List<string> libs = Directory.GetFiles(path, basics.DllWatcherFormat, SearchOption.AllDirectories).ToList();
                 //循环文件,添加程序集
                 foreach (var lib in libs)
                 {
@@ -1034,11 +1131,11 @@ namespace YSAI.DaqManage
             return Write(pairs, ISn);
         }
         /// <summary>
-        /// 设置库文件
+        /// 设置库文件ZIP
         /// </summary>
         /// <param name="FormFiles">文件集合</param>
         /// <returns>统一出参</returns>
-        public OperateResult SettingLib(List<IFormFile> FormFiles)
+        public OperateResult SettingLibZip(List<IFormFile> FormFiles)
         {
             Depart("SettingLib");
             try

+ 1 - 1
src/YSAI.DAQ/YSAI.DaqManage/YSAI.DaqManage.csproj

@@ -7,7 +7,7 @@
   </PropertyGroup>
 	<ItemGroup>
 		<FrameworkReference Include="Microsoft.AspNetCore.App" />
-		<PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+		<PackageReference Include="YSAI.Core" Version="1.0.0.26" />
 	</ItemGroup>
 
 	<!--<ItemGroup>

+ 1 - 1
src/YSAI.DAQ/YSAI.Kafka/KafkaOperate.cs

@@ -115,7 +115,7 @@ namespace YSAI.Kafka
                             string Content = result.Message.Value;
                             string Key = result.Message.Key;
                             long Offset = result.TopicPartitionOffset.Offset.Value;
-                            OnEventHandler(this, new EventResult(true, $"{LogHead} 接收到主题 ( {Topic} ) 内容 ( {Content} ) 键 ( {Key} ) 偏移量 ( {Offset} )", $"\"Topic\":\"{Topic}\",\"Content\":\"{Content}\",\"Key\":\"{Key}\",\"Offset\":\"{Offset}\"", Core.@enum.ResultType.Dynamic));
+                            OnEventHandler(this, new EventResult(true, $"{LogHead} 接收到主题 ( {Topic} ) 内容 ( {Content} ) 键 ( {Key} ) 偏移量 ( {Offset} )", "{" + $"\"Topic\":\"{Topic}\",\"Content\":\"{Content}\",\"Key\":\"{Key}\",\"Offset\":\"{Offset}\"" + "}", Core.@enum.ResultType.Dynamic));
                             //消息已处理提交偏移量
                             Consumer?.Commit(result);
                         }

+ 2 - 2
src/YSAI.DAQ/YSAI.Kafka/YSAI.Kafka.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.7</Version>
+	  <Version>1.0.0.8</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>
@@ -14,7 +14,7 @@
 
   <ItemGroup>
     <PackageReference Include="Confluent.Kafka" Version="2.2.0" />
-    <PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+    <PackageReference Include="YSAI.Core" Version="1.0.0.26" />
   </ItemGroup>
 	
 	<!--<ItemGroup>

BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Can.Pack/YSAI.Can.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Can.Pack/YSAI.Can.pdb


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Can.Pack/YSAI.Core.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.DB.Pack/YSAI.Core.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.DB.Pack/YSAI.DB.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.DB.Pack/YSAI.DB.pdb


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Kafka.Pack/YSAI.Core.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Kafka.Pack/YSAI.Kafka.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Kafka.Pack/YSAI.Kafka.pdb


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Modbus.Pack/YSAI.Core.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Modbus.Pack/YSAI.Modbus.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Modbus.Pack/YSAI.Modbus.pdb


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Mqtt.Pack/YSAI.Core.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Mqtt.Pack/YSAI.Mqtt.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Mqtt.Pack/YSAI.Mqtt.pdb


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Opc.Pack/YSAI.Core.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Opc.Pack/YSAI.Opc.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.Opc.Pack/YSAI.Opc.pdb


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.RabbitMQ.Pack/YSAI.Core.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.RabbitMQ.Pack/YSAI.RabbitMQ.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.RabbitMQ.Pack/YSAI.RabbitMQ.pdb


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.S7.Pack/YSAI.Core.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.S7.Pack/YSAI.S7.dll


BIN
src/YSAI.DAQ/YSAI.Lib/YSAI.S7.Pack/YSAI.S7.pdb


+ 1 - 1
src/YSAI.DAQ/YSAI.Manage/Controllers/FileOperateController.cs

@@ -26,7 +26,7 @@ namespace YSAI.Manage.Controllers
         [HttpPost]
         public OperateResult SettingLib(List<IFormFile> FormFiles)
         {
-            return daqManageOperate.SettingLib(FormFiles);
+            return daqManageOperate.SettingLibZip(FormFiles);
         }
 
         /// <summary>

+ 2 - 2
src/YSAI.DAQ/YSAI.Modbus/YSAI.Modbus.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.6</Version>
+	  <Version>1.0.0.7</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>
@@ -13,7 +13,7 @@
   </PropertyGroup>
 
 	<ItemGroup>
-    <PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+    <PackageReference Include="YSAI.Core" Version="1.0.0.26" />
   </ItemGroup>
 
 	<!--<ItemGroup>

+ 2 - 2
src/YSAI.DAQ/YSAI.Mqtt/YSAI.Mqtt.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.7</Version>
+	  <Version>1.0.0.8</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>
@@ -15,7 +15,7 @@
   <ItemGroup>
     <PackageReference Include="MQTTnet" Version="4.3.1.873" />
     <PackageReference Include="MQTTnet.AspNetCore" Version="4.3.1.873" />
-    <PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+    <PackageReference Include="YSAI.Core" Version="1.0.0.26" />
   </ItemGroup>
 
 	<!--<ItemGroup>

+ 1 - 1
src/YSAI.DAQ/YSAI.Mqtt/client/MqttClientOperate.cs

@@ -90,7 +90,7 @@ namespace YSAI.Mqtt.client
             string Topic = arg.ApplicationMessage.Topic;
             string Content = Encoding.UTF8.GetString(arg.ApplicationMessage.Payload);
             string ClientID = arg.ClientId;
-            OnEventHandler(this, new EventResult(true, $"{LogHead} 接收到主题 ( {Topic} ) 内容 ( {Content} )", $"\"Topic\":\"{Topic}\",\"Content\":\"{Content}\",\"ClientID\":\"{ClientID}\"", Core.@enum.ResultType.Dynamic));
+            OnEventHandler(this, new EventResult(true, $"{LogHead} 接收到主题 ( {Topic} ) 内容 ( {Content} )", "{" + $"\"Topic\":\"{Topic}\",\"Content\":\"{Content}\",\"ClientID\":\"{ClientID}\"" + "}", Core.@enum.ResultType.Dynamic));
             await Task.CompletedTask;
         }
 

+ 2 - 2
src/YSAI.DAQ/YSAI.Opc/YSAI.Opc.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.9</Version>
+	  <Version>1.0.0.10</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>
@@ -13,7 +13,7 @@
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.4.372.56" />
-	<PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+	<PackageReference Include="YSAI.Core" Version="1.0.0.26" />
   </ItemGroup>
 
 

+ 1 - 1
src/YSAI.DAQ/YSAI.RabbitMQ/RabbitMQOperate.cs

@@ -298,7 +298,7 @@ namespace YSAI.RabbitMQ
             }
             string Topic = e.RoutingKey;
             string Content = Encoding.UTF8.GetString(e.Body.ToArray());
-            OnEventHandler(this, new EventResult(true, $"{LogHead} 接收到主题 ( {Topic} ) 内容 ( {Content} )", $"\"Topic\":\"{Topic}\",\"Content\":\"{Content}\"", Core.@enum.ResultType.Dynamic));
+            OnEventHandler(this, new EventResult(true, $"{LogHead} 接收到主题 ( {Topic} ) 内容 ( {Content} )", "{" + $"\"Topic\":\"{Topic}\",\"Content\":\"{Content}\"" + "}", Core.@enum.ResultType.Dynamic));
         }
         public Task<OperateResult> OnAsync()
         {

+ 2 - 2
src/YSAI.DAQ/YSAI.RabbitMQ/YSAI.RabbitMQ.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.7</Version>
+	  <Version>1.0.0.8</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>
@@ -14,7 +14,7 @@
 
   <ItemGroup>
     <PackageReference Include="RabbitMQ.Client" Version="6.5.0" />
-    <PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+    <PackageReference Include="YSAI.Core" Version="1.0.0.26" />
   </ItemGroup>
 	<!--<ItemGroup>
 		<ProjectReference Include="..\YSAI.Core\YSAI.Core.csproj" />

+ 222 - 125
src/YSAI.DAQ/YSAI.RelayManage/RelayManageOperate.cs

@@ -204,8 +204,6 @@ namespace YSAI.RelayManage
 
                     //文件夹监控
                     watcherLibFolder = new FileSystemWatcher(basics.LibFolder);
-                    //监控的配置
-                    watcherLibFolder.Filter = basics.DllWatcherFormat;
                     // 设置监控类型
                     watcherLibFolder.NotifyFilter =
                     NotifyFilters.FileName |                    //文件的名称
@@ -254,76 +252,226 @@ namespace YSAI.RelayManage
         }
 
         /// <summary>
-        /// 当文件夹中删除文件
+        /// 数据队列
         /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        /// <param name="Type">【0:库文件】【1:配置文件】</param>
-        private void Watcher_Deleted(object sender, FileSystemEventArgs e, int Type)
+        private ConcurrentQueue<WatcherData> WatcherQueue;
+        /// <summary>
+        /// 监控开关 
+        /// </summary>
+        private CancellationTokenSource WatcherToken;
+        /// <summary>
+        /// 文件监控数据
+        /// </summary>
+        private class WatcherData
         {
-            //程序集ISn
-            string TypeIocSN = string.Empty;
-            switch (Type)
+            public FileSystemEventArgs e { get; set; }
+            public int Type { get; set; }
+            public WatcherType WType { get; set; }
+            public enum WatcherType
             {
-                case 0:
-                    //程序集ISn
-                    TypeIocSN = e.Name.Replace(".dll", string.Empty);
+                Deleted,
+                Created
+            }
+        }
 
-                    foreach (var item in InstanceIoc)
-                    {
-                        if (item.Key.Contains(TypeIocSN))
-                        {
-                            InstanceIoc[item.Key].Dispose();
-                            if (InstanceIoc.Remove(item.Key, out _))
-                            {
-                                OnEventHandler(this, new EventResult(true, $"{e.Name} 移除配置实例 {item.Key} 成功"));
-                            }
-                            else
-                            {
-                                OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例 {item.Key} 失败"));
-                            }
-                        }
-                    }
+        /// <summary>
+        /// 监控任务
+        /// </summary>
+        /// <returns></returns>
+        public Task WatcherTask()
+        {
+            return Task.Factory.StartNew(() => {
+                while (!WatcherToken.IsCancellationRequested)
+                {
+                    //队列数据
+                    WatcherData? watcherData;
 
-                    foreach (var item in TypeIoc)
+                    while (WatcherQueue.TryDequeue(out watcherData))
                     {
-                        if (item.Key.Contains(TypeIocSN))
-                        {
-                            if (TypeIoc.Remove(item.Key, out _))
-                            {
-                                OnEventHandler(this, new EventResult(true, $"{e.Name} 移除程序集 {item.Key} 成功"));
-                            }
-                            else
-                            {
-                                OnEventHandler(this, new EventResult(false, $"{e.Name} 移除程序集 {item.Key} 失败"));
-                            }
-                        }
-                    }
-                    break;
-                case 1:
-                    OnEventHandler(this, new EventResult(true, $"{e.Name} 文件被删除,移除对应配置实例"));
-                    //实例的ISn
-                    string InstanceIocSN = e.Name.Replace(basics.ConfigReplaceFormat, string.Empty);
-                    //程序集ISn
-                    TypeIocSN = InstanceIocSN.Replace($".{InstanceIocSN.Split('.')[InstanceIocSN.Split('.').Length - 1]}", string.Empty);
-                    if (InstanceIoc.ContainsKey(InstanceIocSN))
-                    {
-                        InstanceIoc[InstanceIocSN].Dispose();
-                        if (InstanceIoc.Remove(InstanceIocSN, out _))
-                        {
-                            OnEventHandler(this, new EventResult(true, $"{e.Name} 移除配置实例成功"));
-                        }
-                        else
+                        Thread.Sleep(1000);
+
+                        FileSystemEventArgs e = watcherData.e;
+                        int Type = watcherData.Type;
+                        //程序集ISn
+                        string TypeIocSN = string.Empty;
+                        switch (watcherData.WType)
                         {
-                            OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例失败"));
+                            case WatcherData.WatcherType.Deleted:
+
+                                switch (Type)
+                                {
+                                    case 0:
+                                        //这是文件夹
+                                        if (Directory.Exists(e.FullPath))
+                                        {
+                                            //检索里面的文件
+                                            List<string> libs = Directory.GetFiles(e.FullPath, basics.DllWatcherFormat, SearchOption.AllDirectories).ToList();
+                                            //检索文件
+                                            foreach (var lib in libs)
+                                            {
+                                                //文件名称
+                                                string fileName = FileTool.GetFileName(lib);
+
+                                                //程序集ISn
+                                                TypeIocSN = fileName.Replace(".dll", string.Empty);
+
+                                                //检索实例容器
+                                                foreach (var item in InstanceIoc)
+                                                {
+                                                    if (item.Key.Contains(TypeIocSN))
+                                                    {
+                                                        InstanceIoc[item.Key].Dispose();
+                                                        if (InstanceIoc.Remove(item.Key, out _))
+                                                        {
+                                                            OnEventHandler(this, new EventResult(true, $"{e.Name} 移除配置实例 {item.Key} 成功"));
+                                                        }
+                                                        else
+                                                        {
+                                                            OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例 {item.Key} 失败"));
+                                                        }
+                                                    }
+                                                }
+                                                //检索库类型容器
+                                                foreach (var item in TypeIoc)
+                                                {
+                                                    if (item.Key.Contains(TypeIocSN))
+                                                    {
+                                                        if (TypeIoc.Remove(item.Key, out _))
+                                                        {
+                                                            OnEventHandler(this, new EventResult(true, $"{e.Name} 移除程序集 {item.Key} 成功"));
+                                                        }
+                                                        else
+                                                        {
+                                                            OnEventHandler(this, new EventResult(false, $"{e.Name} 移除程序集 {item.Key} 失败"));
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                        }
+                                        break;
+                                    case 1:
+                                        OnEventHandler(this, new EventResult(true, $"{e.Name} 文件被删除,移除对应配置实例"));
+                                        //实例的ISn
+                                        string InstanceIocSN = e.Name.Replace(basics.ConfigReplaceFormat, string.Empty);
+                                        //程序集ISn
+                                        TypeIocSN = InstanceIocSN.Replace($".{InstanceIocSN.Split('.')[InstanceIocSN.Split('.').Length - 1]}", string.Empty);
+                                        if (InstanceIoc.ContainsKey(InstanceIocSN))
+                                        {
+                                            InstanceIoc[InstanceIocSN].Dispose();
+                                            if (InstanceIoc.Remove(InstanceIocSN, out _))
+                                            {
+                                                OnEventHandler(this, new EventResult(true, $"{e.Name} 移除配置实例成功"));
+                                            }
+                                            else
+                                            {
+                                                OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例失败"));
+                                            }
+                                        }
+                                        else
+                                        {
+                                            OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例失败 {TypeIocSN} 实例不存在"));
+                                        }
+                                        break;
+                                }
+
+                                break;
+                            case WatcherData.WatcherType.Created:
+
+
+                                switch (Type)
+                                {
+                                    case 0:
+                                        //这是文件夹
+                                        if (Directory.Exists(e.FullPath))
+                                        {
+                                            //检索里面的文件
+                                            Search(e.FullPath);
+                                        }
+                                        break;
+                                    case 1:
+                                        OnEventHandler(this, new EventResult(true, $"{e.Name} 文件新增,新增对应配置实例"));
+                                        #region 新增对应配置实例
+                                        int until = 5;
+                                        int i = 0;
+                                        bool success = false;
+                                        while (!success && i < until)
+                                        {
+                                            try
+                                            {
+                                                string path = String.Format(e.FullPath);
+                                                string? filename = Path.GetFileName(path);
+                                                using (Stream fs = System.IO.File.OpenRead(@path))
+                                                {
+                                                    StreamReader srdPreview = new StreamReader(fs);
+                                                    String temp = string.Empty;
+                                                    while (srdPreview.Peek() > -1)
+                                                    {
+                                                        String input = srdPreview.ReadLine();
+                                                        temp += input;
+                                                    }
+                                                    srdPreview.Close();
+                                                    srdPreview.Dispose();
+
+                                                    //实例的ISn
+                                                    string InstanceIocSN = e.Name.Replace(basics.ConfigReplaceFormat, string.Empty);
+                                                    //程序集ISn
+                                                    TypeIocSN = InstanceIocSN.Replace($".{InstanceIocSN.Split('.')[InstanceIocSN.Split('.').Length - 1]}", string.Empty);
+                                                    //判断是否存在此程序集ISn
+                                                    if (TypeIoc.ContainsKey(TypeIocSN))
+                                                    {
+                                                        if (!InstanceIoc.ContainsKey(InstanceIocSN))
+                                                        {
+                                                            ConfigCreateInstance(TypeIoc[TypeIocSN], temp);
+                                                        }
+                                                        else
+                                                        {
+                                                            OnEventHandler(this, new EventResult(false, $" {e.Name} 此配置实例已存在"));
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        OnEventHandler(this, new EventResult(false, $" {e.Name} 新增对应配置创建实例失败 {TypeIocSN} 程序集不存在"));
+                                                    }
+                                                    fs.Close();
+                                                    fs.Dispose();
+                                                }
+                                                success = true;
+                                            }
+                                            catch
+                                            {
+                                                i++;
+                                                Thread.Sleep(TimeSpan.FromSeconds(1));
+                                            }
+                                        }
+                                        #endregion
+                                        break;
+                                }
+
+
+                                break;
                         }
                     }
-                    else
-                    {
-                        OnEventHandler(this, new EventResult(false, $"{e.Name} 移除配置实例失败 {TypeIocSN} 实例不存在"));
-                    }
-                    break;
+                    Thread.Sleep(1000);
+                }
+            });
+        }
+
+        /// <summary>
+        /// 当文件夹中删除文件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <param name="Type">【0:库文件】【1:配置文件】</param>
+        private void Watcher_Deleted(object sender, FileSystemEventArgs e, int Type)
+        {
+            if (WatcherToken == null && WatcherQueue == null)
+            {
+                WatcherQueue = new ConcurrentQueue<WatcherData>();
+                WatcherToken = new CancellationTokenSource();
+                WatcherTask();
             }
+
+            WatcherQueue.Enqueue(new WatcherData { e = e, Type = Type, WType = WatcherData.WatcherType.Deleted });
         }
 
         /// <summary>
@@ -334,80 +482,29 @@ namespace YSAI.RelayManage
         /// <param name="Type">【0:库文件】【1:配置文件】</param>
         private void Watcher_Created(object sender, FileSystemEventArgs e, int Type)
         {
-            switch (Type)
+            if (WatcherToken == null && WatcherQueue == null)
             {
-                case 0:
-                    SearchType(e.FullPath);
-                    break;
-                case 1:
-                    OnEventHandler(this, new EventResult(true, $"{e.Name} 文件新增,新增对应配置实例"));
-                    #region 新增对应配置实例
-                    int until = 5;
-                    int i = 0;
-                    bool success = false;
-                    while (!success && i < until)
-                    {
-                        try
-                        {
-                            string path = String.Format(e.FullPath);
-                            string? filename = Path.GetFileName(path);
-                            using (Stream fs = File.OpenRead(@path))
-                            {
-                                StreamReader srdPreview = new StreamReader(fs);
-                                String temp = string.Empty;
-                                while (srdPreview.Peek() > -1)
-                                {
-                                    String input = srdPreview.ReadLine();
-                                    temp += input;
-                                }
-                                srdPreview.Close();
-                                srdPreview.Dispose();
-
-                                //实例的ISn
-                                string InstanceIocSN = e.Name.Replace(basics.ConfigReplaceFormat, string.Empty);
-                                //程序集ISn
-                                string TypeIocSN = InstanceIocSN.Replace($".{InstanceIocSN.Split('.')[InstanceIocSN.Split('.').Length - 1]}", string.Empty);
-                                //判断是否存在此程序集ISn
-                                if (TypeIoc.ContainsKey(TypeIocSN))
-                                {
-                                    if (!InstanceIoc.ContainsKey(InstanceIocSN))
-                                    {
-                                        ConfigCreateInstance(TypeIoc[TypeIocSN], temp);
-                                    }
-                                    else
-                                    {
-                                        OnEventHandler(this, new EventResult(false, $" {e.Name} 此配置实例已存在"));
-                                    }
-                                }
-                                else
-                                {
-                                    OnEventHandler(this, new EventResult(false, $" {e.Name} 新增对应配置创建实例失败 {TypeIocSN} 程序集不存在"));
-                                }
-                                fs.Close();
-                                fs.Dispose();
-                            }
-                            success = true;
-                        }
-                        catch
-                        {
-                            i++;
-                            Thread.Sleep(TimeSpan.FromSeconds(1));
-                        }
-                    }
-                    #endregion
-                    break;
+                WatcherQueue = new ConcurrentQueue<WatcherData>();
+                WatcherToken = new CancellationTokenSource();
+                WatcherTask();
             }
+
+            WatcherQueue.Enqueue(new WatcherData { e = e, Type = Type, WType = WatcherData.WatcherType.Created });
         }
 
         /// <summary>
         /// 检索文件并创建实例
         /// </summary>
-        private void Search()
+        private void Search(string? path = null)
         {
             try
             {
+                if (string.IsNullOrWhiteSpace(path))
+                {
+                    path = basics.LibFolder;
+                }
                 //库
-                List<string> libs = Directory.GetFiles(basics.LibFolder, "YSAI.*.dll", SearchOption.AllDirectories).ToList();
+                List<string> libs = Directory.GetFiles(path, basics.DllWatcherFormat, SearchOption.AllDirectories).ToList();
                 //循环文件,添加程序集
                 foreach (var lib in libs)
                 {

+ 1 - 1
src/YSAI.DAQ/YSAI.RelayManage/YSAI.RelayManage.csproj

@@ -9,7 +9,7 @@
 	<ItemGroup>
 		<PackageReference Include="RabbitMQ.Client" Version="6.5.0" />
 		<PackageReference Include="Confluent.Kafka" Version="2.2.0" />
-		<PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+		<PackageReference Include="YSAI.Core" Version="1.0.0.26" />
 		<FrameworkReference Include="Microsoft.AspNetCore.App" />
 	</ItemGroup>
 

+ 2 - 2
src/YSAI.DAQ/YSAI.S7/YSAI.S7.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.6</Version>
+	  <Version>1.0.0.7</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>
@@ -13,7 +13,7 @@
   </PropertyGroup>
 
 	<ItemGroup>
-    <PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+    <PackageReference Include="YSAI.Core" Version="1.0.0.26" />
   </ItemGroup>
 
 	<!--<ItemGroup>

+ 1 - 1
src/YSAI.DAQ/YSAI.Test/YSAI.Test.csproj

@@ -17,7 +17,7 @@
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
-	<PackageReference Include="YSAI.Core" Version="1.0.0.25" />
+	<PackageReference Include="YSAI.Core" Version="1.0.0.26" />
   </ItemGroup>
 
   <ItemGroup>