瀏覽代碼

当roku.info存在时,优先使用文件中读取roku信息进行抄写

JeffWang 2 年之前
父節點
當前提交
ec0ad9f5fb
共有 2 個文件被更改,包括 22 次插入1 次删除
  1. 17 0
      FactoryTool_CShare/Business/V2Method.cs
  2. 5 1
      FactoryTool_CShare/Views/OperationPanel.cs

+ 17 - 0
FactoryTool_CShare/Business/V2Method.cs

@@ -7,6 +7,7 @@ using System;
 using System.Collections.Generic;
 using System.Data.SQLite;
 using System.Diagnostics;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -78,6 +79,22 @@ namespace MOKA_Factory_Tools
             return null;
         }
 
+        public static RokuCustomer GetRokuFileInfo()
+        {
+            string fileName = LocalPath.localpath + "roku.info";
+            if (File.Exists(fileName))
+            {
+                Log.WriteInfoLog(string.Format("using roku.info = {0}", fileName));
+                StreamReader file = File.OpenText(fileName);
+                RokuCustomer roku = GetRokuInfo(file.ReadToEnd());
+                file.Close();
+
+                return roku;
+            }
+
+            return null;
+        }
+
         /// <summary>
         /// 
         /// </summary>

+ 5 - 1
FactoryTool_CShare/Views/OperationPanel.cs

@@ -4327,8 +4327,12 @@ namespace MOKA_Factory_Tools
                 }
             }
 
+            // 如果存在文件roku.info,优先使用文件内容;
+            if (File.Exists(LocalPath.localpath + "roku.info"))
+                midListNow.rokuCustomer = V2Method.GetRokuFileInfo();
+
             //Roku客户服务信息抄写
-            if (midListNow.rokuCustomer != null)
+            if (midListNow.rokuCustomer != null )
             {
                 string brand = midListNow.rokuCustomer.brand;
                 Log.WriteInfoLog("Write Roku brand...");