ntminer 5 years ago
parent
commit
a39f08be6b

+ 4 - 0
src/AppModels/MinerStudio/EmptyMinerStudioService.cs

@@ -29,6 +29,10 @@ namespace NTMiner.MinerStudio {
             // 什么也不做
         }
 
+        public void GetConsoleOutLinesAsync(IMinerData client, long afterTime) {
+            // 什么也不做
+        }
+
         public void EnableRemoteDesktopAsync(IMinerData client) {
             // 什么也不做
         }

+ 1 - 0
src/AppModels/MinerStudio/IMinerStudioService.cs

@@ -10,6 +10,7 @@ namespace NTMiner.MinerStudio {
         void UpdateClientAsync(string objectId, string propertyName, object value, Action<ResponseBase, Exception> callback);
         void UpdateClientsAsync(string propertyName, Dictionary<string, object> values, Action<ResponseBase, Exception> callback);
         void RemoveClientsAsync(List<string> objectIds, Action<ResponseBase, Exception> callback);
+        void GetConsoleOutLinesAsync(IMinerData client, long afterTime);
 
         void EnableRemoteDesktopAsync(IMinerData client);
         void BlockWAUAsync(IMinerData client);

+ 10 - 0
src/AppModels/MinerStudio/Impl/LocalMinerStudioService.cs

@@ -119,6 +119,16 @@ namespace NTMiner.MinerStudio.Impl {
         }
         #endregion
 
+        #region GetConsoleOutLinesAsync
+        public void GetConsoleOutLinesAsync(IMinerData client, long afterTime) {
+            RpcRoot.Client.MinerClientService.GetConsoleOutLinesAsync(client.GetLocalIp(), afterTime, (data, e) => {
+                if (data != null && data.Count > 0) {
+                    VirtualRoot.RaiseEvent(new ClientConsoleOutLinesEvent(client.ClientId, data));
+                }
+            });
+        }
+        #endregion
+
         #region BlockWAUAsync
         public void BlockWAUAsync(IMinerData client) {
             RpcRoot.PostAsync<ResponseBase>(client.GetLocalIp(), NTKeyword.NTMinerDaemonPort, _daemonControllerName, nameof(INTMinerDaemonController.BlockWAU), null, null, timeountMilliseconds: 3000);

+ 11 - 0
src/AppModels/MinerStudio/Impl/ServerMinerStudioService.cs

@@ -55,6 +55,17 @@ namespace NTMiner.MinerStudio.Impl {
         }
         #endregion
 
+        #region GetConsoleOutLinesAsync
+        public void GetConsoleOutLinesAsync(IMinerData client, long afterTime) {
+            MinerStudioRoot.WsClient.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.GetConsoleOutLines) {
+                Data = new WrapperClientIdData {
+                    ClientId = client.ClientId,
+                    Data = afterTime
+                }
+            });
+        }
+        #endregion
+
         #region BlockWAUAsync
         public void BlockWAUAsync(IMinerData client) {
             if (!MinerStudioRoot.WsClient.IsOpen) {

+ 3 - 18
src/AppModels/MinerStudio/MinerStudioRoot.partials.MinerClientConsoleViewModel.cs

@@ -1,6 +1,5 @@
 using NTMiner.MinerStudio.Vms;
 using NTMiner.Vms;
-using NTMiner.Ws;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -84,29 +83,15 @@ namespace NTMiner.MinerStudio {
                 if (this._minerClientVm == null) {
                     return;
                 }
-                long timestamp = 0;
+                long afterTime = 0;
                 var minerClientVm = this._minerClientVm;
                 lock (_locker) {
                     var item = _outLines.LastOrDefault();
                     if (item != null) {
-                        timestamp = item.Timestamp;
+                        afterTime = item.Timestamp;
                     }
                 }
-                if (RpcRoot.IsOuterNet) {
-                    WsClient.SendAsync(new WsMessage(Guid.NewGuid(), WsMessage.GetConsoleOutLines) {
-                        Data = new WrapperClientIdData {
-                            ClientId = minerClientVm.ClientId,
-                            Data = timestamp
-                        }
-                    });
-                }
-                else {
-                    RpcRoot.Client.MinerClientService.GetConsoleOutLinesAsync(minerClientVm.GetLocalIp(), timestamp, (data, e) => {
-                        if (data != null && data.Count > 0) {
-                            VirtualRoot.RaiseEvent(new ClientConsoleOutLinesEvent(minerClientVm.ClientId, data));
-                        }
-                    });
-                }
+                MinerStudioService.GetConsoleOutLinesAsync(minerClientVm, afterTime);
             }
         }
     }

+ 27 - 23
src/AppModels/MinerStudio/MinerStudioService.cs

@@ -15,67 +15,71 @@ namespace NTMiner.MinerStudio {
 
         private MinerStudioService() { }
 
-        public void AtikmdagPatcherAsync(IMinerData client) {
+        public void GetLatestSnapshotsAsync(int limit, Action<GetCoinSnapshotsResponse, Exception> callback) {
             throw new NotImplementedException();
         }
 
-        public void BlockWAUAsync(IMinerData client) {
+        public void QueryClientsAsync(QueryClientsRequest query, Action<QueryClientsResponse, Exception> callback) {
             throw new NotImplementedException();
         }
 
-        public void EnableRemoteDesktopAsync(IMinerData client) {
+        public void UpdateClientAsync(string objectId, string propertyName, object value, Action<ResponseBase, Exception> callback) {
             throw new NotImplementedException();
         }
 
-        public void GetDrivesAsync(IMinerData client) {
+        public void UpdateClientsAsync(string propertyName, Dictionary<string, object> values, Action<ResponseBase, Exception> callback) {
             throw new NotImplementedException();
         }
 
-        public void GetGpuProfilesJsonAsync(IMinerData client) {
+        public void RemoveClientsAsync(List<string> objectIds, Action<ResponseBase, Exception> callback) {
             throw new NotImplementedException();
         }
 
-        public void GetLatestSnapshotsAsync(int limit, Action<GetCoinSnapshotsResponse, Exception> callback) {
+        public void GetConsoleOutLinesAsync(IMinerData client, long afterTime) {
             throw new NotImplementedException();
         }
 
-        public void GetLocalIpsAsync(IMinerData client) {
+        public void EnableRemoteDesktopAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void GetOperationResultsAsync(IMinerData client, long afterTime) {
+        public void BlockWAUAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void GetSelfWorkLocalJsonAsync(IMinerData client) {
+        public void AtikmdagPatcherAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void QueryClientsAsync(QueryClientsRequest query, Action<QueryClientsResponse, Exception> callback) {
+        public void SwitchRadeonGpuAsync(IMinerData client, bool on) {
             throw new NotImplementedException();
         }
 
-        public void RemoveClientsAsync(List<string> objectIds, Action<ResponseBase, Exception> callback) {
+        public void RestartWindowsAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void RestartWindowsAsync(IMinerData client) {
+        public void ShutdownWindowsAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void SaveGpuProfilesJsonAsync(IMinerData client, string json) {
+        public void SetAutoBootStartAsync(IMinerData client, SetAutoBootStartRequest request) {
             throw new NotImplementedException();
         }
 
-        public void SaveSelfWorkLocalJsonAsync(IMinerData client, string localJson, string serverJson) {
+        public void StartMineAsync(IMinerData client, Guid workId) {
             throw new NotImplementedException();
         }
 
-        public void SetAutoBootStartAsync(IMinerData client, SetAutoBootStartRequest request) {
+        public void StopMineAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void SetLocalIpsAsync(IMinerData client, List<LocalIpInput> data) {
+        public void UpgradeNTMinerAsync(IMinerData client, string ntminerFileName) {
+            throw new NotImplementedException();
+        }
+
+        public void GetDrivesAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
@@ -83,31 +87,31 @@ namespace NTMiner.MinerStudio {
             throw new NotImplementedException();
         }
 
-        public void ShutdownWindowsAsync(IMinerData client) {
+        public void GetLocalIpsAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void StartMineAsync(IMinerData client, Guid workId) {
+        public void SetLocalIpsAsync(IMinerData client, List<LocalIpInput> data) {
             throw new NotImplementedException();
         }
 
-        public void StopMineAsync(IMinerData client) {
+        public void GetOperationResultsAsync(IMinerData client, long afterTime) {
             throw new NotImplementedException();
         }
 
-        public void SwitchRadeonGpuAsync(IMinerData client, bool on) {
+        public void GetSelfWorkLocalJsonAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void UpdateClientAsync(string objectId, string propertyName, object value, Action<ResponseBase, Exception> callback) {
+        public void SaveSelfWorkLocalJsonAsync(IMinerData client, string localJson, string serverJson) {
             throw new NotImplementedException();
         }
 
-        public void UpdateClientsAsync(string propertyName, Dictionary<string, object> values, Action<ResponseBase, Exception> callback) {
+        public void GetGpuProfilesJsonAsync(IMinerData client) {
             throw new NotImplementedException();
         }
 
-        public void UpgradeNTMinerAsync(IMinerData client, string ntminerFileName) {
+        public void SaveGpuProfilesJsonAsync(IMinerData client, string json) {
             throw new NotImplementedException();
         }
     }