| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -25,6 +25,10 @@ using Prism.Events;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					using ImTools;
 | 
					 | 
					 | 
					 | 
					using ImTools;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					using static System.Windows.Forms.Design.AxImporter;
 | 
					 | 
					 | 
					 | 
					using static System.Windows.Forms.Design.AxImporter;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					using HandyControl.Controls;
 | 
					 | 
					 | 
					 | 
					using HandyControl.Controls;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					using MQTTnet.Extensions.ManagedClient;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					using MQTTnet;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					using MQTTnet.Client.Options;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					using System.Windows.Markup;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					namespace Txgy.FilesWatcher.ViewModels
 | 
					 | 
					 | 
					 | 
					namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{
 | 
					 | 
					 | 
					 | 
					{
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -118,15 +122,39 @@ namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            get { return isUploadMQTT; }
 | 
					 | 
					 | 
					 | 
					            get { return isUploadMQTT; }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            set { SetProperty(ref isUploadMQTT, value); }
 | 
					 | 
					 | 
					 | 
					            set { SetProperty(ref isUploadMQTT, value); }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private ObservableCollection<WatcherFileModel> dataList = new ObservableCollection<WatcherFileModel>();
 | 
					 | 
					 | 
					 | 
					        private ObservableCollection<FileModel> dataList = new ObservableCollection<FileModel>();
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        public ObservableCollection<WatcherFileModel> DataList
 | 
					 | 
					 | 
					 | 
					        public ObservableCollection<FileModel> DataList
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            get { return dataList; }
 | 
					 | 
					 | 
					 | 
					            get { return dataList; }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            set { SetProperty(ref dataList, value); }
 | 
					 | 
					 | 
					 | 
					            set { SetProperty(ref dataList, value); }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private ObservableCollection<FileModel> realTimeDataList = new ObservableCollection<FileModel>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        public ObservableCollection<FileModel> RealTimeDataList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            get { return realTimeDataList; }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            set { SetProperty(ref realTimeDataList, value); }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private ObservableCollection<FileModel> postDataList = new ObservableCollection<FileModel>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        public ObservableCollection<FileModel> PostDataList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            get { return postDataList; }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            set { SetProperty(ref postDataList, value); }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private ObservableCollection<FileModel> mqttDataList = new ObservableCollection<FileModel>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        public ObservableCollection<FileModel> MQTTDataList
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            get { return mqttDataList; }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            set { SetProperty(ref mqttDataList, value); }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private DateTime startTime;
 | 
					 | 
					 | 
					 | 
					        private DateTime startTime;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        public DateTime StartTime { get => startTime; set => SetProperty(ref startTime, value); }
 | 
					 | 
					 | 
					 | 
					        public DateTime StartTime { get => startTime; set => SetProperty(ref startTime, value); }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private string runTime;
 | 
					 | 
					 | 
					 | 
					        private string runTime;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -230,37 +258,42 @@ namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            else if (para == "MseedPath")
 | 
					 | 
					 | 
					 | 
					            else if (para == "MseedPath")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					                //替换主目录;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                var name = Path.GetDirectoryName(filePath); 
 | 
					 | 
					 | 
					 | 
					                var name = filePath.Replace(MainPath+"\\", "");
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                string path = Path.Combine(MainPath, name);
 | 
					 | 
					 | 
					 | 
					                string path = Path.Combine(MainPath, name);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (!Directory.Exists(path))
 | 
					 | 
					 | 
					 | 
					                if (!Directory.Exists(path))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                {
 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    MessageBox.Show($"{path} 不存在!");
 | 
					 | 
					 | 
					 | 
					                    MessageBox.Show($"{path} 不存在!");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    return;
 | 
					 | 
					 | 
					 | 
					                    return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                MseedPath = name;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _systemConfig.mseedpath = name;
 | 
					 | 
					 | 
					 | 
					                _systemConfig.mseedpath = name;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            else if (para == "RealtimePath")
 | 
					 | 
					 | 
					 | 
					            else if (para == "RealtimePath")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                string path = Path.Combine(MainPath, RealtimePath);
 | 
					 | 
					 | 
					 | 
					                var name = filePath.Replace(MainPath + "\\", "");
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                string path = Path.Combine(MainPath, name);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (!Directory.Exists(path))
 | 
					 | 
					 | 
					 | 
					                if (!Directory.Exists(path))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                {
 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    MessageBox.Show($"{path} 不存在!");
 | 
					 | 
					 | 
					 | 
					                    MessageBox.Show($"{path} 不存在!");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    return;
 | 
					 | 
					 | 
					 | 
					                    return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                watcherArray[0].Path = Path.Combine(MainPath, RealtimePath);
 | 
					 | 
					 | 
					 | 
					                RealtimePath=name;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _systemConfig.realtimepath = RealtimePath;
 | 
					 | 
					 | 
					 | 
					                _systemConfig.realtimepath = RealtimePath;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                watcherArray[0].Path = path;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            else if (para == "PostPath")
 | 
					 | 
					 | 
					 | 
					            else if (para == "PostPath")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                string path = Path.Combine(MainPath, PostPath);
 | 
					 | 
					 | 
					 | 
					                var name = filePath.Replace(MainPath + "\\", "");
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                string path = Path.Combine(MainPath, name);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (!Directory.Exists(path))
 | 
					 | 
					 | 
					 | 
					                if (!Directory.Exists(path))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                {
 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    MessageBox.Show($"{path} 不存在!");
 | 
					 | 
					 | 
					 | 
					                    MessageBox.Show($"{path} 不存在!");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    return;
 | 
					 | 
					 | 
					 | 
					                    return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                watcherArray[1].Path = Path.Combine(MainPath, PostPath);
 | 
					 | 
					 | 
					 | 
					                PostPath=name;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _systemConfig.postpath = PostPath;
 | 
					 | 
					 | 
					 | 
					                _systemConfig.postpath = PostPath;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                watcherArray[1].Path = path;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            UpdateJsonConfig(_systemConfig);
 | 
					 | 
					 | 
					 | 
					            UpdateJsonConfig(_systemConfig);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -306,8 +339,36 @@ namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                watcher.EnableRaisingEvents = false;
 | 
					 | 
					 | 
					 | 
					                watcher.EnableRaisingEvents = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                watcher.EndInit();
 | 
					 | 
					 | 
					 | 
					                watcher.EndInit();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //初始化mqtt
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            mqttClient = new MqttFactory().CreateManagedMqttClient();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            mqttClient.UseDisconnectedHandler(ee =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                Debug.WriteLine($">>> 服务器断开连接,{ee}");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            mqttClient.UseApplicationMessageReceivedHandler(ee =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                try
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                //    ResolveDatas(ee.ApplicationMessage.Topic, ee.ApplicationMessage.Payload);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                catch (Exception ex)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    MessageBox.Show($">>>数据解析出错,{ex}");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            mqttClient.UseConnectedHandler(ee =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                Debug.WriteLine(">>> MQTT 连接到服务!");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //    mqttClient.SubscribeAsync(CmdData.STREMACTRL + "#", MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					             //   mqttClient.SubscribeAsync(CmdData.STREMARES + "#", MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					              //  Debug.WriteLine($">>>订阅:{CmdData.STREMARES} #");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                //   mqttClient.SubscribeAsync(CmdData.STREMAUP + "vpn45", MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                //   WriteLog($">>>成功订阅:{CmdData.STREMAUP} #");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					             //   mqttClient.SubscribeAsync(CmdData.STREMAROUTERRES + "#", MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					         
 | 
					 | 
					 | 
					 | 
					         
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private void UpdateJsonConfig(SystemConfig systemConfig)
 | 
					 | 
					 | 
					 | 
					        private void UpdateJsonConfig(SystemConfig systemConfig)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -335,7 +396,17 @@ namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Debug.WriteLine($"**********当前时间:{currentT},监控路径:{path}");
 | 
					 | 
					 | 
					 | 
					            Debug.WriteLine($"**********当前时间:{currentT},监控路径:{path}");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (Directory.Exists(path) && IsUploadDB&& IsUploadMseedPath)
 | 
					 | 
					 | 
					 | 
					            if (Directory.Exists(path) && IsUploadDB&& IsUploadMseedPath)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                UploadMseedFile.UploadMSeedOnce(path, WorkAreaId);
 | 
					 | 
					 | 
					 | 
					                UploadMseedFile.UploadMSeedOnce((a=>
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    timer1.Dispatcher.Invoke(() =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        DataList.Add(new FileModel
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            CreateTime = DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss"),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            Data = $"{DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss")}{a}"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }), path, WorkAreaId);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        /// <summary>
 | 
					 | 
					 | 
					 | 
					        /// <summary>
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -364,7 +435,6 @@ namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return result;
 | 
					 | 
					 | 
					 | 
					            return result;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private string DateDiff(DateTime DateTime1, DateTime DateTime2)
 | 
					 | 
					 | 
					 | 
					        private string DateDiff(DateTime DateTime1, DateTime DateTime2)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            string dateDiff = null;
 | 
					 | 
					 | 
					 | 
					            string dateDiff = null;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -402,32 +472,64 @@ namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Debug.WriteLine($"最后修改时间:{lastWriteTime},文件路径:{watch.Path}");
 | 
					 | 
					 | 
					 | 
					            Debug.WriteLine($"最后修改时间:{lastWriteTime},文件路径:{watch.Path}");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (watch != null && watch.Path == watcherArray[0].Path)
 | 
					 | 
					 | 
					 | 
					            if (watch != null && watch.Path == watcherArray[0].Path)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                watcherArray[0].EnableRaisingEvents = false;
 | 
					 | 
					 | 
					 | 
					                watcherArray[0].EnableRaisingEvents = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (IsUploadDB && isUploadRealtimePath)
 | 
					 | 
					 | 
					 | 
					                if (IsUploadDB && isUploadRealtimePath)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    UploadRealtimeFile.UploadRealtimeFileOnce(watcherArray[0].Path, lastLine, IsUploadMQTT, WorkAreaId);
 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    UploadRealtimeFile.UploadRealtimeFileOnce((a, b) =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        timer1.Dispatcher.Invoke(() =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            RealTimeDataList.Add(new FileModel
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                CreateTime = DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss"),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                Data = $"{DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss")}事件上传成功。"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        if (IsUploadMQTT)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            MQPublish(a, b);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            timer1.Dispatcher.Invoke(() =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                MQTTDataList.Add(new FileModel
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                    CreateTime = DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss"),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                    Data = $"{DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss")}事件上传成功。"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }, watcherArray[0].Path, lastLine, WorkAreaId);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            else if (watch != null && watch.Path == watcherArray[1].Path)
 | 
					 | 
					 | 
					 | 
					            else if (watch != null && watch.Path == watcherArray[1].Path)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                watcherArray[1].EnableRaisingEvents = false;
 | 
					 | 
					 | 
					 | 
					                watcherArray[1].EnableRaisingEvents = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (IsUploadDB && IsUploadPostPath)
 | 
					 | 
					 | 
					 | 
					                if (IsUploadDB && IsUploadPostPath)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    UploadPostproFile.UploadPostproFileOnce(watcherArray[1].Path, lastLine, WorkAreaId);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            var str=  dataList.Where(f => f.Data == lastLine).FirstOrDefault();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (!string.IsNullOrWhiteSpace(lastLine)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                && str==null)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                {
 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
 | 
					 | 
					 | 
					 | 
					                    UploadPostproFile.UploadPostproFileOnce((a, b) =>
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    {
 | 
					 | 
					 | 
					 | 
					                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    DataList.Add(new WatcherFileModel
 | 
					 | 
					 | 
					 | 
					                        timer1.Dispatcher.Invoke(() =>
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        {
 | 
					 | 
					 | 
					 | 
					                        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        CreateTime = DateTime.Now.ToString(),
 | 
					 | 
					 | 
					 | 
					                            PostDataList.Add(new FileModel
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ChangeType = e.ChangeType,
 | 
					 | 
					 | 
					 | 
					                            {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        Name = e.Name,
 | 
					 | 
					 | 
					 | 
					                                CreateTime = DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss"),
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        FullPath = e.FullPath,
 | 
					 | 
					 | 
					 | 
					                                Data = $"{DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss")}事件上传成功。"
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        Data = lastLine,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        IsSend = false
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            });
 | 
					 | 
					 | 
					 | 
					                            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }));
 | 
					 | 
					 | 
					 | 
					                        });
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        if (IsUploadMQTT)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            MQPublish(a, b);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            timer1.Dispatcher.Invoke(() =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                MQTTDataList.Add(new FileModel
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                    CreateTime = DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss"),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                    Data = $"{DateTime.Now.ToString("yyyy-MM-dd T HH:mm:ss")}事件上传成功。"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }, watcherArray[1].Path, lastLine, WorkAreaId);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (watch != null && watch.Path == watcherArray[0].Path)
 | 
					 | 
					 | 
					 | 
					            if (watch != null && watch.Path == watcherArray[0].Path)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -438,7 +540,6 @@ namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                watcherArray[1].EnableRaisingEvents = true;
 | 
					 | 
					 | 
					 | 
					                watcherArray[1].EnableRaisingEvents = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private void Watcher_Renamed(object sender, RenamedEventArgs e)
 | 
					 | 
					 | 
					 | 
					        private void Watcher_Renamed(object sender, RenamedEventArgs e)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => {
 | 
					 | 
					 | 
					 | 
					            System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -491,9 +592,52 @@ namespace Txgy.FilesWatcher.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //});
 | 
					 | 
					 | 
					 | 
					            //});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private void StartConnectMQ()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 向服务端开放的端口进行服务请求
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //    string clientID = Guid.NewGuid().ToString();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            var mqttClientOptions = new MqttClientOptionsBuilder()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                             .WithClientId(_systemConfig.mQTTConfig.clientID)// 传入ClientID参数
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                             .WithTcpServer(_systemConfig.mQTTConfig.serverIP, _systemConfig.mQTTConfig.port)//指定TCP连接的IP和Port
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                             .WithCredentials(_systemConfig.mQTTConfig.userName, _systemConfig.mQTTConfig.password);//指定连接的用户名和密码
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            var options = new ManagedMqttClientOptionsBuilder()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        .WithAutoReconnectDelay(TimeSpan.FromSeconds(60))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        .WithClientOptions(mqttClientOptions.Build())
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        .Build();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            mqttClient.StartAsync(options);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            startTime = DateTime.Now;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private void StopMQ()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            mqttClient?.StopAsync();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private void MQPublish(string topic, string openCmd)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					         //   byte[] cmdByte = Convert.FromHexString(openCmd.Replace(" ", ""));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            MqttApplicationMessage message = new MqttApplicationMessageBuilder()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                .WithTopic(topic)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                .WithPayload(openCmd)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                .WithRetainFlag(false)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                .Build();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            var res = mqttClient.PublishAsync(message);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            string mes = string.Empty;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!res.IsFaulted)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                mes = $">>>数据发送成功:{topic},{openCmd}";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            else
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                mes = $">>>数据发送失败:{topic},{openCmd}";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            Debug.WriteLine(mes);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private FileSystemWatcher[] watcherArray = new FileSystemWatcher[2];
 | 
					 | 
					 | 
					 | 
					        private FileSystemWatcher[] watcherArray = new FileSystemWatcher[2];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private DispatcherTimer timer1 = new DispatcherTimer();
 | 
					 | 
					 | 
					 | 
					        private DispatcherTimer timer1 = new DispatcherTimer();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private readonly SystemConfig _systemConfig;
 | 
					 | 
					 | 
					 | 
					        private readonly SystemConfig _systemConfig;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private IManagedMqttClient mqttClient;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //  private readonly WebsocketClient _websocketClient;
 | 
					 | 
					 | 
					 | 
					        //  private readonly WebsocketClient _websocketClient;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private readonly IEventAggregator _ea;
 | 
					 | 
					 | 
					 | 
					        private readonly IEventAggregator _ea;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |