فهرست منبع

当魔盒切换服务器,不再自动关闭超声机直播开关,当品牌型号不存在时自动置空。

felix 1 سال پیش
والد
کامیت
63e3965267
2فایلهای تغییر یافته به همراه26 افزوده شده و 18 حذف شده
  1. 23 3
      Vinno.FIS.Sonopost/Managers/ConfigManager.cs
  2. 3 15
      Vinno.FIS.Sonopost/Managers/LiveVideoManager.cs

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

@@ -14,6 +14,8 @@ namespace Vinno.FIS.Sonopost.Managers
 
         private string _oldVCloudServerName;
 
+        private ILiveVideoManager _liveVideoManager;
+
         private readonly object _locker = new object();
 
         public string VCloudServerAddress { get; private set; }
@@ -76,6 +78,10 @@ namespace Vinno.FIS.Sonopost.Managers
                 SonopostUserDefinedSettings.Instance.ServerSetting.DefaultServer = serverInfo;
                 SonopostUserDefinedSettings.Instance.ServerSetting.Servers.Add(serverInfo);
             }
+            if (_liveVideoManager == null)
+            {
+                _liveVideoManager = AppManager.Instance.GetManager<ILiveVideoManager>();
+            }
             if (_oldVCloudServerAddress != VCloudServerAddress || _oldVCloudServerPort != VCloudServerPort || _oldVCloudServerName != VCloudServerName)
             {
                 _oldVCloudServerAddress = VCloudServerAddress;
@@ -85,9 +91,23 @@ namespace Vinno.FIS.Sonopost.Managers
                 var config = videoInfos.FirstOrDefault(x => x.Category == FISLiveChannelCategory.Main);
                 if (config != null)
                 {
-                    config.Model = null;
-                    config.Brand = null;
-                    config.IsEnable = false;
+                    if (!string.IsNullOrWhiteSpace(config.Brand))
+                    {
+                        var brandList = _liveVideoManager.GetBrandList();
+                        if (brandList == null || brandList.Count == 0 || !brandList.Contains(config.Brand))
+                        {
+                            config.Brand = null;
+                            config.Model = null;
+                        }
+                        else if (!string.IsNullOrWhiteSpace(config.Model))
+                        {
+                            var modelList = _liveVideoManager.GetModelList(config.Brand);
+                            if (modelList == null || modelList.Count == 0 || !modelList.Contains(config.Model))
+                            {
+                                config.Model = null;
+                            }
+                        }
+                    }
                 }
             }
             Save();

+ 3 - 15
Vinno.FIS.Sonopost/Managers/LiveVideoManager.cs

@@ -72,11 +72,7 @@ namespace Vinno.FIS.Sonopost.Managers
         {
             try
             {
-                if (_deviceStatus == DeviceStatus.Logon)
-                {
-                    return _fisLiveVideoService.GetBrandList();
-                }
-                return new List<string>();
+                return _fisLiveVideoService.GetBrandList();
             }
             catch (Exception e)
             {
@@ -93,11 +89,7 @@ namespace Vinno.FIS.Sonopost.Managers
                 {
                     return new List<string>();
                 }
-                if (_deviceStatus == DeviceStatus.Logon)
-                {
-                    return _fisLiveVideoService.GetModelList(brand);
-                }
-                return new List<string>();
+                return _fisLiveVideoService.GetModelList(brand);
             }
             catch (Exception e)
             {
@@ -114,11 +106,7 @@ namespace Vinno.FIS.Sonopost.Managers
                 {
                     return null;
                 }
-                if (_deviceStatus == DeviceStatus.Logon)
-                {
-                    return _fisLiveVideoService.GetRecommandResolution(brand, model);
-                }
-                return null;
+                return _fisLiveVideoService.GetRecommandResolution(brand, model);
             }
             catch (Exception e)
             {