Bladeren bron

每次未连接云服务时,打开登录页面会获取最快服务器的逻辑变更为开机后第一次打开登录页面时(未登录云服务时)会获取最快云服务,且云服务列表添加中国,德国,香港服务器。

felix 1 jaar geleden
bovenliggende
commit
1da1148126

+ 1 - 1
Vinno.FIS.Sonopost/Assets/wwwroot/lang/en-us.json

@@ -65,6 +65,7 @@
   "FlyinsonoServer": "Flyinsono server",
   "CloudServerInChina": "China server",
   "CloudServerInGermany": "Germany server",
+  "CloudServerInHongKong": "Hong Kong server",
   "CloudServerByCustom": "Add server",
   "Brand": "Brand",
   "Model": "Model",
@@ -217,5 +218,4 @@
   "Offline": "Offline",
   "Online": "Online",
   "Logoning": "Logoning"
-
 }

+ 1 - 0
Vinno.FIS.Sonopost/Assets/wwwroot/lang/zh-cn.json

@@ -65,6 +65,7 @@
   "FlyinsonoServer": "杏聆荟服务器",
   "CloudServerInChina": "中国服务器",
   "CloudServerInGermany": "德国服务器",
+  "CloudServerInHongKong": "香港服务器",
   "CloudServerByCustom": "自定义服务器",
   "Brand": "品牌",
   "Model": "型号",

+ 27 - 7
Vinno.FIS.Sonopost/Assets/wwwroot/pages/server/login.html

@@ -40,6 +40,11 @@
                 <select name="ServerNode"
                         lay-verify="required"
                         lay-filter="ServerNode"></select>
+                <input type="text"
+                       name="ServerName"
+                       lay-filter="ServerName"
+                       autocomplete="off"
+                       class="layui-input  is-hide" />
             </div>
         </div>
         <div class="layui-form-item custom-server-item">
@@ -177,13 +182,14 @@
             let res = await $api("server", "GetLoginInfo");
             if (!res.IsSuccess) return;
             let data = res.Data;
-            let serverNode = data.Address + ":" + data.Port;
+            let serverNode = data.Address + ":" + data.Port + "-" + data.VCloudServerName;
             form.val(formFilter, {
                 ServerNode: serverNode,
                 ServerAddress: data.Address,
                 ServerPort: data.Port,
                 Account: data.Account,
-                Password: data.Password
+                Password: data.Password,
+                ServerName: data.VCloudServerName
             });
             store.serverLogged = data.IsLogged;
             if (data.IsLogged) {
@@ -198,7 +204,8 @@
                 el.val("custom");
                 form.val(formFilter, {
                     ServerAddress: data.Address,
-                    ServerPort: data.Port
+                    ServerPort: data.Port,
+                    ServerName: data.Address + ":" + data.Port,
                 });
             }
             let account = form.find(formFilter, "Account");
@@ -216,11 +223,12 @@
         }
 
         async function initServerNodeSelect() {
+            console.log("initServerNodeSelect");
             let res = await $api("server", "GetServerList",);
             if (!res.IsSuccess) return;
             let options = [];
             res.Data.forEach((x) => {
-                options.push(`<option value="${x.Host}:${x.Port}">${$t(x.DisplayName)}</option>`);
+                options.push(`<option value="${x.Host}:${x.Port}-${x.DisplayName}">${$t(x.DisplayName)}</option>`);
 
             });
             options.push(
@@ -234,14 +242,21 @@
         }
         function initServerNodeEvent() {
             form.on("select(ServerNode)", function (data) {
+                console.log("initServerNodeEvent");
                 let ip = data.value;
                 let port = 9096;
+                let serverName = "";
                 if (ip === "custom") {
                     $("#pageLogin .custom-server-item").show();
                     ip = "";
                 } else {
                     $("#pageLogin .custom-server-item").hide();
-                    let splitRst = ip.split(":");
+                    let splitRst = ip.split('-');
+                    ip = splitRst[0];
+                    if (splitRst.length > 1) {
+                        serverName = splitRst[1];
+                    }
+                    splitRst = ip.split(':');
                     ip = splitRst[0];
                     if (splitRst.length > 1) {
                         port = parseInt(splitRst[1]);
@@ -249,7 +264,8 @@
                 }
                 form.val(formFilter, {
                     ServerAddress: ip,
-                    ServerPort: port
+                    ServerPort: port,
+                    ServerName: serverName
                 });
                 form.render(null, formFilter);
                 let organization = form.find(formFilter, "Organization");
@@ -261,12 +277,16 @@
 
         async function handleLogin(e, data) {
             let loadingIndex = $loading();
+            if (data.ServerName == "") {
+                data.ServerName = data.ServerAddress + ":" + data.ServerPort;
+            }
             let request = {
                 Ipv4: data.ServerAddress,
                 Port: data.ServerPort,
                 Account: data.Account,
                 Password: data.Password,
-                HospitalName: data.HospitalName
+                HospitalName: data.HospitalName,
+                ServerName: data.ServerName,
             };
 
             try {

+ 17 - 1
Vinno.FIS.Sonopost/Common/SonopostConstants.cs

@@ -1,6 +1,6 @@
 namespace Vinno.FIS.Sonopost.Common
 {
-    public class SonopostConstants
+    internal class SonopostConstants
     {
         public static string DataFolder { get; set; }
 
@@ -13,5 +13,21 @@
         public const string UpgradeAppName = "Vinno.FIS.Sonopost.Upgrade";
         public const string UpgradeAppFileName = "Vinno.FIS.Sonopost.Upgrade.exe";
         public const string NewUpgradeAppFileName = "Vinno.FIS.Sonopost.NewUpgrade.exe";
+
+        public const string FlyinsonoServerName = "FlyinsonoServer";
+
+        public const string ChinaServerName = "CloudServerInChina";
+        public const string ChinaServer = "cloud.xinglinghui.com:9096";
+        public const string ChinaServerHost = "cloud.xinglinghui.com";
+
+        public const string GermanyServerName = "CloudServerInGermany";
+        public const string GermanyServer = "cloud.flyinsono.com:9096";
+        public const string GermanyServerHost = "cloud.flyinsono.com";
+
+        public const string HongkongServerName = "CloudServerInHongKong";
+        public const string HongkongServer = "s01.flyinsono.com:9096";
+        public const string HongkongServerHost = "s01.flyinsono.com";
+
+        public const int CurrentSonopostUserDefinedSettingVersion = 1;
     }
 }

+ 72 - 0
Vinno.FIS.Sonopost/Features/Config/ServerInfoSetting.cs

@@ -0,0 +1,72 @@
+using System;
+using Vinno.FIS.Sonopost.Common;
+
+namespace Vinno.FIS.Sonopost.Features.Config
+{
+    internal class ServerInfoSetting
+    {
+        private string _displayName;
+
+        /// <summary>
+        /// Gets or sets the host.
+        /// </summary>
+        public string Host { get; set; }
+
+        /// <summary>
+        /// Gets or sets the server port.
+        /// </summary>
+        public int Port { get; set; }
+
+        /// <summary>
+        /// Gets the value to indicate whether the server is FIS default server or custom server.
+        /// </summary>
+        public bool IsDefault { get; }
+
+        /// <summary>
+        /// Gets the value to indicate DisplayName,if is default,the displayName is Flyinsono Server else is host:port
+        /// </summary>
+        public string DisplayName => _displayName;
+
+        public ServerInfoSetting(string host, int port, bool isDefault = false, string displayName = "")
+        {
+            Host = host;
+            Port = port;
+            IsDefault = isDefault;
+            if (string.IsNullOrEmpty(displayName))
+            {
+                if (isDefault)
+                {
+                    if (string.Equals($"{host}:{port}", SonopostConstants.ChinaServer, StringComparison.OrdinalIgnoreCase))
+                    {
+                        _displayName = SonopostConstants.ChinaServerName;
+                    }
+                    else if (string.Equals($"{host}:{port}", SonopostConstants.GermanyServer, StringComparison.OrdinalIgnoreCase))
+                    {
+                        _displayName = SonopostConstants.GermanyServerName;
+                    }
+                    else if (string.Equals($"{host}:{port}", SonopostConstants.HongkongServer, StringComparison.OrdinalIgnoreCase))
+                    {
+                        _displayName = SonopostConstants.HongkongServerName;
+                    }
+                    else
+                    {
+                        _displayName = $"{host}:{port}";
+                    }
+                }
+                else
+                {
+                    _displayName = $"{host}:{port}";
+                }
+            }
+            else
+            {
+                _displayName = displayName;
+            }
+        }
+
+        public override string ToString()
+        {
+            return $"{Host}:{Port}";
+        }
+    }
+}

+ 2 - 2
Vinno.FIS.Sonopost/Features/Config/ServerSetting.cs

@@ -5,8 +5,8 @@ namespace Vinno.FIS.Sonopost.Features.Config
 {
     internal class ServerSetting
     {
-        public FISServerInfo DefaultServer { get; set; }
-        public List<FISServerInfo> Servers { get; set; }
+        public ServerInfoSetting DefaultServer { get; set; }
+        public List<ServerInfoSetting> Servers { get; set; }
 
         public bool IsLoginWithAccountAndPassword { get; set; }
 

+ 36 - 10
Vinno.FIS.Sonopost/Features/Config/SonopostUserDefinedSettingInfo.cs

@@ -1,7 +1,7 @@
-using FISLib.Connect;
-using FISLib.LiveVideo;
+using FISLib.LiveVideo;
 using System.Collections.Generic;
 using System.IO;
+using System.Linq;
 using System.Text.Json;
 using Vinno.FIS.Sonopost.Common;
 using Vinno.FIS.Sonopost.Features.Oled;
@@ -21,6 +21,8 @@ namespace Vinno.FIS.Sonopost.Features.Config
 
         public OledSetting OledSetting { get; set; }
         public PageSetting PageSetting { get; set; }
+
+        public int Version { get; set; }
     }
 
     internal class SonopostUserDefinedSettings : SonopostUserDefinedSettingInfo
@@ -38,10 +40,13 @@ namespace Vinno.FIS.Sonopost.Features.Config
                 {
                     ServerSetting = new ServerSetting
                     {
-                        DefaultServer = new FISServerInfo("cloud.xinglinghui.com", 9096, true),
-                        Servers = new List<FISServerInfo>
+                        DefaultServer = new ServerInfoSetting(SonopostConstants.ChinaServerHost, 9096, true, SonopostConstants.FlyinsonoServerName),
+                        Servers = new List<ServerInfoSetting>
                         {
-                            new FISServerInfo("cloud.xinglinghui.com", 9096, true),
+                            new ServerInfoSetting(SonopostConstants.ChinaServerHost, 9096, true, SonopostConstants.FlyinsonoServerName),
+                            new ServerInfoSetting(SonopostConstants.ChinaServerHost, 9096, true, ""),
+                            new ServerInfoSetting(SonopostConstants.GermanyServerHost, 9096, true, ""),
+                            new ServerInfoSetting(SonopostConstants.HongkongServerHost, 9096, true, ""),
                         },
                     },
                     DicomSetting = new DicomSetting
@@ -68,7 +73,8 @@ namespace Vinno.FIS.Sonopost.Features.Config
                     PageSetting = new PageSetting
                     {
                         Language = Language.Chinese,
-                    }
+                    },
+                    Version = SonopostConstants.CurrentSonopostUserDefinedSettingVersion,
                 };
                 Instance.Save();
             }
@@ -93,12 +99,32 @@ namespace Vinno.FIS.Sonopost.Features.Config
                 {
                     return false;
                 }
-                else if (Instance.PageSetting == null)//老版的配置文件可能为空,
+                if (Instance.Version < SonopostConstants.CurrentSonopostUserDefinedSettingVersion)
                 {
-                    Instance.PageSetting = new PageSetting
+                    if (Instance.Version == 0)
                     {
-                        Language = Language.Chinese,
-                    };
+                        if (Instance.PageSetting == null)//老版的配置文件可能为空,
+                        {
+                            Instance.PageSetting = new PageSetting
+                            {
+                                Language = Language.Chinese,
+                            };
+                        }
+                        if (!Instance.ServerSetting.Servers.Any(x => x.DisplayName == SonopostConstants.ChinaServerName && x.IsDefault))
+                        {
+                            Instance.ServerSetting.Servers.Insert(1, new ServerInfoSetting(SonopostConstants.ChinaServerHost, 9096, true, ""));
+                        }
+                        if (!Instance.ServerSetting.Servers.Any(x => x.DisplayName == SonopostConstants.GermanyServerName && x.IsDefault))
+                        {
+                            Instance.ServerSetting.Servers.Insert(2, new ServerInfoSetting(SonopostConstants.GermanyServerHost, 9096, true, ""));
+                        }
+                        if (!Instance.ServerSetting.Servers.Any(x => x.DisplayName == SonopostConstants.HongkongServerName && x.IsDefault))
+                        {
+                            Instance.ServerSetting.Servers.Insert(3, new ServerInfoSetting(SonopostConstants.HongkongServerHost, 9096, true, ""));
+                        }
+                        Instance.Version = SonopostConstants.CurrentSonopostUserDefinedSettingVersion;
+                        Instance.Save();
+                    }
                 }
                 return true;
             }

+ 23 - 14
Vinno.FIS.Sonopost/Managers/ConfigManager.cs

@@ -1,5 +1,4 @@
-using FISLib.Connect;
-using FISLib.LiveVideo;
+using FISLib.LiveVideo;
 using System.Linq;
 using Vinno.FIS.Sonopost.Features.Config;
 using Vinno.FIS.Sonopost.Managers.Interfaces;
@@ -13,12 +12,16 @@ namespace Vinno.FIS.Sonopost.Managers
 
         private int _oldVCloudServerPort;
 
+        private string _oldVCloudServerName;
+
         private readonly object _locker = new object();
 
         public string VCloudServerAddress { get; private set; }
 
         public int VCloudServerPort { get; private set; }
 
+        public string VCloudServerName { get; private set; }
+
         public ConfigManager()
         {
             InitServerConfig();
@@ -33,47 +36,51 @@ namespace Vinno.FIS.Sonopost.Managers
             }
         }
 
-        public void SwitchVCloudServer(string address, int port)
+        public void SwitchVCloudServer(string address, int port, string vcloudServerName)
         {
             VCloudServerAddress = address;
             VCloudServerPort = port;
+            VCloudServerName = vcloudServerName;
         }
 
         /// <summary>
         /// 刷新默认服务器
         /// </summary>
         /// <param name="server"></param>
-        public void RefreshDefaultServer(FISServerInfo oldDefaultServer, FISServerInfo newDefaultServer)
+        public void RefreshFlyinsonoServer(ServerInfoSetting oldFlyinsonoServer, ServerInfoSetting newFlyinsonoServer)
         {
-            if (VCloudServerAddress == oldDefaultServer.Host && VCloudServerPort == oldDefaultServer.Port)
+            if (VCloudServerAddress == oldFlyinsonoServer.Host && VCloudServerPort == oldFlyinsonoServer.Port && VCloudServerName == oldFlyinsonoServer.DisplayName)
             {
-                VCloudServerAddress = newDefaultServer.Host;
-                VCloudServerPort = newDefaultServer.Port;
+                VCloudServerAddress = newFlyinsonoServer.Host;
+                VCloudServerPort = newFlyinsonoServer.Port;
+                VCloudServerName = newFlyinsonoServer.DisplayName;
             }
-            if (_oldVCloudServerAddress == oldDefaultServer.Host && VCloudServerPort == oldDefaultServer.Port)
+            if (_oldVCloudServerAddress == oldFlyinsonoServer.Host && _oldVCloudServerPort == oldFlyinsonoServer.Port && _oldVCloudServerName == oldFlyinsonoServer.DisplayName)
             {
-                _oldVCloudServerAddress = newDefaultServer.Host;
-                _oldVCloudServerPort = newDefaultServer.Port;
+                _oldVCloudServerAddress = newFlyinsonoServer.Host;
+                _oldVCloudServerPort = newFlyinsonoServer.Port;
+                _oldVCloudServerName = newFlyinsonoServer.DisplayName;
             }
         }
 
         public void SaveVCloudServer()
         {
-            var existItem = SonopostUserDefinedSettings.Instance.ServerSetting.Servers.FirstOrDefault(x => x.Host == VCloudServerAddress && x.Port == VCloudServerPort);
+            var existItem = SonopostUserDefinedSettings.Instance.ServerSetting.Servers.FirstOrDefault(x => x.Host == VCloudServerAddress && x.Port == VCloudServerPort && x.DisplayName == VCloudServerName);
             if (existItem != null)
             {
                 SonopostUserDefinedSettings.Instance.ServerSetting.DefaultServer = existItem;
             }
             else
             {
-                var serverInfo = new FISServerInfo(VCloudServerAddress, VCloudServerPort, false);
+                var serverInfo = new ServerInfoSetting(VCloudServerAddress, VCloudServerPort, false);
                 SonopostUserDefinedSettings.Instance.ServerSetting.DefaultServer = serverInfo;
                 SonopostUserDefinedSettings.Instance.ServerSetting.Servers.Add(serverInfo);
             }
-            if (_oldVCloudServerAddress != VCloudServerAddress || _oldVCloudServerPort != VCloudServerPort)
+            if (_oldVCloudServerAddress != VCloudServerAddress || _oldVCloudServerPort != VCloudServerPort || _oldVCloudServerName != VCloudServerName)
             {
                 _oldVCloudServerAddress = VCloudServerAddress;
                 _oldVCloudServerPort = VCloudServerPort;
+                _oldVCloudServerName = VCloudServerName;
                 var videoInfos = SonopostUserDefinedSettings.Instance.HardwareSetting.VideoDeviceInfoList;
                 var config = videoInfos.FirstOrDefault(x => x.Category == FISLiveChannelCategory.Main);
                 if (config != null)
@@ -91,9 +98,11 @@ namespace Vinno.FIS.Sonopost.Managers
             var defaultServer = SonopostUserDefinedSettings.Instance.ServerSetting.DefaultServer;
             VCloudServerAddress = defaultServer.Host;
             VCloudServerPort = defaultServer.Port;
+            VCloudServerName = defaultServer.DisplayName;
             _oldVCloudServerAddress = VCloudServerAddress;
             _oldVCloudServerPort = VCloudServerPort;
-            Logger.WriteLineInfo($"ServerAddress:{VCloudServerAddress}:{VCloudServerPort}");
+            _oldVCloudServerName = VCloudServerName;
+            Logger.WriteLineInfo($"ConfigManager InitServerConfig:ServerAddress:{VCloudServerAddress},VCloudServerPort:{VCloudServerPort},VCloudServerName:{VCloudServerName}");
         }
     }
 }

+ 9 - 3
Vinno.FIS.Sonopost/Managers/Interfaces/IConfigManager.cs

@@ -1,4 +1,5 @@
 using FISLib.Connect;
+using Vinno.FIS.Sonopost.Features.Config;
 
 namespace Vinno.FIS.Sonopost.Managers.Interfaces
 {
@@ -14,6 +15,11 @@ namespace Vinno.FIS.Sonopost.Managers.Interfaces
         /// </summary>
         int VCloudServerPort { get; }
 
+        /// <summary>
+        /// Get DisplayName of vCloud Server
+        /// </summary>
+        string VCloudServerName { get; }
+
         /// <summary>
         /// Save parameter
         /// </summary>
@@ -24,13 +30,13 @@ namespace Vinno.FIS.Sonopost.Managers.Interfaces
         /// </summary>
         /// <param name="address"></param>
         /// <param name="port"></param>
-        void SwitchVCloudServer(string address, int port);
+        void SwitchVCloudServer(string address, int port, string displayName);
 
         /// <summary>
-        /// 刷新默认服务器
+        /// 刷新杏聆荟服务器
         /// </summary>
         /// <param name="server"></param>
-        void RefreshDefaultServer(FISServerInfo oldDefaultServer, FISServerInfo newDefaultServer);
+        void RefreshFlyinsonoServer(ServerInfoSetting oldDefaultServer, ServerInfoSetting newDefaultServer);
 
         void SaveVCloudServer();
     }

+ 3 - 1
Vinno.FIS.Sonopost/Managers/Interfaces/ITerminalClientManager.cs

@@ -39,8 +39,10 @@ namespace Vinno.FIS.Sonopost.Managers.Interfaces
         /// </summary>
         /// <param name="address"></param>
         /// <param name="port"></param>
-        bool ChangeServer(string address, int port);
+        bool ChangeServer(string address, int port,string serverName);
 
         FISServerInfo GetFasterServerInfo();
+
+        bool HasGetFasterServer { get; }
     }
 }

+ 19 - 3
Vinno.FIS.Sonopost/Managers/TerminalClientManager.cs

@@ -22,6 +22,8 @@ namespace Vinno.FIS.Sonopost.Managers
         private UltrasoundMachineInfo _ultrasoundMachineInfo;
         public bool IsLoginWithAccountAndPassword { get; private set; }
 
+        public bool HasGetFasterServer { get; private set; }
+
         public string UniqueId { get; private set; } = string.Empty;
 
         public event EventHandler<DeviceStatus> LoginStatusChanged;
@@ -33,6 +35,7 @@ namespace Vinno.FIS.Sonopost.Managers
             _fisConnectionService = fisManager.FISConnectionService;
             _fisConnectionService.FISDeviceStatusChanged += OnStatusChanged;
             _ultrasoundMachineInfo = fisManager.UltrasoundMachineInfo;
+            HasGetFasterServer = false;
             IsLoginWithAccountAndPassword = SonopostUserDefinedSettings.Instance.ServerSetting.IsLoginWithAccountAndPassword;
         }
 
@@ -83,7 +86,20 @@ namespace Vinno.FIS.Sonopost.Managers
 
         public FISServerInfo GetFasterServerInfo()
         {
-            return _fisConnectionService.GetFasterServer(true);
+            try
+            {
+                var result = _fisConnectionService.GetFasterServer(true);
+                if (result != null)
+                {
+                    HasGetFasterServer = true;
+                }
+                return result;
+            }
+            catch (Exception ex)
+            {
+                Logger.WriteLineError($"GetFasterServerInfo Error:{ex}");
+            }
+            return null;
         }
 
         public bool LogOff()
@@ -101,11 +117,11 @@ namespace Vinno.FIS.Sonopost.Managers
             return false;
         }
 
-        public bool ChangeServer(string address, int port)
+        public bool ChangeServer(string address, int port, string vCloudServerName)
         {
             try
             {
-                _configManager.SwitchVCloudServer(address, port);
+                _configManager.SwitchVCloudServer(address, port, vCloudServerName);
                 ResetServerAddress($"{address}:{port}");
                 return true;
             }

+ 1 - 0
Vinno.FIS.Sonopost/Vinno.FIS.Sonopost.csproj

@@ -78,6 +78,7 @@
       <SubType>Designer</SubType>
     </ApplicationDefinition>
     <Compile Include="Features\Config\PageSetting.cs" />
+    <Compile Include="Features\Config\ServerInfoSetting.cs" />
     <Compile Include="WebApi\BaseController.cs" />
     <Compile Include="WebApi\Controllers\DicomController.cs" />
     <Compile Include="WebApi\Controllers\LiveController.cs" />

+ 31 - 10
Vinno.FIS.Sonopost/WebApi/Controllers/ServerController.cs

@@ -1,5 +1,6 @@
 using FISLib.Connect;
 using System.Linq;
+using Vinno.FIS.Sonopost.Common;
 using Vinno.FIS.Sonopost.Features.Config;
 using Vinno.FIS.Sonopost.WebApi.Models;
 using Vinno.IUS.Common.Utilities;
@@ -17,9 +18,9 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
         [WebApiAction("Login")]
         public Result Login(ServerLoginRequest2 request)
         {
-            if (!request.Ipv4.Equals(ConfigManager.VCloudServerAddress) || !request.Port.Equals(ConfigManager.VCloudServerPort))
+            if (!request.Ipv4.Equals(ConfigManager.VCloudServerAddress) || !request.Port.Equals(ConfigManager.VCloudServerPort) || !request.ServerName.Equals(ConfigManager.VCloudServerName))
             {
-                bool changed = TerminalClientManager.ChangeServer(request.Ipv4, request.Port);
+                bool changed = TerminalClientManager.ChangeServer(request.Ipv4, request.Port, request.ServerName);
                 if (!changed) Result.Fail();
             }
             var isLoginWithAccountAndPassword = SonopostUserDefinedSettings.Instance.ServerSetting.IsLoginWithAccountAndPassword;
@@ -116,6 +117,7 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
                 IsLoginWithAccountAndPassword = isLoginWithAccountAndPassword,
                 IsExisted = isExisted,
                 DongleId = FISManager.UltrasoundMachineInfo.DongleId,
+                VCloudServerName = ConfigManager.VCloudServerName,
             };
             return Result.Success(result);
         }
@@ -137,17 +139,17 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
         [WebApiAction]
         public Result GetServerList()
         {
-            if (LoginManager.LoginStatus != DeviceStatus.Logon)
+            if (LoginManager.LoginStatus != DeviceStatus.Logon && !TerminalClientManager.HasGetFasterServer)
             {
                 var fasterServer = TerminalClientManager.GetFasterServerInfo();
-                if (fasterServer != null && SonopostUserDefinedSettings.Instance.ServerSetting.Servers.FirstOrDefault(x => x.IsDefault).ToString() != fasterServer.ToString())
+                if (fasterServer != null && SonopostUserDefinedSettings.Instance.ServerSetting.Servers.FirstOrDefault(x => x.IsDefault && x.DisplayName == SonopostConstants.FlyinsonoServerName).ToString() != fasterServer.ToString())
                 {
-                    var defaultServer = SonopostUserDefinedSettings.Instance.ServerSetting.Servers.FirstOrDefault(x => x.IsDefault);
-                    var oldDefaultServer = new FISServerInfo(defaultServer.Host, defaultServer.Port, true);
-                    var newDefaultServer = new FISServerInfo(fasterServer.Host, fasterServer.Port, true);
-                    ConfigManager.RefreshDefaultServer(oldDefaultServer, newDefaultServer);
-                    defaultServer.Host = fasterServer.Host;
-                    defaultServer.Port = fasterServer.Port;
+                    var flyinsonoServer = SonopostUserDefinedSettings.Instance.ServerSetting.Servers.FirstOrDefault(x => x.IsDefault && x.DisplayName == SonopostConstants.FlyinsonoServerName);
+                    var oldFlyinsonoServer = new ServerInfoSetting(flyinsonoServer.Host, flyinsonoServer.Port, true, SonopostConstants.FlyinsonoServerName);
+                    var newFlyinsonoServer = new ServerInfoSetting(fasterServer.Host, fasterServer.Port, true, SonopostConstants.FlyinsonoServerName);
+                    ConfigManager.RefreshFlyinsonoServer(oldFlyinsonoServer, newFlyinsonoServer);
+                    flyinsonoServer.Host = fasterServer.Host;
+                    flyinsonoServer.Port = fasterServer.Port;
                     ConfigManager.Save();
                 }
             }
@@ -223,10 +225,29 @@ namespace Vinno.FIS.Sonopost.WebApi.Controllers
                 SonopostUserDefinedSettings.Instance.ServerSetting.IsLoginWithAccountAndPassword = false;
                 ConfigManager.Save();
             }
+            string serverName = string.Empty;
+            var existItems = SonopostUserDefinedSettings.Instance.ServerSetting.Servers.Where(x => x.Host == serverNodeRequest.Ipv4 && x.Port == serverNodeRequest.Port);
+            if (existItems.Count() == 0)
+            {
+                serverName = $"{serverNodeRequest.Ipv4}:{serverNodeRequest.Port}";
+            }
+            if (existItems.Count() == 1)
+            {
+                serverName = existItems.FirstOrDefault().DisplayName;
+            }
+            else
+            {
+                serverName = existItems.FirstOrDefault(x => x.DisplayName != SonopostConstants.FlyinsonoServerName)?.DisplayName;
+            }
+            if (string.IsNullOrEmpty(serverName))
+            {
+                serverName = $"{serverNodeRequest.Ipv4}:{serverNodeRequest.Port}";
+            }
             return Login(new ServerLoginRequest2
             {
                 Ipv4 = serverNodeRequest.Ipv4,
                 Port = serverNodeRequest.Port,
+                ServerName = serverName,
             });
         }
 

+ 2 - 0
Vinno.FIS.Sonopost/WebApi/Models/ServerLoginInfoResult.cs

@@ -16,5 +16,7 @@
         public string DongleId { get; set; }
 
         public bool IsLogged { get => !string.IsNullOrWhiteSpace(UniqueId); }
+
+        public string VCloudServerName { get; set; }
     }
 }

+ 2 - 0
Vinno.FIS.Sonopost/WebApi/Models/ServerLoginRequest.cs

@@ -9,5 +9,7 @@
     internal class ServerLoginRequest2 : ServerLoginRequest
     {
         public string HospitalName { get; set; }
+
+        public string ServerName { get; set; }
     }
 }