Browse Source

WorkerMessage->LocalMessage

ntminer 6 years ago
parent
commit
83bcaba740
39 changed files with 203 additions and 203 deletions
  1. 2 2
      src/AppModels/AppModels.csproj
  2. 2 2
      src/AppModels/AppStatic.cs
  3. 3 3
      src/AppModels/Vms/KernelProfileViewModel.cs
  4. 16 16
      src/AppModels/Vms/LocalMessageViewModel.cs
  5. 36 36
      src/AppModels/Vms/LocalMessagesViewModel.cs
  6. 3 3
      src/AppModels/Vms/StartStopMineButtonViewModel.cs
  7. 4 4
      src/AppViews0/AppViews0.csproj
  8. 2 0
      src/AppViews0/Design/LocalMessagesViewModel.xaml
  9. 0 2
      src/AppViews0/Design/WorkerMessagesViewModel.xaml
  10. 2 2
      src/AppViews0/MainWindow.xaml
  11. 2 2
      src/AppViews0/MainWindow.xaml.cs
  12. 2 2
      src/AppViews0/MinerClientsWindow.xaml
  13. 4 4
      src/AppViews0/Ucs/LocalMessages.xaml
  14. 4 4
      src/AppViews0/Ucs/LocalMessages.xaml.cs
  15. 1 1
      src/AppViews0/Ucs/MainMenu.xaml
  16. 7 7
      src/MinerClient/App.xaml.cs
  17. 4 4
      src/MinerClient/Windows/WindowsUtil.cs
  18. 5 5
      src/MinerClientSelfHost/MinerClientController.cs
  19. 1 1
      src/MinerStudio/NTMinerServices/NTMinerServicesUtil.cs
  20. 1 1
      src/MinerStudioSelfHost/MinerStudioController.cs
  21. 11 11
      src/NTMiner/NTMinerRoot.cs
  22. 2 2
      src/NTMiner/NTMinerRoot.partials.MinerProcess.cs
  23. 3 3
      src/NTMiner/SpecialPath.cs
  24. 1 1
      src/NTMinerDataObjects/MinerClient/ILocalMessage.cs
  25. 1 1
      src/NTMinerDataObjects/MinerClient/LocalMessageChannel.cs
  26. 2 2
      src/NTMinerDataObjects/MinerClient/LocalMessageData.cs
  27. 1 1
      src/NTMinerDataObjects/MinerClient/LocalMessageType.cs
  28. 4 4
      src/NTMinerDataObjects/NTMinerDataObjects.csproj
  29. 1 1
      src/NTMinerWpf/Views/NotiCenterWindow.xaml.cs
  30. 4 4
      src/NTMinerlib/Ip/Impl/LocalIpSet.cs
  31. 2 2
      src/NTMinerlib/LocalMessage/ILocalMessageSet.cs
  32. 15 15
      src/NTMinerlib/LocalMessage/LocalMessageSet.cs
  33. 8 8
      src/NTMinerlib/Messages.cs
  34. 2 2
      src/NTMinerlib/NTKeyword.cs
  35. 2 2
      src/NTMinerlib/NTMinerlib.csproj
  36. 22 22
      src/NTMinerlib/VirtualRoot.cs
  37. 20 0
      src/UnitTests/LocalMessageTests.cs
  38. 1 1
      src/UnitTests/UnitTests.csproj
  39. 0 20
      src/UnitTests/WorkerMessageTests.cs

+ 2 - 2
src/AppModels/AppModels.csproj

@@ -119,7 +119,7 @@
     <Compile Include="Vms\RemoteDesktopLoginViewModel.cs" />
     <Compile Include="Vms\ServerMessageViewModel.cs" />
     <Compile Include="Vms\ServerMessagesViewModel.cs" />
-    <Compile Include="Vms\WorkerMessagesViewModel.cs" />
+    <Compile Include="Vms\LocalMessagesViewModel.cs" />
     <Compile Include="Vms\FragmentWriterPageViewModel.cs" />
     <Compile Include="Vms\FragmentWriterSelectViewModel.cs" />
     <Compile Include="Vms\FileWriterSelectViewModel.cs" />
@@ -204,7 +204,7 @@
     <Compile Include="Vms\VirtualMemoryViewModel.cs" />
     <Compile Include="Vms\WalletSelectViewModel.cs" />
     <Compile Include="Vms\WalletViewModel.cs" />
-    <Compile Include="Vms\WorkerMessageViewModel.cs" />
+    <Compile Include="Vms\LocalMessageViewModel.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\NTMinerBus\NTMinerBus.csproj">

+ 2 - 2
src/AppModels/AppStatic.cs

@@ -66,7 +66,7 @@ namespace NTMiner {
                                         callback?.Invoke();
                                     }
                                     else {
-                                        VirtualRoot.ThisWorkerError(nameof(AppStatic), message, toConsole: true);
+                                        VirtualRoot.ThisLocalError(nameof(AppStatic), message, toConsole: true);
                                         callback?.Invoke();
                                     }
                                 }
@@ -536,7 +536,7 @@ namespace NTMiner {
         }
         #endregion
 
-        public static ICommand ShowServerWorkerMessages { get; private set; } = new DelegateCommand(() => {
+        public static ICommand ShowServerMessages { get; private set; } = new DelegateCommand(() => {
 
         });
 

+ 3 - 3
src/AppModels/Vms/KernelProfileViewModel.cs

@@ -200,7 +200,7 @@ namespace NTMiner.Vms {
                     UIThread.Execute(() => {
                         bool isSuccess = !e.Cancelled && e.Error == null;
                         if (isSuccess) {
-                            VirtualRoot.ThisWorkerInfo(nameof(KernelProfileViewModel), package + "下载成功", toConsole: true);
+                            VirtualRoot.ThisLocalInfo(nameof(KernelProfileViewModel), package + "下载成功", toConsole: true);
                         }
                         string message = "下载成功";
                         if (e.Error != null) {
@@ -219,10 +219,10 @@ namespace NTMiner.Vms {
                     if (string.IsNullOrEmpty(packageUrl)) {
                         string msg = $"未获取到{package}内核包下载地址";
                         downloadComplete?.Invoke(false, msg, saveFileFullName);
-                        VirtualRoot.ThisWorkerError(nameof(KernelProfileViewModel), msg, toConsole: true);
+                        VirtualRoot.ThisLocalError(nameof(KernelProfileViewModel), msg, toConsole: true);
                     }
                     else {
-                        VirtualRoot.ThisWorkerInfo(nameof(KernelProfileViewModel), "下载:" + package, toConsole: true);
+                        VirtualRoot.ThisLocalInfo(nameof(KernelProfileViewModel), "下载:" + package, toConsole: true);
                         webClient.DownloadFileAsync(new Uri(packageUrl), saveFileFullName);
                     }
                 });

+ 16 - 16
src/AppModels/Vms/WorkerMessageViewModel.cs → src/AppModels/Vms/LocalMessageViewModel.cs

@@ -4,54 +4,54 @@ using System.Windows;
 using System.Windows.Media;
 
 namespace NTMiner.Vms {
-    public class WorkerMessageViewModel : ViewModelBase, IWorkerMessage {
+    public class LocalMessageViewModel : ViewModelBase, ILocalMessage {
         private static readonly StreamGeometry ErrorIcon = (StreamGeometry)Application.Current.Resources["Icon_Error"];
         private static readonly StreamGeometry WarnIcon = (StreamGeometry)Application.Current.Resources["Icon_Warn"];
         private static readonly StreamGeometry InfoIcon = (StreamGeometry)Application.Current.Resources["Icon_Info"];
         private static readonly SolidColorBrush InfoColor = (SolidColorBrush)Application.Current.Resources["InfoColor"];
         private static readonly SolidColorBrush WarnColor = (SolidColorBrush)Application.Current.Resources["WarnColor"];
 
-        public static StreamGeometry GetIcon(WorkerMessageType messageType) {
+        public static StreamGeometry GetIcon(LocalMessageType messageType) {
             switch (messageType) {
-                case WorkerMessageType.Info:
+                case LocalMessageType.Info:
                     return InfoIcon;
-                case WorkerMessageType.Warn:
+                case LocalMessageType.Warn:
                     return WarnIcon;
-                case WorkerMessageType.Error:
+                case LocalMessageType.Error:
                     return ErrorIcon;
                 default:
                     return null;
             }
         }
 
-        public static SolidColorBrush GetIconFill(WorkerMessageType messageType) {
+        public static SolidColorBrush GetIconFill(LocalMessageType messageType) {
             switch (messageType) {
-                case WorkerMessageType.Info:
+                case LocalMessageType.Info:
                     return InfoColor;
-                case WorkerMessageType.Warn:
+                case LocalMessageType.Warn:
                     return WarnColor;
-                case WorkerMessageType.Error:
+                case LocalMessageType.Error:
                     return WpfUtil.RedBrush;
                 default:
                     return WpfUtil.BlackBrush;
             }
         }
 
-        private readonly IWorkerMessage _data;
-        private readonly WorkerMessageChannel _channel;
-        private readonly WorkerMessageType _messageTypeEnum;
+        private readonly ILocalMessage _data;
+        private readonly LocalMessageChannel _channel;
+        private readonly LocalMessageType _messageTypeEnum;
 
-        public WorkerMessageViewModel(IWorkerMessage data) {
+        public LocalMessageViewModel(ILocalMessage data) {
             _data = data;
             data.MessageType.TryParse(out _messageTypeEnum);
             data.Channel.TryParse(out _channel);
         }
 
-        public WorkerMessageChannel ChannelEnum {
+        public LocalMessageChannel ChannelEnum {
             get { return _channel; }
         }
 
-        public WorkerMessageType MessageTypeEnum {
+        public LocalMessageType MessageTypeEnum {
             get { return _messageTypeEnum; }
         }
 
@@ -79,7 +79,7 @@ namespace NTMiner.Vms {
 
         public string ChannelText {
             get {
-                if (_channel != WorkerMessageChannel.Unspecified) {
+                if (_channel != LocalMessageChannel.Unspecified) {
                     return _channel.GetDescription();
                 }
                 return "未知";

+ 36 - 36
src/AppModels/Vms/WorkerMessagesViewModel.cs → src/AppModels/Vms/LocalMessagesViewModel.cs

@@ -5,15 +5,15 @@
     using System.Linq;
     using System.Windows.Input;
 
-    public class WorkerMessagesViewModel : ViewModelBase {
-        private ObservableCollection<WorkerMessageViewModel> _workerMessageVms;
-        private ObservableCollection<WorkerMessageViewModel> _queyResults;
-        private EnumItem<WorkerMessageChannel> _selectedChannel;
+    public class LocalMessagesViewModel : ViewModelBase {
+        private ObservableCollection<LocalMessageViewModel> _localMessageVms;
+        private ObservableCollection<LocalMessageViewModel> _queyResults;
+        private EnumItem<LocalMessageChannel> _selectedChannel;
         private string _keyword;
-        private readonly Dictionary<EnumItem<WorkerMessageChannel>, Dictionary<WorkerMessageType, MessageTypeItem<WorkerMessageType>>> _count = new Dictionary<EnumItem<WorkerMessageChannel>, Dictionary<WorkerMessageType, MessageTypeItem<WorkerMessageType>>>();
+        private readonly Dictionary<EnumItem<LocalMessageChannel>, Dictionary<LocalMessageType, MessageTypeItem<LocalMessageType>>> _count = new Dictionary<EnumItem<LocalMessageChannel>, Dictionary<LocalMessageType, MessageTypeItem<LocalMessageType>>>();
 
         private void UpdateChannelAll() {
-            var channelAll = WorkerMessageChannel.Unspecified.GetEnumItem();
+            var channelAll = LocalMessageChannel.Unspecified.GetEnumItem();
             if (!_count.ContainsKey(channelAll)) {
                 return;
             }
@@ -24,23 +24,23 @@
         }
 
 
-        public IEnumerable<EnumItem<WorkerMessageChannel>> WorkerMessageChannelEnumItems {
+        public IEnumerable<EnumItem<LocalMessageChannel>> LocalMessageChannelEnumItems {
             get {
                 // 只有挖矿端有This和Kernel两个频道
                 if (VirtualRoot.IsMinerClient) {
-                    foreach (var item in EnumItem<WorkerMessageChannel>.GetEnumItems()) {
+                    foreach (var item in EnumItem<LocalMessageChannel>.GetEnumItems()) {
                         yield return item;
                     }
                 }
                 else {
-                    yield return WorkerMessageChannel.This.GetEnumItem();
+                    yield return LocalMessageChannel.This.GetEnumItem();
                 }
             }
         }
 
-        public IEnumerable<MessageTypeItem<WorkerMessageType>> MessageTypeItems {
+        public IEnumerable<MessageTypeItem<LocalMessageType>> MessageTypeItems {
             get {
-                Dictionary<WorkerMessageType, MessageTypeItem<WorkerMessageType>> values = _count[SelectedChannel];
+                Dictionary<LocalMessageType, MessageTypeItem<LocalMessageType>> values = _count[SelectedChannel];
                 return values.Values;
             }
         }
@@ -48,23 +48,23 @@
         public ICommand ClearKeyword { get; private set; }
         public ICommand Clear { get; private set; }
 
-        public WorkerMessagesViewModel() {
+        public LocalMessagesViewModel() {
             if (WpfUtil.IsInDesignMode) {
                 return;
             }
-            foreach (var messageChannel in WorkerMessageChannelEnumItems) {
-                var values = new Dictionary<WorkerMessageType, MessageTypeItem<WorkerMessageType>>();
-                foreach (var messageType in EnumItem<WorkerMessageType>.GetEnumItems()) {
-                    values.Add(messageType.Value, new MessageTypeItem<WorkerMessageType>(messageType, WorkerMessageViewModel.GetIcon, WorkerMessageViewModel.GetIconFill, RefreshQueryResults));
+            foreach (var messageChannel in LocalMessageChannelEnumItems) {
+                var values = new Dictionary<LocalMessageType, MessageTypeItem<LocalMessageType>>();
+                foreach (var messageType in EnumItem<LocalMessageType>.GetEnumItems()) {
+                    values.Add(messageType.Value, new MessageTypeItem<LocalMessageType>(messageType, LocalMessageViewModel.GetIcon, LocalMessageViewModel.GetIconFill, RefreshQueryResults));
                 }
                 _count.Add(messageChannel, values);
             }
-            var data = VirtualRoot.WorkerMessages.Select(a => new WorkerMessageViewModel(a));
-            _workerMessageVms = new ObservableCollection<WorkerMessageViewModel>(data);
-            foreach (var item in _workerMessageVms) {
+            var data = VirtualRoot.LocalMessages.Select(a => new LocalMessageViewModel(a));
+            _localMessageVms = new ObservableCollection<LocalMessageViewModel>(data);
+            foreach (var item in _localMessageVms) {
                 _count[item.ChannelEnum.GetEnumItem()][item.MessageTypeEnum].Count++;
             }
-            _selectedChannel = WorkerMessageChannelEnumItems.FirstOrDefault();
+            _selectedChannel = LocalMessageChannelEnumItems.FirstOrDefault();
             RefreshQueryResults();
             UpdateChannelAll();
 
@@ -73,13 +73,13 @@
             });
             this.Clear = new DelegateCommand(() => {
                 this.ShowDialog(new DialogWindowViewModel(message: "确定清空吗?", title: "确认", onYes: () => {
-                    VirtualRoot.WorkerMessages.Clear();
+                    VirtualRoot.LocalMessages.Clear();
                 }));
             });
-            VirtualRoot.BuildEventPath<WorkerMessageClearedEvent>("清空挖矿消息集后刷新VM内存", LogEnum.DevConsole,
+            VirtualRoot.BuildEventPath<LocalMessageClearedEvent>("清空挖矿消息集后刷新VM内存", LogEnum.DevConsole,
                 action: message => {
                     UIThread.Execute(() => {
-                        _workerMessageVms = new ObservableCollection<WorkerMessageViewModel>();
+                        _localMessageVms = new ObservableCollection<LocalMessageViewModel>();
                         foreach (var item in _count.Values) {
                             foreach (var key in item.Keys) {
                                 item[key].Count = 0;
@@ -88,15 +88,15 @@
                         RefreshQueryResults();
                     });
                 });
-            VirtualRoot.BuildEventPath<WorkerMessageAddedEvent>("发生了挖矿事件后刷新Vm内存", LogEnum.DevConsole,
+            VirtualRoot.BuildEventPath<LocalMessageAddedEvent>("发生了挖矿事件后刷新Vm内存", LogEnum.DevConsole,
                 action: message => {
                     UIThread.Execute(() => {
-                        var vm = new WorkerMessageViewModel(message.Source);
-                        _workerMessageVms.Insert(0, vm);
+                        var vm = new LocalMessageViewModel(message.Source);
+                        _localMessageVms.Insert(0, vm);
                         foreach (var item in message.Removes) {
-                            var toRemove = _workerMessageVms.FirstOrDefault(a => a.Id == item.Id);
+                            var toRemove = _localMessageVms.FirstOrDefault(a => a.Id == item.Id);
                             if (toRemove != null) {
-                                _workerMessageVms.Remove(toRemove);
+                                _localMessageVms.Remove(toRemove);
                             }
                         }
                         int removedCount = message.Removes.Count(a => a.MessageType == vm.MessageTypeEnum.GetName());
@@ -107,7 +107,7 @@
                             OnPropertyChanged($"Is{vm.MessageTypeEnum.GetName()}CountVisible");
                         }
 
-                        if (_queyResults != _workerMessageVms) {
+                        if (_queyResults != _localMessageVms) {
                             #region 更新QueryResults
                             bool isSelectedChannel = SelectedChannel.Value == vm.ChannelEnum;
                             bool isMessageTypeChecked = false;
@@ -135,7 +135,7 @@
             }
         }
 
-        public EnumItem<WorkerMessageChannel> SelectedChannel {
+        public EnumItem<LocalMessageChannel> SelectedChannel {
             get => _selectedChannel;
             set {
                 if (_selectedChannel != value) {
@@ -147,7 +147,7 @@
             }
         }
 
-        public ObservableCollection<WorkerMessageViewModel> QueryResults {
+        public ObservableCollection<LocalMessageViewModel> QueryResults {
             get {
                 return _queyResults;
             }
@@ -155,13 +155,13 @@
 
         private void RefreshQueryResults() {
             bool isCheckedAllMessageType = _count[SelectedChannel].Values.All(a => a.IsChecked);
-            if (SelectedChannel.Value == WorkerMessageChannel.Unspecified && isCheckedAllMessageType && string.IsNullOrEmpty(Keyword)) {
-                _queyResults = _workerMessageVms;
+            if (SelectedChannel.Value == LocalMessageChannel.Unspecified && isCheckedAllMessageType && string.IsNullOrEmpty(Keyword)) {
+                _queyResults = _localMessageVms;
                 OnPropertyChanged(nameof(QueryResults));
                 return;
             }
-            var query = _workerMessageVms.AsQueryable();
-            if (SelectedChannel.Value != WorkerMessageChannel.Unspecified) {
+            var query = _localMessageVms.AsQueryable();
+            if (SelectedChannel.Value != LocalMessageChannel.Unspecified) {
                 query = query.Where(a => a.Channel == SelectedChannel.Value.GetName());
             }
             if (!isCheckedAllMessageType) {
@@ -170,7 +170,7 @@
             if (!string.IsNullOrEmpty(Keyword)) {
                 query = query.Where(a => a.Content != null && a.Content.Contains(Keyword));
             }
-            _queyResults = new ObservableCollection<WorkerMessageViewModel>(query);
+            _queyResults = new ObservableCollection<LocalMessageViewModel>(query);
             OnPropertyChanged(nameof(QueryResults));
         }
     }

+ 3 - 3
src/AppModels/Vms/StartStopMineButtonViewModel.cs

@@ -16,13 +16,13 @@ namespace NTMiner.Vms {
                 Write.Stopwatch.Restart();
 #endif
             this.StartMine = new DelegateCommand(() => {
-                VirtualRoot.ThisWorkerInfo(nameof(StartStopMineButtonViewModel), $"手动开始挖矿", toConsole: true);
+                VirtualRoot.ThisLocalInfo(nameof(StartStopMineButtonViewModel), $"手动开始挖矿", toConsole: true);
                 this.MinerProfile.IsMining = true;
                 NTMinerRoot.Instance.StartMine();
                 BtnStopText = "正在挖矿";
             });
             this.StopMine = new DelegateCommand(() => {
-                VirtualRoot.ThisWorkerInfo(nameof(StartStopMineButtonViewModel), $"手动停止挖矿", toConsole: true);
+                VirtualRoot.ThisLocalInfo(nameof(StartStopMineButtonViewModel), $"手动停止挖矿", toConsole: true);
                 if (!NTMinerRoot.Instance.IsMining) {
                     this.MinerProfile.IsMining = false;
                 }
@@ -58,7 +58,7 @@ namespace NTMiner.Vms {
                         if (!NTMinerRoot.IsAutoStartCanceled) {
                             BtnStopText = "正在挖矿";
                             MinerProfile.IsMining = true;
-                            VirtualRoot.ThisWorkerInfo(nameof(StartStopMineButtonViewModel), $"自动开始挖矿", toConsole: true);
+                            VirtualRoot.ThisLocalInfo(nameof(StartStopMineButtonViewModel), $"自动开始挖矿", toConsole: true);
                             NTMinerRoot.Instance.StartMine();
                         }
                     }

+ 4 - 4
src/AppViews0/AppViews0.csproj

@@ -152,8 +152,8 @@
     <Compile Include="Ucs\ServerMessages.xaml.cs">
       <DependentUpon>ServerMessages.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Ucs\WorkerMessages.xaml.cs">
-      <DependentUpon>WorkerMessages.xaml</DependentUpon>
+    <Compile Include="Ucs\LocalMessages.xaml.cs">
+      <DependentUpon>LocalMessages.xaml</DependentUpon>
     </Compile>
     <Compile Include="Ucs\SysDicItemSelect.xaml.cs">
       <DependentUpon>SysDicItemSelect.xaml</DependentUpon>
@@ -362,7 +362,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="Design\WorkerMessagesViewModel.xaml">
+    <Page Include="Design\LocalMessagesViewModel.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
@@ -558,7 +558,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="Ucs\WorkerMessages.xaml">
+    <Page Include="Ucs\LocalMessages.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>

+ 2 - 0
src/AppViews0/Design/LocalMessagesViewModel.xaml

@@ -0,0 +1,2 @@
+<vm:LocalMessagesViewModel xmlns:vm="clr-namespace:NTMiner.Vms;assembly=AppModels">
+</vm:LocalMessagesViewModel>

+ 0 - 2
src/AppViews0/Design/WorkerMessagesViewModel.xaml

@@ -1,2 +0,0 @@
-<vm:WorkerMessagesViewModel xmlns:vm="clr-namespace:NTMiner.Vms;assembly=AppModels">
-</vm:WorkerMessagesViewModel>

+ 2 - 2
src/AppViews0/MainWindow.xaml

@@ -580,8 +580,8 @@
                                         <RowDefinition Height="3*"></RowDefinition>
                                         <RowDefinition Height="2*"></RowDefinition>
                                     </Grid.RowDefinitions>
-                                    <uc:WorkerMessages>
-                                    </uc:WorkerMessages>
+                                    <uc:LocalMessages>
+                                    </uc:LocalMessages>
                                     <GridSplitter Grid.Row="0" Height="6" BorderThickness="0 1 0 1" BorderBrush="{StaticResource LineColor}" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"></GridSplitter>
                                     <uc:ServerMessages Grid.Row="1"></uc:ServerMessages>
                                 </Grid>

+ 2 - 2
src/AppViews0/MainWindow.xaml.cs

@@ -352,7 +352,7 @@ namespace NTMiner.Views {
                         if (Vm.MinerProfile.HighTemperatureCount >= Vm.MinerProfile.CpuGETemperatureSeconds) {
                             Vm.MinerProfile.HighTemperatureCount = 0;
                             NTMinerRoot.Instance.StopMineAsync(StopMineReason.HighCpuTemperature);
-                            VirtualRoot.ThisWorkerInfo(nameof(MainWindow), $"自动停止挖矿,因为 CPU 温度连续{Vm.MinerProfile.CpuGETemperatureSeconds}秒不低于{Vm.MinerProfile.CpuStopTemperature}℃", toConsole: true);
+                            VirtualRoot.ThisLocalInfo(nameof(MainWindow), $"自动停止挖矿,因为 CPU 温度连续{Vm.MinerProfile.CpuGETemperatureSeconds}秒不低于{Vm.MinerProfile.CpuStopTemperature}℃", toConsole: true);
                         }
                     }
                     else {
@@ -366,7 +366,7 @@ namespace NTMiner.Views {
                             }
                             if (Vm.MinerProfile.LowTemperatureCount >= Vm.MinerProfile.CpuLETemperatureSeconds) {
                                 Vm.MinerProfile.LowTemperatureCount = 0;
-                                VirtualRoot.ThisWorkerInfo(nameof(MainWindow), $"自动开始挖矿,因为 CPU 温度连续{Vm.MinerProfile.CpuLETemperatureSeconds}秒不高于{Vm.MinerProfile.CpuStartTemperature}℃", toConsole: true);
+                                VirtualRoot.ThisLocalInfo(nameof(MainWindow), $"自动开始挖矿,因为 CPU 温度连续{Vm.MinerProfile.CpuLETemperatureSeconds}秒不高于{Vm.MinerProfile.CpuStartTemperature}℃", toConsole: true);
                                 NTMinerRoot.Instance.StartMine();
                             }
                         }

+ 2 - 2
src/AppViews0/MinerClientsWindow.xaml

@@ -2553,8 +2553,8 @@
                             <RowDefinition Height="3*"></RowDefinition>
                             <RowDefinition Height="2*"></RowDefinition>
                         </Grid.RowDefinitions>
-                        <uc:WorkerMessages>
-                        </uc:WorkerMessages>
+                        <uc:LocalMessages>
+                        </uc:LocalMessages>
                         <GridSplitter Grid.Row="0" Height="6" BorderThickness="0 1 0 1" BorderBrush="{StaticResource LineColor}" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"></GridSplitter>
                         <uc:ServerMessages Grid.Row="1"></uc:ServerMessages>
                     </Grid>

+ 4 - 4
src/AppViews0/Ucs/WorkerMessages.xaml → src/AppViews0/Ucs/LocalMessages.xaml

@@ -1,4 +1,4 @@
-<UserControl x:Class="NTMiner.Views.Ucs.WorkerMessages"
+<UserControl x:Class="NTMiner.Views.Ucs.LocalMessages"
 			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
@@ -13,10 +13,10 @@
              x:Name="Uc"
 			 Background="White"
 			 TextOptions.TextFormattingMode="Display" 
-             d:DataContext="{d:DesignData Source=/Design/WorkerMessagesViewModel.xaml}"
+             d:DataContext="{d:DesignData Source=/Design/LocalMessagesViewModel.xaml}"
 			 d:DesignHeight="450" d:DesignWidth="1200">
     <UserControl.DataContext>
-        <vm:WorkerMessagesViewModel></vm:WorkerMessagesViewModel>
+        <vm:LocalMessagesViewModel></vm:LocalMessagesViewModel>
     </UserControl.DataContext>
     <Grid>
         <Grid.RowDefinitions>
@@ -32,7 +32,7 @@
                 <ListBox 
                     Margin="0 0 10 0"
 			        Background="Transparent"
-			        ItemsSource="{Binding WorkerMessageChannelEnumItems}"
+			        ItemsSource="{Binding LocalMessageChannelEnumItems}"
 			        SelectedItem="{Binding SelectedChannel}"
 			        MouseDown="ListBox_MouseDown"
 			        ItemContainerStyle="{StaticResource ListBoxBarItem}"

+ 4 - 4
src/AppViews0/Ucs/WorkerMessages.xaml.cs → src/AppViews0/Ucs/LocalMessages.xaml.cs

@@ -4,14 +4,14 @@ using System.Windows.Controls;
 using System.Windows.Input;
 
 namespace NTMiner.Views.Ucs {
-    public partial class WorkerMessages : UserControl {
-        private WorkerMessagesViewModel Vm {
+    public partial class LocalMessages : UserControl {
+        private LocalMessagesViewModel Vm {
             get {
-                return (WorkerMessagesViewModel)this.DataContext;
+                return (LocalMessagesViewModel)this.DataContext;
             }
         }
 
-        public WorkerMessages() {
+        public LocalMessages() {
             InitializeComponent();
         }
 

+ 1 - 1
src/AppViews0/Ucs/MainMenu.xaml

@@ -402,7 +402,7 @@
 							Stretch="Fill" />
 					</MenuItem.Icon>
                 </MenuItem>
-                <MenuItem Header="消息" Command="{x:Static app:AppStatic.ShowServerWorkerMessages}">
+                <MenuItem Header="消息" Command="{x:Static app:AppStatic.ShowServerMessages}">
                     <MenuItem.Icon>
                         <Path
 							Width="16"

+ 7 - 7
src/MinerClient/App.xaml.cs

@@ -91,13 +91,13 @@ namespace NTMiner {
                     NTMinerRoot.Instance.Init(() => {
                         _appViewFactory.Link();
                         if (VirtualRoot.IsLTWin10) {
-                            VirtualRoot.ThisWorkerWarn(nameof(App), AppStatic.LowWinMessage, toConsole: true);
+                            VirtualRoot.ThisLocalWarn(nameof(App), AppStatic.LowWinMessage, toConsole: true);
                         }
                         if (NTMinerRoot.Instance.GpuSet.Count == 0) {
-                            VirtualRoot.ThisWorkerError(nameof(App), "没有矿卡或矿卡未驱动。", toConsole: true);
+                            VirtualRoot.ThisLocalError(nameof(App), "没有矿卡或矿卡未驱动。", toConsole: true);
                         }
                         if (NTMinerRoot.Instance.CoinSet.Count == 0) {
-                            VirtualRoot.ThisWorkerError(nameof(App), "访问阿里云失败,请尝试更换本机dns解决此问题。", toConsole: true);
+                            VirtualRoot.ThisLocalError(nameof(App), "访问阿里云失败,请尝试更换本机dns解决此问题。", toConsole: true);
                         }
                         UIThread.Execute(() => {
                             if (NTMinerRoot.Instance.MinerProfile.IsNoUi && NTMinerRoot.Instance.MinerProfile.IsAutoStart) {
@@ -263,10 +263,10 @@ namespace NTMiner {
             SwitchRadeonGpu.SwitchRadeonGpu.Run(on, (isSuccess, e) => {
                 if (isSuccess) {
                     if (on) {
-                        VirtualRoot.ThisWorkerInfo(nameof(App), "开启A卡计算模式成功", OutEnum.Success);
+                        VirtualRoot.ThisLocalInfo(nameof(App), "开启A卡计算模式成功", OutEnum.Success);
                     }
                     else {
-                        VirtualRoot.ThisWorkerInfo(nameof(App), "关闭A卡计算模式成功", OutEnum.Success);
+                        VirtualRoot.ThisLocalInfo(nameof(App), "关闭A卡计算模式成功", OutEnum.Success);
                     }
                 }
                 else if (e != null) {
@@ -274,10 +274,10 @@ namespace NTMiner {
                 }
                 else {
                     if (on) {
-                        VirtualRoot.ThisWorkerError(nameof(App), "开启A卡计算模式失败", OutEnum.Warn);
+                        VirtualRoot.ThisLocalError(nameof(App), "开启A卡计算模式失败", OutEnum.Warn);
                     }
                     else {
-                        VirtualRoot.ThisWorkerError(nameof(App), "关闭A卡计算模式失败", OutEnum.Warn);
+                        VirtualRoot.ThisLocalError(nameof(App), "关闭A卡计算模式失败", OutEnum.Warn);
                     }
                 }
             });

+ 4 - 4
src/MinerClient/Windows/WindowsUtil.cs

@@ -18,11 +18,11 @@ namespace NTMiner.Windows {
                     string fileFullName = Path.Combine(MainAssemblyInfo.TempDirFullName, name);
                     assembly.ExtractManifestResource(type, name, fileFullName);
                     Cmd.RunClose(fileFullName, string.Empty, waitForExit: true);
-                    VirtualRoot.ThisWorkerInfo(nameof(WindowsUtil), "禁用windows系统更新成功", OutEnum.Success);
+                    VirtualRoot.ThisLocalInfo(nameof(WindowsUtil), "禁用windows系统更新成功", OutEnum.Success);
                 });
             }
             catch (Exception e) {
-                VirtualRoot.ThisWorkerError(nameof(WindowsUtil), "禁用windows系统更新失败", OutEnum.Warn);
+                VirtualRoot.ThisLocalError(nameof(WindowsUtil), "禁用windows系统更新失败", OutEnum.Warn);
                 Logger.ErrorDebugLine(e);
             }
         }
@@ -36,12 +36,12 @@ namespace NTMiner.Windows {
                     string fileFullName = Path.Combine(MainAssemblyInfo.TempDirFullName, name);
                     assembly.ExtractManifestResource(type, name, fileFullName);
                     Cmd.RunClose("regedit", $"/s \"{fileFullName}\"", waitForExit: true);
-                    VirtualRoot.ThisWorkerInfo(nameof(WindowsUtil), "优化Windows成功", OutEnum.Success);
+                    VirtualRoot.ThisLocalInfo(nameof(WindowsUtil), "优化Windows成功", OutEnum.Success);
                 });
             }
             catch (Exception e) {
                 Logger.ErrorDebugLine(e);
-                VirtualRoot.ThisWorkerError(nameof(WindowsUtil), "优化Windows失败", OutEnum.Warn);
+                VirtualRoot.ThisLocalError(nameof(WindowsUtil), "优化Windows失败", OutEnum.Warn);
             }
         }
     }

+ 5 - 5
src/MinerClientSelfHost/MinerClientController.cs

@@ -27,7 +27,7 @@ namespace NTMiner {
                 return ResponseBase.InvalidInput("参数错误");
             }
             try {
-                VirtualRoot.ThisWorkerInfo(nameof(MinerClientController), $"退出挖矿端");
+                VirtualRoot.ThisLocalInfo(nameof(MinerClientController), $"退出挖矿端");
                 TimeSpan.FromMilliseconds(100).Delay().ContinueWith((t) => {
                     VirtualRoot.Execute(new CloseNTMinerCommand());
                 });
@@ -45,7 +45,7 @@ namespace NTMiner {
                 return ResponseBase.InvalidInput("参数错误");
             }
             try {
-                VirtualRoot.ThisWorkerInfo(nameof(MinerClientController), $"开始挖矿", toConsole: true);
+                VirtualRoot.ThisLocalInfo(nameof(MinerClientController), $"开始挖矿", toConsole: true);
                 NTMinerRoot.Instance.RestartMine(isWork: request.WorkId != Guid.Empty);
                 return ResponseBase.Ok();
             }
@@ -61,7 +61,7 @@ namespace NTMiner {
                 return ResponseBase.InvalidInput("参数错误");
             }
             try {
-                VirtualRoot.ThisWorkerInfo(nameof(MinerClientController), $"停止挖矿", toConsole: true);
+                VirtualRoot.ThisLocalInfo(nameof(MinerClientController), $"停止挖矿", toConsole: true);
                 NTMinerRoot.Instance.StopMineAsync(StopMineReason.RPCUserAction);
                 return ResponseBase.Ok();
             }
@@ -77,7 +77,7 @@ namespace NTMiner {
                 return ResponseBase.InvalidInput("参数错误");
             }
             try {
-                VirtualRoot.ThisWorkerInfo(nameof(MinerClientController), $"设置挖矿参数");
+                VirtualRoot.ThisLocalInfo(nameof(MinerClientController), $"设置挖矿参数");
                 NTMinerRoot.Instance.MinerProfile.SetMinerProfileProperty(request.PropertyName, request.Value);
                 return ResponseBase.Ok();
             }
@@ -106,7 +106,7 @@ namespace NTMiner {
 
         [HttpPost]
         public void OverClock() {
-            VirtualRoot.ThisWorkerInfo(nameof(MinerClientController), $"刷新超频", toConsole: true);
+            VirtualRoot.ThisLocalInfo(nameof(MinerClientController), $"刷新超频", toConsole: true);
             NTMinerRoot.Instance.GpuProfileSet.Refresh();
         }
     }

+ 1 - 1
src/MinerStudio/NTMinerServices/NTMinerServicesUtil.cs

@@ -33,7 +33,7 @@ namespace NTMiner.NTMinerServices {
                     }
                     catch (Exception e) {
                         Logger.ErrorDebugLine(e);
-                        VirtualRoot.ThisWorkerError(nameof(NTMinerServicesUtil), "启动失败,请重试,如果问题一直持续请联系开发者解决问题", toConsole: true);
+                        VirtualRoot.ThisLocalError(nameof(NTMinerServicesUtil), "启动失败,请重试,如果问题一直持续请联系开发者解决问题", toConsole: true);
                     }
                 });
             }

+ 1 - 1
src/MinerStudioSelfHost/MinerStudioController.cs

@@ -25,7 +25,7 @@ namespace NTMiner {
                 return ResponseBase.InvalidInput("参数错误");
             }
             try {
-                VirtualRoot.ThisWorkerInfo(nameof(MinerStudioController), $"退出群控端");
+                VirtualRoot.ThisLocalInfo(nameof(MinerStudioController), $"退出群控端");
                 TimeSpan.FromMilliseconds(100).Delay().ContinueWith(t => {
                     VirtualRoot.Execute(new CloseNTMinerCommand());
                 });

+ 11 - 11
src/NTMiner/NTMinerRoot.cs

@@ -105,10 +105,10 @@ namespace NTMiner {
                             }
                             else {
                                 if (!File.Exists(SpecialPath.ServerJsonFileFullName)) {
-                                    VirtualRoot.ThisWorkerError(nameof(NTMinerRoot), "配置文件下载失败,这是第一次运行开源矿工,配置文件至少需要成功下载一次,请检查网络是否可用", OutEnum.Warn);
+                                    VirtualRoot.ThisLocalError(nameof(NTMinerRoot), "配置文件下载失败,这是第一次运行开源矿工,配置文件至少需要成功下载一次,请检查网络是否可用", OutEnum.Warn);
                                 }
                                 else {
-                                    VirtualRoot.ThisWorkerWarn(nameof(NTMinerRoot), "配置文件下载失败,使用最后一次成功下载的配置文件", OutEnum.Warn);
+                                    VirtualRoot.ThisLocalWarn(nameof(NTMinerRoot), "配置文件下载失败,使用最后一次成功下载的配置文件", OutEnum.Warn);
                                 }
                             }
                             DoInit(isWork, callback);
@@ -121,7 +121,7 @@ namespace NTMiner {
                         #endregion
                     }
                 }
-                VirtualRoot.ThisWorkerInfo(nameof(NTMinerRoot), "启动");
+                VirtualRoot.ThisLocalInfo(nameof(NTMinerRoot), "启动");
             });
         }
 
@@ -149,7 +149,7 @@ namespace NTMiner {
                         ReInitServerJson();
                         // 作业模式下界面是禁用的,所以这里的初始化isWork必然是false
                         ContextReInit(isWork: VirtualRoot.IsMinerStudio);
-                        VirtualRoot.ThisWorkerInfo(nameof(NTMinerRoot), $"刷新server.json配置", toConsole: true);
+                        VirtualRoot.ThisLocalInfo(nameof(NTMinerRoot), $"刷新server.json配置", toConsole: true);
                     });
                 }
                 else {
@@ -329,11 +329,11 @@ namespace NTMiner {
         private void Link() {
             VirtualRoot.BuildCmdPath<RegCmdHereCommand>(action: message => {
                 try {
-                    RegCmdHere(); VirtualRoot.ThisWorkerInfo(nameof(NTMinerRoot), "windows右键命令行添加成功", OutEnum.Success);
+                    RegCmdHere(); VirtualRoot.ThisLocalInfo(nameof(NTMinerRoot), "windows右键命令行添加成功", OutEnum.Success);
                 }
                 catch (Exception e) {
                     Logger.ErrorDebugLine(e);
-                    RegCmdHere(); VirtualRoot.ThisWorkerError(nameof(NTMinerRoot), "windows右键命令行添加失败", OutEnum.Warn);
+                    RegCmdHere(); VirtualRoot.ThisLocalError(nameof(NTMinerRoot), "windows右键命令行添加失败", OutEnum.Warn);
                 }
             });
             VirtualRoot.BuildEventPath<Per1MinuteEvent>("每1分钟阻止系统休眠", LogEnum.None,
@@ -498,7 +498,7 @@ namespace NTMiner {
             if (_currentMineContext != null) {
                 StopMine(StopMineReason.ApplicationExit);
             }
-            VirtualRoot.ThisWorkerInfo(nameof(NTMinerRoot), "退出");
+            VirtualRoot.ThisLocalInfo(nameof(NTMinerRoot), "退出");
         }
         #endregion
 
@@ -528,7 +528,7 @@ namespace NTMiner {
                 }
                 var mineContext = _currentMineContext;
                 _currentMineContext = null;
-                VirtualRoot.ThisWorkerInfo(nameof(NTMinerRoot), "挖矿停止", toConsole: true);
+                VirtualRoot.ThisLocalInfo(nameof(NTMinerRoot), "挖矿停止", toConsole: true);
                 VirtualRoot.RaiseEvent(new MineStopedEvent(mineContext, stopReason));
             }
             catch (Exception e) {
@@ -639,7 +639,7 @@ namespace NTMiner {
                 }
                 string packageZipFileFullName = Path.Combine(SpecialPath.PackagesDirFullName, kernel.Package);
                 if (!File.Exists(packageZipFileFullName)) {
-                    VirtualRoot.ThisWorkerInfo(nameof(NTMinerRoot), kernel.GetFullName() + "本地内核包不存在,开始自动下载", toConsole: true);
+                    VirtualRoot.ThisLocalInfo(nameof(NTMinerRoot), kernel.GetFullName() + "本地内核包不存在,开始自动下载", toConsole: true);
                     VirtualRoot.Execute(new ShowKernelDownloaderCommand(kernel.GetId(), downloadComplete: (isSuccess, message) => {
                         if (isSuccess) {
                             StartMine(isRestart);
@@ -671,9 +671,9 @@ namespace NTMiner {
                     }
                     _currentMineContext = mineContext;
                     MinerProcess.CreateProcessAsync(mineContext);
-                    VirtualRoot.ThisWorkerInfo(nameof(NTMinerRoot), "开始挖矿", toConsole: true);
+                    VirtualRoot.ThisLocalInfo(nameof(NTMinerRoot), "开始挖矿", toConsole: true);
                     if (mineContext.UseDevices.Length != GpuSet.Count) {
-                        VirtualRoot.ThisWorkerWarn(nameof(NTMinerRoot), "未启用全部显卡挖矿", toConsole: true);
+                        VirtualRoot.ThisLocalWarn(nameof(NTMinerRoot), "未启用全部显卡挖矿", toConsole: true);
                     }
                 }
             }

+ 2 - 2
src/NTMiner/NTMinerRoot.partials.MinerProcess.cs

@@ -138,9 +138,9 @@ namespace NTMiner {
                                 Process[] processes = Process.GetProcessesByName(processName);
                                 if (processes.Length == 0) {
                                     mineContext.AutoRestartKernelCount += 1;
-                                    VirtualRoot.ThisWorkerWarn(nameof(NTMinerRoot), processName + $"挖矿内核进程消失", toConsole: true);
+                                    VirtualRoot.ThisLocalWarn(nameof(NTMinerRoot), processName + $"挖矿内核进程消失", toConsole: true);
                                     if (Instance.MinerProfile.IsAutoRestartKernel && mineContext.AutoRestartKernelCount <= Instance.MinerProfile.AutoRestartKernelTimes) {
-                                        VirtualRoot.ThisWorkerInfo(nameof(NTMinerRoot), $"尝试第{mineContext.AutoRestartKernelCount}次重启,共{Instance.MinerProfile.AutoRestartKernelTimes}次", toConsole: true);
+                                        VirtualRoot.ThisLocalInfo(nameof(NTMinerRoot), $"尝试第{mineContext.AutoRestartKernelCount}次重启,共{Instance.MinerProfile.AutoRestartKernelTimes}次", toConsole: true);
                                         Instance.RestartMine();
                                         Instance.CurrentMineContext.AutoRestartKernelCount = mineContext.AutoRestartKernelCount;
                                     }

+ 3 - 3
src/NTMiner/SpecialPath.cs

@@ -51,9 +51,9 @@ namespace NTMiner {
                     if (File.Exists(shareGpuProfilesJsonFileFullName) && !File.Exists(GpuProfilesJsonFileFullName)) {
                         File.Copy(shareGpuProfilesJsonFileFullName, GpuProfilesJsonFileFullName);
                     }
-                    string shareWorkerMessageDbFileFullName = Path.Combine(MainAssemblyInfo.TempDirFullName, NTKeyword.WorkerMessageDbFileName);
-                    if (File.Exists(shareWorkerMessageDbFileFullName) && !File.Exists(VirtualRoot.WorkerMessageDbFileFullName)) {
-                        File.Copy(shareWorkerMessageDbFileFullName, VirtualRoot.WorkerMessageDbFileFullName);
+                    string shareLocalMessageDbFileFullName = Path.Combine(MainAssemblyInfo.TempDirFullName, NTKeyword.LocalMessageDbFileName);
+                    if (File.Exists(shareLocalMessageDbFileFullName) && !File.Exists(VirtualRoot.LocalMessageDbFileFullName)) {
+                        File.Copy(shareLocalMessageDbFileFullName, VirtualRoot.LocalMessageDbFileFullName);
                     }
                     string shareUpdaterFileFullName = Path.Combine(MainAssemblyInfo.TempDirFullName, NTKeyword.UpdaterDirName, NTKeyword.NTMinerUpdaterFileName);
                     if (File.Exists(shareUpdaterFileFullName) && !File.Exists(UpdaterFileFullName)) {

+ 1 - 1
src/NTMinerDataObjects/MinerClient/IWorkerMessage.cs → src/NTMinerDataObjects/MinerClient/ILocalMessage.cs

@@ -1,7 +1,7 @@
 using System;
 
 namespace NTMiner.MinerClient {
-    public interface IWorkerMessage : IEntity<Guid> {
+    public interface ILocalMessage : IEntity<Guid> {
         Guid Id { get; }
         /// <summary>
         /// 频道是平的,主题是分层的。开源矿工的挖矿事件没有主题需求。

+ 1 - 1
src/NTMinerDataObjects/MinerClient/WorkerMessageChannel.cs → src/NTMinerDataObjects/MinerClient/LocalMessageChannel.cs

@@ -5,7 +5,7 @@ namespace NTMiner.MinerClient {
     /// 频道是平的,主题是分层的。开源矿工的挖矿事件没有主题需求。
     /// </summary>
     /// <remarks>持久层存的是枚举名</remarks>
-    public enum WorkerMessageChannel {
+    public enum LocalMessageChannel {
         [Description("全频道")]
         Unspecified,
         /// <summary>

+ 2 - 2
src/NTMinerDataObjects/MinerClient/WorkerMessageData.cs → src/NTMinerDataObjects/MinerClient/LocalMessageData.cs

@@ -1,8 +1,8 @@
 using System;
 
 namespace NTMiner.MinerClient {
-    public class WorkerMessageData : IWorkerMessage, IDbEntity<Guid> {
-        public WorkerMessageData() { }
+    public class LocalMessageData : ILocalMessage, IDbEntity<Guid> {
+        public LocalMessageData() { }
 
         public Guid GetId() {
             return this.Id;

+ 1 - 1
src/NTMinerDataObjects/MinerClient/WorkerMessageType.cs → src/NTMinerDataObjects/MinerClient/LocalMessageType.cs

@@ -2,7 +2,7 @@
 
 namespace NTMiner.MinerClient {
     /// <remarks>持久层存的是枚举名</remarks>
-    public enum WorkerMessageType {
+    public enum LocalMessageType {
         [Description("消息")]
         Info,
         [Description("警告")]

+ 4 - 4
src/NTMinerDataObjects/NTMinerDataObjects.csproj

@@ -88,15 +88,15 @@
     <Compile Include="MinerServer\KernelOutputKeywordsRequest.cs" />
     <Compile Include="MinerServer\NTMinerWalletData.cs" />
     <Compile Include="MinerServer\NTMinerWalletsRequest.cs" />
-    <Compile Include="MinerClient\WorkerMessageChannel.cs" />
+    <Compile Include="MinerClient\LocalMessageChannel.cs" />
     <Compile Include="MinerServer\ServerMessageData.cs" />
     <Compile Include="MinerServer\ServerMessagesRequest.cs" />
     <Compile Include="MinerServer\ServerMessageType.cs" />
     <Compile Include="Profile\GpuProfileExtension.cs" />
     <Compile Include="Core\IKernelOutputKeyword.cs" />
-    <Compile Include="MinerClient\IWorkerMessage.cs" />
+    <Compile Include="MinerClient\ILocalMessage.cs" />
     <Compile Include="Core\KernelOutputKeywordData.cs" />
-    <Compile Include="MinerClient\WorkerMessageData.cs" />
+    <Compile Include="MinerClient\LocalMessageData.cs" />
     <Compile Include="MinerClient\GpuData.cs" />
     <Compile Include="MinerClient\IGpuStaticData.cs" />
     <Compile Include="MinerServer\AddClientRequest.cs" />
@@ -185,7 +185,7 @@
     <Compile Include="MinerServer\UpdateClientRequest.cs" />
     <Compile Include="UserData.cs" />
     <Compile Include="Core\WalletData.cs" />
-    <Compile Include="MinerClient\WorkerMessageType.cs" />
+    <Compile Include="MinerClient\LocalMessageType.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="packages.config" />

+ 1 - 1
src/NTMinerWpf/Views/NotiCenterWindow.xaml.cs

@@ -57,7 +57,7 @@ namespace NTMiner.Views {
                         return false;
                     }
                     else {
-                        VirtualRoot.ThisWorkerInfo(nameof(NotiCenterWindow), $"热键Ctrl + Alt + {key.ToString()} 设置成功", OutEnum.Success);
+                        VirtualRoot.ThisLocalInfo(nameof(NotiCenterWindow), $"热键Ctrl + Alt + {key.ToString()} 设置成功", OutEnum.Success);
                         return true;
                     }
                 };

+ 4 - 4
src/NTMinerlib/Ip/Impl/LocalIpSet.cs

@@ -14,12 +14,12 @@ namespace NTMiner.Ip.Impl {
                 Refresh();
                 var localIps = _localIps;
                 if (old.Count != localIps.Count) {
-                    VirtualRoot.ThisWorkerWarn(nameof(LocalIpSet), "网络接口的 IP 地址发生了更改", toConsole: true);
+                    VirtualRoot.ThisLocalWarn(nameof(LocalIpSet), "网络接口的 IP 地址发生了更改", toConsole: true);
                 }
                 else {
                     for (int i = 0; i < old.Count; i++) {
                         if (old[i] != localIps[i]) {
-                            VirtualRoot.ThisWorkerWarn(nameof(LocalIpSet), "网络接口的 IP 地址发生了更改", toConsole: true);
+                            VirtualRoot.ThisLocalWarn(nameof(LocalIpSet), "网络接口的 IP 地址发生了更改", toConsole: true);
                             break;
                         }
                     }
@@ -27,10 +27,10 @@ namespace NTMiner.Ip.Impl {
             };
             NetworkChange.NetworkAvailabilityChanged += (object sender, NetworkAvailabilityEventArgs e) => {
                 if (e.IsAvailable) {
-                    VirtualRoot.ThisWorkerInfo(nameof(LocalIpSet), $"网络可用", toConsole: true);
+                    VirtualRoot.ThisLocalInfo(nameof(LocalIpSet), $"网络可用", toConsole: true);
                 }
                 else {
-                    VirtualRoot.ThisWorkerWarn(nameof(LocalIpSet), $"网络不可用", toConsole: true);
+                    VirtualRoot.ThisLocalWarn(nameof(LocalIpSet), $"网络不可用", toConsole: true);
                 }
             };
         }

+ 2 - 2
src/NTMinerlib/WorkerMessage/IWorkerMessageSet.cs → src/NTMinerlib/LocalMessage/ILocalMessageSet.cs

@@ -1,8 +1,8 @@
 using NTMiner.MinerClient;
 using System.Collections.Generic;
 
-namespace NTMiner.WorkerMessage {
-    public interface IWorkerMessageSet : IEnumerable<IWorkerMessage> {
+namespace NTMiner.LocalMessage {
+    public interface ILocalMessageSet : IEnumerable<ILocalMessage> {
         int Count { get; }
         void Add(string channel, string provider, string messageType, string content);
         void Clear();

+ 15 - 15
src/NTMinerlib/WorkerMessage/WorkerMessageSet.cs → src/NTMinerlib/LocalMessage/LocalMessageSet.cs

@@ -5,12 +5,12 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 
-namespace NTMiner.WorkerMessage {
-    public class WorkerMessageSet : IWorkerMessageSet {
+namespace NTMiner.LocalMessage {
+    public class LocalMessageSet : ILocalMessageSet {
         private readonly string _connectionString;
-        private readonly LinkedList<IWorkerMessage> _records = new LinkedList<IWorkerMessage>();
+        private readonly LinkedList<ILocalMessage> _records = new LinkedList<ILocalMessage>();
 
-        public WorkerMessageSet(string dbFileFullName) {
+        public LocalMessageSet(string dbFileFullName) {
             if (!string.IsNullOrEmpty(dbFileFullName)) {
                 _connectionString = $"filename={dbFileFullName};journal=false";
             }
@@ -28,7 +28,7 @@ namespace NTMiner.WorkerMessage {
                 return;
             }
             InitOnece();
-            var data = new WorkerMessageData {
+            var data = new LocalMessageData {
                 Id = Guid.NewGuid(),
                 Channel = channel,
                 Provider = provider,
@@ -37,24 +37,24 @@ namespace NTMiner.WorkerMessage {
                 Timestamp = DateTime.Now
             };
             // TODO:批量持久化,异步持久化
-            List<IWorkerMessage> removes = new List<IWorkerMessage>();
+            List<ILocalMessage> removes = new List<ILocalMessage>();
             lock (_locker) {
                 _records.AddFirst(data);
-                while (_records.Count > NTKeyword.WorkerMessageSetCapacity) {
+                while (_records.Count > NTKeyword.LocalMessageSetCapacity) {
                     var toRemove = _records.Last;
                     removes.Add(toRemove.Value);
                     _records.RemoveLast();
                     using (LiteDatabase db = new LiteDatabase(_connectionString)) {
-                        var col = db.GetCollection<WorkerMessageData>();
+                        var col = db.GetCollection<LocalMessageData>();
                         col.Delete(toRemove.Value.Id);
                     }
                 }
             }
             using (LiteDatabase db = new LiteDatabase(_connectionString)) {
-                var col = db.GetCollection<WorkerMessageData>();
+                var col = db.GetCollection<LocalMessageData>();
                 col.Insert(data);
             }
-            VirtualRoot.RaiseEvent(new WorkerMessageAddedEvent(data, removes));
+            VirtualRoot.RaiseEvent(new LocalMessageAddedEvent(data, removes));
         }
 
         public void Clear() {
@@ -65,9 +65,9 @@ namespace NTMiner.WorkerMessage {
                 lock (_locker) {
                     _records.Clear();
                 }
-                db.DropCollection(nameof(WorkerMessageData));
+                db.DropCollection(nameof(LocalMessageData));
             }
-            VirtualRoot.RaiseEvent(new WorkerMessageClearedEvent());
+            VirtualRoot.RaiseEvent(new LocalMessageClearedEvent());
         }
 
         private bool _isInited = false;
@@ -87,9 +87,9 @@ namespace NTMiner.WorkerMessage {
                         return;
                     }
                     using (LiteDatabase db = new LiteDatabase(_connectionString)) {
-                        var col = db.GetCollection<WorkerMessageData>();
+                        var col = db.GetCollection<LocalMessageData>();
                         foreach (var item in col.FindAll().OrderBy(a => a.Timestamp)) {
-                            if (_records.Count < NTKeyword.WorkerMessageSetCapacity) {
+                            if (_records.Count < NTKeyword.LocalMessageSetCapacity) {
                                 _records.AddFirst(item);
                             }
                             else {
@@ -102,7 +102,7 @@ namespace NTMiner.WorkerMessage {
             }
         }
 
-        public IEnumerator<IWorkerMessage> GetEnumerator() {
+        public IEnumerator<ILocalMessage> GetEnumerator() {
             InitOnece();
             return _records.GetEnumerator();
         }

+ 8 - 8
src/NTMinerlib/Messages.cs

@@ -138,18 +138,18 @@ namespace NTMiner {
     }
     #endregion
 
-    [MessageType(description: "记录了矿机事件后")]
-    public class WorkerMessageAddedEvent : DomainEvent<IWorkerMessage> {
-        public WorkerMessageAddedEvent(IWorkerMessage source, List<IWorkerMessage> removes) : base(source) {
-            this.Removes = removes ?? new List<IWorkerMessage>();
+    [MessageType(description: "记录了本地事件后")]
+    public class LocalMessageAddedEvent : DomainEvent<ILocalMessage> {
+        public LocalMessageAddedEvent(ILocalMessage source, List<ILocalMessage> removes) : base(source) {
+            this.Removes = removes ?? new List<ILocalMessage>();
         }
 
-        public List<IWorkerMessage> Removes { get; private set; }
+        public List<ILocalMessage> Removes { get; private set; }
     }
 
-    [MessageType(description: "挖矿消息集清空后")]
-    public class WorkerMessageClearedEvent : EventBase {
-        public WorkerMessageClearedEvent() { }
+    [MessageType(description: "本地消息集清空后")]
+    public class LocalMessageClearedEvent : EventBase {
+        public LocalMessageClearedEvent() { }
     }
 
     [MessageType(description: "记录了服务器事件后")]

+ 2 - 2
src/NTMinerlib/NTKeyword.cs

@@ -12,7 +12,7 @@
             OfficialServerHost = host;
         }
 
-        public const string WorkerMessageDbFileName = "localMessage.litedb";
+        public const string LocalMessageDbFileName = "localMessage.litedb";
         public const string NTMinerUpdaterFileName = "NTMinerUpdater.exe";
         public const string NTMinerServicesFileName = "NTMinerServices.exe";
         public const string GpuProfilesFileName = "gpuProfiles.json";
@@ -31,7 +31,7 @@
         public const string AutoStartCmdParameterName = "--AutoStart";
         public const string UpgradeCmdParameterName = "upgrade=";
 
-        public const int WorkerMessageSetCapacity = 1000;
+        public const int LocalMessageSetCapacity = 1000;
         public const int ServerMessageSetCapacity = 1000;
         // 矿工名中不可以包含的字符
         public static readonly char[] InvalidMinerNameChars = { '.', ' ', '-', '_' };

+ 2 - 2
src/NTMinerlib/NTMinerlib.csproj

@@ -83,8 +83,8 @@
     <Compile Include="Windows\Role.cs" />
     <Compile Include="Windows\Cmd.cs" />
     <Compile Include="Windows\TaskKill.cs" />
-    <Compile Include="WorkerMessage\IWorkerMessageSet.cs" />
-    <Compile Include="WorkerMessage\WorkerMessageSet.cs" />
+    <Compile Include="LocalMessage\ILocalMessageSet.cs" />
+    <Compile Include="LocalMessage\LocalMessageSet.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="packages.config" />

+ 22 - 22
src/NTMinerlib/VirtualRoot.cs

@@ -5,7 +5,7 @@ using NTMiner.Ip.Impl;
 using NTMiner.MinerClient;
 using NTMiner.Serialization;
 using NTMiner.ServerMessage;
-using NTMiner.WorkerMessage;
+using NTMiner.LocalMessage;
 using System;
 using System.Diagnostics;
 using System.IO;
@@ -19,13 +19,13 @@ namespace NTMiner {
     /// </summary>
     public static partial class VirtualRoot {
         public static readonly string AppFileFullName = Process.GetCurrentProcess().MainModule.FileName;
-        public static string WorkerMessageDbFileFullName {
+        public static string LocalMessageDbFileFullName {
             get {
                 if (IsMinerClient) {
-                    return Path.Combine(MainAssemblyInfo.TempDirFullName, NTKeyword.WorkerMessageDbFileName);
+                    return Path.Combine(MainAssemblyInfo.TempDirFullName, NTKeyword.LocalMessageDbFileName);
                 }
                 if (IsMinerStudio) {
-                    return Path.Combine(MainAssemblyInfo.HomeDirFullName, NTKeyword.WorkerMessageDbFileName);
+                    return Path.Combine(MainAssemblyInfo.HomeDirFullName, NTKeyword.LocalMessageDbFileName);
                 }
                 return string.Empty;
             }
@@ -99,7 +99,7 @@ namespace NTMiner {
         public static readonly IMessageDispatcher SMessageDispatcher;
         private static readonly ICmdBus SCommandBus;
         private static readonly IEventBus SEventBus;
-        public static readonly IWorkerMessageSet WorkerMessages;
+        public static readonly ILocalMessageSet LocalMessages;
         public static readonly IServerMessageSet LocalServerMessageSet;
         #region Out
         private static IOut _out;
@@ -148,8 +148,8 @@ namespace NTMiner {
             SMessageDispatcher = new MessageDispatcher();
             SCommandBus = new DirectCommandBus(SMessageDispatcher);
             SEventBus = new DirectEventBus(SMessageDispatcher);
-            WorkerMessages = new WorkerMessageSet(WorkerMessageDbFileFullName);
-            LocalServerMessageSet = new LocalServerMessageSet(WorkerMessageDbFileFullName);
+            LocalMessages = new LocalMessageSet(LocalMessageDbFileFullName);
+            LocalServerMessageSet = new LocalServerMessageSet(LocalMessageDbFileFullName);
         }
 
         #region ConvertToGuid
@@ -248,20 +248,20 @@ namespace NTMiner {
         }
         #endregion
 
-        #region WorkerMessage
-        public static void ThisWorkerInfo(string provider, string content, OutEnum outEnum = OutEnum.None, bool toConsole = false) {
-            ThisWorkerMessage(provider, WorkerMessageType.Info, content, outEnum: outEnum, toConsole: toConsole);
+        #region LocalMessage
+        public static void ThisLocalInfo(string provider, string content, OutEnum outEnum = OutEnum.None, bool toConsole = false) {
+            ThisLocalMessage(provider, LocalMessageType.Info, content, outEnum: outEnum, toConsole: toConsole);
         }
 
-        public static void ThisWorkerWarn(string provider, string content, OutEnum outEnum = OutEnum.None, bool toConsole = false) {
-            ThisWorkerMessage(provider, WorkerMessageType.Warn, content, outEnum: outEnum, toConsole: toConsole);
+        public static void ThisLocalWarn(string provider, string content, OutEnum outEnum = OutEnum.None, bool toConsole = false) {
+            ThisLocalMessage(provider, LocalMessageType.Warn, content, outEnum: outEnum, toConsole: toConsole);
         }
 
-        public static void ThisWorkerError(string provider, string content, OutEnum outEnum = OutEnum.None, bool toConsole = false) {
-            ThisWorkerMessage(provider, WorkerMessageType.Error, content, outEnum: outEnum, toConsole: toConsole);
+        public static void ThisLocalError(string provider, string content, OutEnum outEnum = OutEnum.None, bool toConsole = false) {
+            ThisLocalMessage(provider, LocalMessageType.Error, content, outEnum: outEnum, toConsole: toConsole);
         }
 
-        private static void ThisWorkerMessage(string provider, WorkerMessageType messageType, string content, OutEnum outEnum, bool toConsole) {
+        private static void ThisLocalMessage(string provider, LocalMessageType messageType, string content, OutEnum outEnum, bool toConsole) {
             switch (outEnum) {
                 case OutEnum.None:
                     break;
@@ -279,13 +279,13 @@ namespace NTMiner {
                     break;
                 case OutEnum.Auto:
                     switch (messageType) {
-                        case WorkerMessageType.Info:
+                        case LocalMessageType.Info:
                             Out.ShowInfo(content);
                             break;
-                        case WorkerMessageType.Warn:
+                        case LocalMessageType.Warn:
                             Out.ShowWarn(content, delaySeconds: 4);
                             break;
-                        case WorkerMessageType.Error:
+                        case LocalMessageType.Error:
                             Out.ShowError(content, delaySeconds: 4);
                             break;
                         default:
@@ -297,20 +297,20 @@ namespace NTMiner {
             }
             if (toConsole) {
                 switch (messageType) {
-                    case WorkerMessageType.Info:
+                    case LocalMessageType.Info:
                         Write.UserInfo(content);
                         break;
-                    case WorkerMessageType.Warn:
+                    case LocalMessageType.Warn:
                         Write.UserWarn(content);
                         break;
-                    case WorkerMessageType.Error:
+                    case LocalMessageType.Error:
                         Write.UserError(content);
                         break;
                     default:
                         break;
                 }
             }
-            WorkerMessages.Add(WorkerMessageChannel.This.GetName(), provider, messageType.GetName(), content);
+            LocalMessages.Add(LocalMessageChannel.This.GetName(), provider, messageType.GetName(), content);
         }
         #endregion
 

+ 20 - 0
src/UnitTests/LocalMessageTests.cs

@@ -0,0 +1,20 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using NTMiner;
+using System.IO;
+
+namespace UnitTests {
+    [TestClass]
+    public class LocalMessageTests {
+        [TestMethod]
+        public void BenchmarkTest() {
+            File.Delete(VirtualRoot.LocalMessageDbFileFullName);
+            int times = 2000;
+            Assert.IsTrue(times > NTKeyword.LocalMessageSetCapacity);
+            string content = "this is a test";
+            for (int i = 0; i < times; i++) {
+                VirtualRoot.ThisLocalInfo(nameof(LocalMessageTests), content);
+            }
+            Assert.IsTrue(VirtualRoot.LocalMessages.Count == NTKeyword.LocalMessageSetCapacity);
+        }
+    }
+}

+ 1 - 1
src/UnitTests/UnitTests.csproj

@@ -63,7 +63,7 @@
     <Compile Include="RegexTests.cs" />
     <Compile Include="TimingTests.cs" />
     <Compile Include="RemoteDesktopTests.cs" />
-    <Compile Include="WorkerMessageTests.cs" />
+    <Compile Include="LocalMessageTests.cs" />
     <Compile Include="WMITests.cs" />
   </ItemGroup>
   <ItemGroup>

+ 0 - 20
src/UnitTests/WorkerMessageTests.cs

@@ -1,20 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using NTMiner;
-using System.IO;
-
-namespace UnitTests {
-    [TestClass]
-    public class WorkerMessageTests {
-        [TestMethod]
-        public void BenchmarkTest() {
-            File.Delete(VirtualRoot.WorkerMessageDbFileFullName);
-            int times = 2000;
-            Assert.IsTrue(times > NTKeyword.WorkerMessageSetCapacity);
-            string content = "this is a test";
-            for (int i = 0; i < times; i++) {
-                VirtualRoot.ThisWorkerInfo(nameof(WorkerMessageTests), content);
-            }
-            Assert.IsTrue(VirtualRoot.WorkerMessages.Count == NTKeyword.WorkerMessageSetCapacity);
-        }
-    }
-}