Explorar o código

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

JeffWang %!s(int64=2) %!d(string=hai) anos
pai
achega
7d1b166a88

+ 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

@@ -4234,8 +4234,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...");