Main.cs 96 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998
  1. using CCWin;
  2. using Newtonsoft.Json;
  3. using Newtonsoft.Json.Linq;
  4. using SufeiUtil;
  5. using SXLibrary;
  6. using System;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Data.SQLite;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.IO.Ports;
  13. using System.Linq;
  14. using System.Net;
  15. using System.Threading;
  16. using System.Threading.Tasks;
  17. using System.Web.Configuration;
  18. using System.Windows.Forms;
  19. namespace MOKA_Factory_Tools
  20. {
  21. public delegate void MoveHandler(Point XY, ArrayList formlocationmsg, int num);
  22. public delegate void KeyDownHandler(ArrayList formlocationmsg, IntPtr intPtr);
  23. public partial class Main : Skin_Color
  24. {
  25. MidList midList1 = new MidList();
  26. UpgradeMsgList UpgradeMsgList1 = new UpgradeMsgList();
  27. MidAddress midAddress1 = new MidAddress();
  28. Config_ReadCheck cfg_readcheck = new Config_ReadCheck();
  29. Config_WriteCheck cfg_writecheck = new Config_WriteCheck();
  30. Config_WriteDone cfg_writedone = new Config_WriteDone();
  31. FunctionSetting functionSetting1 = new FunctionSetting();
  32. SQLiteConnection LocalDB = null;
  33. SQLiteConnection ErrorDB = null;
  34. SQLiteConnection ReportDB = null;
  35. Dictionary<string, string> ChannelMapList = new Dictionary<string, string>();
  36. Dictionary<string, string> LanguageMapList = new Dictionary<string, string>();
  37. List<KeyType> key2Write = null;
  38. string Custom_ProjectID = "";
  39. ArrayList formlocationmsg = new ArrayList();
  40. string ErrorDBPath = AppDomain.CurrentDomain.BaseDirectory + "\\Error.db";
  41. string ReportDBPath = AppDomain.CurrentDomain.BaseDirectory + "\\DB\\ReportData.db";
  42. Thread uploadbackground;
  43. bool LocalWrite = false;//离线抄写开关
  44. bool LocationMark = true;//操作窗体换行点
  45. int LocationNum = 0;//一行操作窗体数
  46. public event KeyDownHandler KeyDownEvent;
  47. public event MoveHandler MoveEvent;
  48. public Main(int enable)
  49. {
  50. InitializeComponent();
  51. LockSettingFunction(enable == 0 || enable == 3);
  52. CreateKeyManually.Visible = enable == 1;
  53. LocalWrite = enable == 3;
  54. }
  55. private void Form1_Load(object sender, EventArgs e)
  56. {
  57. uploadbackground = new Thread(UploadBackGround);
  58. uploadbackground.IsBackground = true;
  59. TVCOM.Items.AddRange(SerialPort.GetPortNames());
  60. LoadJsonConfig();
  61. this.StartPosition = FormStartPosition.Manual;
  62. this.Location = new Point(0, 0);
  63. this.Text = CommonMethod.FactoryName + " " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
  64. if (!File.Exists(ErrorDBPath))
  65. {
  66. if (SQLiteHelper.NewDbFile(ErrorDBPath))
  67. {
  68. SQLiteHelper.NewTable(ErrorDBPath, "ErrorReport", "(ID INTEGER PRIMARY KEY AUTOINCREMENT,url varchar,content varvhar,gener_date DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),report_date DATETIME)");
  69. SQLiteHelper.NewTable(ErrorDBPath, "CopyDelayReport", "(ID INTEGER PRIMARY KEY AUTOINCREMENT,bid varchar,url varchar,content varvhar,copy_date DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),report_date DATETIME)");
  70. SQLiteHelper.NewTable(ErrorDBPath, "ProductionCount", "(bid varchar,count varchar)");
  71. }
  72. }
  73. if (ErrorDB == null)
  74. {
  75. ErrorDB = new SQLiteConnection("data source=" + ErrorDBPath);
  76. ErrorDB.Open();
  77. }
  78. if (ReportDB == null)
  79. {
  80. ReportDB = new SQLiteConnection("data source=" + ReportDBPath);
  81. ReportDB.Open();
  82. }
  83. #region 研发账号
  84. if (CommonMethod.GetLoginAccout().Equals("RD", StringComparison.OrdinalIgnoreCase))
  85. {
  86. // 修改标题;
  87. this.Text = "研发抄写专用版";
  88. // 修改底色;
  89. this.CaptionBackColorTop = Color.AntiqueWhite;
  90. this.CaptionBackColorBottom = Color.Beige;
  91. this.BackColor = Color.AliceBlue;
  92. }
  93. #endregion
  94. }
  95. private void SetDSNLimit()
  96. {
  97. #region 试产订单,不需要自动限制条码;
  98. string strValue = CommonMethod.ReadProfileString("MOKAFactoryTools", "OrderType", "");
  99. if (strValue.Equals("TR", StringComparison.OrdinalIgnoreCase))
  100. {
  101. return;
  102. }
  103. #endregion
  104. // 如果抄写PSN,不自动赋值条码限制;
  105. if (BarcodeWrite.Checked)
  106. return;
  107. // 设置条码限制默认打上勾;
  108. if (midList1.keytype != null && !functionSetting1.MITVEnable && !functionSetting1.IndiaMITVEnable && midList1.keytype.ContainsKey("DSN"))
  109. {
  110. BarcodeLimit.Checked = true;
  111. BarCodeKeyCodeText.Text = OrderText.Text;
  112. }
  113. }
  114. private void OrderSubmit_Click(object sender, EventArgs e)
  115. {
  116. SQLiteHelper.DeleteOldData(ErrorDB);//删除30天以前已经上报的数据
  117. if (TestMode.serverurl == Serverurl.Testurl)
  118. {// 此软件连接测试服务器,请勿用于生产
  119. MessageBoxButtons messButton = MessageBoxButtons.YesNo;
  120. DialogResult dr = MessageBox.Show(LResource.TestServerUsingError, LResource.Error, messButton);
  121. if (dr == DialogResult.Yes)
  122. {
  123. //
  124. }
  125. else
  126. {
  127. return;
  128. }
  129. }
  130. if (TVCOM.SelectedItem == null)
  131. {
  132. MessageBox.Show(LResource.TVCOMNullError, LResource.Error);
  133. return;
  134. }
  135. if (OrderText.Text.Trim().Length == 0)
  136. {
  137. MessageBox.Show(LResource.OrderNullError, LResource.Error);
  138. return;
  139. }
  140. if (!SQLiteHelper.CheckProductionNum(ErrorDB, OrderText.Text.Trim()))
  141. {
  142. MessageBox.Show(LResource.CheckProductionNumError, LResource.Error);
  143. return;
  144. }
  145. if (timer1.Enabled == false)
  146. timer1.Start();
  147. OrderSubmit.Text = LResource.Waiting;
  148. SaveJsonConfig("LastOrder", OrderText.Text.ToString());
  149. functionSetting1.TVCOM = TVCOM.SelectedItem.ToString();
  150. functionSetting1.TVBaud = TVBaud.SelectedItem.ToString();
  151. functionSetting1.ChannelList = ChannelList.SelectedItem.ToString();
  152. functionSetting1.WriteChannel = WriteChannel.Checked;
  153. functionSetting1.WriteOSD = WriteOSD.Checked;
  154. functionSetting1.OSDList = OSDList.SelectedItem.ToString();
  155. functionSetting1.WriteSHOP = WriteSHOP.Checked;
  156. functionSetting1.SHOPList = SHOPList.SelectedItem.ToString();
  157. functionSetting1.WriteWB = WriteWB.Checked;
  158. functionSetting1.WBInit = WBInit.Checked;
  159. functionSetting1.WBPath = WBPath.Text;
  160. if (!LocalWrite)
  161. {
  162. if (Preload.Checked)
  163. {
  164. string dbPath = AppDomain.CurrentDomain.BaseDirectory + "\\Keys\\" + OrderText.Text.Trim() + ".db";
  165. if (File.Exists(dbPath))
  166. {
  167. if (LocalDB == null)
  168. {
  169. LocalDB = new SQLiteConnection("data source=" + dbPath);
  170. LocalDB.Open();
  171. }
  172. if (SQLiteHelper.WholeCheckDownloadStatus(LocalDB, OrderText.Text.Trim()))
  173. {
  174. try
  175. {
  176. if (SQLiteHelper.GetDBMidInfo(LocalDB, OrderText.Text.Trim(), out midAddress1))
  177. {
  178. if (UsinglocalIDCheck.Checked)
  179. {
  180. midAddress1.pid = Custom_ProjectID;
  181. MessageBox.Show(LResource.WilluseLocalPID, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  182. }
  183. else if (midAddress1.pid != Custom_ProjectID && Custom_ProjectID.Trim().Length > 0)
  184. {
  185. if (midAddress1.pid != null)
  186. if (midAddress1.pid.Trim().Length > 0)
  187. PID_Num.Value = Convert.ToDecimal(midAddress1.pid);
  188. MessageBox.Show(LResource.WilluseOnlinePID, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  189. }
  190. if (SQLiteHelper.GetrokuCustomer(LocalDB, OrderText.Text, out RokuCustomer rokuCustomer_1))
  191. {
  192. midList1.rokuCustomer = rokuCustomer_1;
  193. };
  194. if (SQLiteHelper.Getdsn(LocalDB, OrderText.Text, out string firetvdsn))
  195. {
  196. midList1.keytype = new Dictionary<string, string>();
  197. midList1.keytype.Add("DSN", firetvdsn);
  198. };
  199. if (SQLiteHelper.Getwhitebalance(LocalDB, OrderText.Text, out WhiteBalanceInfo whiteBalanceInfo_1))
  200. {
  201. functionSetting1.WBPath = dbPath;
  202. functionSetting1.WriteWB = true;
  203. functionSetting1.NormalRGB = new byte[3];
  204. functionSetting1.CoolRGB = new byte[3];
  205. functionSetting1.WarmRGB = new byte[3];
  206. functionSetting1.NormalRGB[0] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmirgain);
  207. functionSetting1.NormalRGB[1] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmiggain);
  208. functionSetting1.NormalRGB[2] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmibgain);
  209. functionSetting1.CoolRGB[0] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lrgain) + 256);
  210. functionSetting1.CoolRGB[1] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lggain) + 256);
  211. functionSetting1.CoolRGB[2] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lbgain) + 256);
  212. functionSetting1.WarmRGB[0] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nrgain) + 256);
  213. functionSetting1.WarmRGB[1] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nggain) + 256);
  214. functionSetting1.WarmRGB[2] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nbgain) + 256);
  215. };
  216. OperationPanel operationPanel1 = new OperationPanel(this, LocalDB, ErrorDB, midAddress1, functionSetting1, cfg_writecheck, cfg_readcheck, cfg_writedone, Preload.Checked, midList1, OrderText.Text.Trim());
  217. operationPanel1.StartPosition = FormStartPosition.Manual;
  218. if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width && LocationMark)
  219. {
  220. LocationMark = false;
  221. LocationNum = formlocationmsg.Count;
  222. }
  223. if (formlocationmsg.Count == 0)
  224. operationPanel1.Location = (Point)new Size(this.Right, this.Top);
  225. else if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width)
  226. {
  227. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  228. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * (formlocationmsg.Count - LocationNum), this.Top + operationPanel1.Size.Height);
  229. }
  230. else
  231. {
  232. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  233. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * formlocationmsg.Count, this.Top);
  234. }
  235. operationPanel1.DeleteIntptr += new OperationPanel.DisplayUpdateDelegate(DeleteIntptr);
  236. operationPanel1.SNKeyDownEven += new OperationPanel.SNKeyDown(SNKeyDownEven);
  237. IntPtr intPtr = operationPanel1.Handle;
  238. Dictionary<IntPtr, Point> part1 = new Dictionary<IntPtr, Point>();
  239. part1.Add(intPtr, (Point)new Size(operationPanel1.Right, operationPanel1.Top));
  240. formlocationmsg.Add(part1);
  241. operationPanel1.Show();
  242. }
  243. else
  244. {
  245. MessageBox.Show("Read LocalDB error,please delete old db file and download a new one");
  246. }
  247. }
  248. catch (Exception ex)
  249. {
  250. Log.WriteErrorLog(ex.Message);
  251. }
  252. // 是否有dsn要抄写;
  253. SetDSNLimit();
  254. }
  255. }
  256. else
  257. {
  258. // 预绑定模式下:没有db数据库时需要下载json包;
  259. if (V2Method.GetMidInfo(OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out midList1))
  260. {
  261. CommonMethod.SetCommonsData(functionSetting1, midList1);
  262. if (V2Method.GetOfflineData(midList1.host, OrderText.Text.Trim(), ErrorDB, out List<MidAddress> midAddress2))
  263. {
  264. WhiteBalanceList WhiteBalanceListNow;
  265. // 如果是抄写EDID,则不获取白平衡数据;
  266. if (CommonMethod.IsEDIDCopy(midList1))
  267. midList1.whiteType = "-1";
  268. #if DEBUG
  269. midList1.whiteType = "-1";
  270. #endif
  271. switch (midList1.whiteType)//订单白平衡预置状态
  272. {
  273. case "0"://旧订单,默认值
  274. {
  275. CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out WhiteBalanceListNow);
  276. break;
  277. }
  278. case "1"://未预置或预置LR数据
  279. {
  280. CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out WhiteBalanceListNow);
  281. if (WhiteBalanceListNow.whiteBalanceInfo == null)
  282. {
  283. MessageBox.Show("White balance info error, please contact factory engineer!");
  284. return;
  285. }
  286. break;
  287. }
  288. case "2"://已预置PR数据
  289. {
  290. CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out WhiteBalanceListNow);
  291. break;
  292. }
  293. default:
  294. {
  295. WhiteBalanceListNow = null;
  296. break;
  297. }
  298. }
  299. foreach (var midAddress1 in midAddress2)
  300. {
  301. string KeyPath = AppDomain.CurrentDomain.BaseDirectory + "\\download\\" + midAddress1.order + ".json";
  302. if (System.IO.File.Exists(KeyPath))
  303. {
  304. if (GetMD5.GetMD5HashFromFile(KeyPath) == midAddress1.pmd5)
  305. {
  306. if (SQLiteHelper.NewDbFile(dbPath))
  307. {
  308. SQLiteHelper.NewTable(dbPath, "keys", "(sn varchar,keys varvhar,copy_date DATETIME,report_date DATETIME)");
  309. SQLiteHelper.NewTable(dbPath, "mid", "(bid varchar,number varchar, pid varchar,ctype varvhar,version varvhar,host varchar,purl varvhar,psize varvhar,pmd5 varvhar,status varvhar,start_date DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')),finish_date DATETIME,desc varvhar)");
  310. SQLiteHelper.NewTable(dbPath, "report", "(url varchar,content varchar,gener_date DATETIME,report_date DATETIME)");
  311. SQLiteHelper.NewTable(dbPath, "rokuCustomer", "(ordernum varchar, data varchar)");
  312. SQLiteHelper.NewTable(dbPath, "whitebalance", "(ordernum varchar,hdmirgain varchar,hdmiggain varchar,hdmibgain varchar,nrgain varchar,nggain varchar,nbgain varchar,lrgain varchar,lggain varchar,lbgain varchar,updatetime DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')))");
  313. SQLiteHelper.NewTable(dbPath, "dsn", "(ordernum varchar,dsn varchar,updatetime DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')))");
  314. SQLiteHelper.AddOneLine(dbPath, new object[] { midAddress1.order, midAddress1.number, midAddress1.pid, midAddress1.ctype, midAddress1.version, midList1.host, midAddress1.purl, midAddress1.psize, midAddress1.pmd5, "1" });
  315. if (midList1.rokuCustomer != null)
  316. {
  317. SQLiteHelper.AddRokuOneLine(dbPath, new object[]{
  318. midList1.rokuCustomer.ordernum,
  319. JsonConvert.SerializeObject(midList1.rokuCustomer).ToString()
  320. });
  321. }
  322. if (WhiteBalanceListNow != null)
  323. if (WhiteBalanceListNow.whiteBalanceInfo != null)
  324. SQLiteHelper.AddwbOneLine(dbPath, new object[] {
  325. WhiteBalanceListNow.whiteBalanceInfo.ordernum,
  326. WhiteBalanceListNow.whiteBalanceInfo.hdmirgain,
  327. WhiteBalanceListNow.whiteBalanceInfo.hdmiggain,
  328. WhiteBalanceListNow.whiteBalanceInfo.hdmibgain,
  329. WhiteBalanceListNow.whiteBalanceInfo.nrgain,
  330. WhiteBalanceListNow.whiteBalanceInfo.nggain,
  331. WhiteBalanceListNow.whiteBalanceInfo.nbgain,
  332. WhiteBalanceListNow.whiteBalanceInfo.lrgain,
  333. WhiteBalanceListNow.whiteBalanceInfo.lggain,
  334. WhiteBalanceListNow.whiteBalanceInfo.lbgain
  335. });
  336. if (midList1.keytype.ContainsKey("DSN"))
  337. {
  338. SQLiteHelper.AdddsnOneLine(dbPath, new object[] { midAddress1.order, midList1.keytype["DSN"] });
  339. }
  340. SQLiteHelper.UpdateTime(dbPath, midAddress1.order);
  341. }
  342. if (File.Exists(dbPath))
  343. {
  344. List<object[]> keyDatas = new List<object[]>();
  345. using (System.IO.StreamReader file = System.IO.File.OpenText(KeyPath))
  346. {
  347. using (JsonTextReader reader = new JsonTextReader(file))
  348. {
  349. JArray o = (JArray)JToken.ReadFrom(reader);
  350. foreach (var ss in o) //查找某个字段与值
  351. {
  352. var sn = ((JObject)ss)["sn"];
  353. var data = ((JObject)ss)["key"];
  354. keyDatas.Add(new object[] { sn, data });
  355. }
  356. }
  357. }
  358. SQLiteHelper.InsertKeys(dbPath, keyDatas);
  359. }
  360. try
  361. {
  362. if (LocalDB == null)
  363. {
  364. LocalDB = new SQLiteConnection("data source=" + dbPath);
  365. LocalDB.Open();
  366. }
  367. OperationPanel operationPanel1 = new OperationPanel(this, LocalDB, ErrorDB, midAddress1, functionSetting1, cfg_writecheck, cfg_readcheck, cfg_writedone, Preload.Checked, midList1, OrderText.Text.Trim());
  368. operationPanel1.StartPosition = FormStartPosition.Manual;
  369. if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width && LocationMark)
  370. {
  371. LocationMark = false;
  372. LocationNum = formlocationmsg.Count;
  373. }
  374. if (formlocationmsg.Count == 0)
  375. operationPanel1.Location = (Point)new Size(this.Right, this.Top);
  376. else if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width)
  377. {
  378. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  379. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * (formlocationmsg.Count - LocationNum), this.Top + operationPanel1.Size.Height);
  380. }
  381. else
  382. {
  383. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  384. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * formlocationmsg.Count, this.Top);
  385. }
  386. operationPanel1.DeleteIntptr += new OperationPanel.DisplayUpdateDelegate(DeleteIntptr);
  387. operationPanel1.SNKeyDownEven += new OperationPanel.SNKeyDown(SNKeyDownEven);
  388. IntPtr intPtr = operationPanel1.Handle;
  389. Dictionary<IntPtr, Point> part1 = new Dictionary<IntPtr, Point>();
  390. part1.Add(intPtr, (Point)new Size(operationPanel1.Right, operationPanel1.Top));
  391. formlocationmsg.Add(part1);
  392. operationPanel1.Show();
  393. }
  394. catch (Exception ex)
  395. {
  396. Log.WriteErrorLog(ex.Message);
  397. }
  398. }
  399. else
  400. {
  401. Download DownloadPage = new Download(ErrorDB, midAddress1, -1, midList1, WhiteBalanceListNow);
  402. DownloadPage.ShowDialog();
  403. int gid = GC.GetGeneration(DownloadPage);
  404. DownloadPage = null;
  405. GC.Collect(gid);
  406. }
  407. }
  408. else
  409. {
  410. Download DownloadPage = new Download(ErrorDB, midAddress1, -1, midList1, WhiteBalanceListNow);
  411. DownloadPage.ShowDialog();
  412. int gid = GC.GetGeneration(DownloadPage);
  413. DownloadPage = null;
  414. GC.Collect(gid);
  415. }
  416. }
  417. if (File.Exists(dbPath))
  418. {
  419. if (LocalDB == null)
  420. {
  421. LocalDB = new SQLiteConnection("data source=" + dbPath);
  422. LocalDB.Open();
  423. }
  424. if (SQLiteHelper.WholeCheckDownloadStatus(LocalDB, OrderText.Text.Trim()))
  425. {
  426. if (V2Method.ReportDownloadStatus(midList1.host, OrderText.Text.Trim(), ErrorDB))
  427. MessageBox.Show(LResource.DownloadSuccess);
  428. else
  429. MessageBox.Show(LResource.DownloadReportFail);
  430. }
  431. }
  432. }
  433. else
  434. {
  435. MessageBox.Show(LResource.GetMidAdresserror);
  436. }
  437. }
  438. else
  439. {
  440. MessageBox.Show(LResource.GetMidInfoerror);
  441. }
  442. // 是否有dsn要抄写;
  443. SetDSNLimit();
  444. }
  445. }
  446. else
  447. {
  448. if (V2Method.GetMidInfo(OrderText.Text.Trim(), TestMode.MAC, ErrorDB, out midList1))
  449. {
  450. CommonMethod.SetCommonsData(functionSetting1, midList1);
  451. CommonMethod.CheckKeyType(midList1.keytype, cfg_writedone, out key2Write);
  452. OperationPanel.key2Write = key2Write;
  453. if (UsinglocalIDCheck.Checked)
  454. {
  455. midList1.projectid = Custom_ProjectID;
  456. MessageBox.Show(LResource.WilluseLocalPID, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  457. }
  458. else if (midList1.projectid != Custom_ProjectID && Custom_ProjectID.Trim().Length > 0)
  459. {
  460. if (midList1.projectid != null)
  461. if (midList1.projectid.Trim().Length > 0)
  462. PID_Num.Value = Convert.ToDecimal(midList1.projectid);
  463. MessageBox.Show(LResource.WilluseOnlinePID, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  464. }
  465. try
  466. {
  467. OperationPanel operationPanel1 = new OperationPanel(this, LocalDB, ErrorDB, midAddress1, functionSetting1, cfg_writecheck, cfg_readcheck, cfg_writedone, Preload.Checked, midList1, OrderText.Text.Trim());
  468. operationPanel1.StartPosition = FormStartPosition.Manual;
  469. if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width && LocationMark)
  470. {
  471. LocationMark = false;
  472. LocationNum = formlocationmsg.Count;
  473. }
  474. if (formlocationmsg.Count == 0)
  475. operationPanel1.Location = (Point)new Size(this.Right, this.Top);
  476. else if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width)
  477. {
  478. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  479. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * (formlocationmsg.Count - LocationNum), this.Top + operationPanel1.Size.Height);
  480. }
  481. else
  482. {
  483. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  484. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * formlocationmsg.Count, this.Top);
  485. }
  486. operationPanel1.DeleteIntptr += new OperationPanel.DisplayUpdateDelegate(DeleteIntptr);
  487. operationPanel1.SNKeyDownEven += new OperationPanel.SNKeyDown(SNKeyDownEven);
  488. IntPtr intPtr = operationPanel1.Handle;
  489. Dictionary<IntPtr, Point> part1 = new Dictionary<IntPtr, Point>();
  490. part1.Add(intPtr, (Point)new Size(operationPanel1.Right, operationPanel1.Top));
  491. formlocationmsg.Add(part1);
  492. operationPanel1.Show();
  493. }
  494. catch (Exception ex)
  495. {
  496. Log.WriteErrorLog(ex.Message);
  497. }
  498. // 是否有dsn要抄写;
  499. SetDSNLimit();
  500. }
  501. else
  502. {
  503. MessageBox.Show(LResource.GetMidInfoerror);
  504. }
  505. }
  506. }
  507. else
  508. {
  509. MessageBox.Show(LResource.LocalKeyMode);
  510. try
  511. {
  512. if (Preload.Checked)
  513. {
  514. string dbPath = AppDomain.CurrentDomain.BaseDirectory + "\\Keys\\" + OrderText.Text.Trim() + ".db";
  515. if (File.Exists(dbPath))
  516. {
  517. if (LocalDB == null)
  518. {
  519. LocalDB = new SQLiteConnection("data source=" + dbPath);
  520. LocalDB.Open();
  521. }
  522. if (SQLiteHelper.WholeCheckDownloadStatus(LocalDB, OrderText.Text.Trim()))
  523. {
  524. if (SQLiteHelper.GetDBMidInfo(LocalDB, OrderText.Text.Trim(), out midAddress1))
  525. {
  526. if (UsinglocalIDCheck.Checked)
  527. {
  528. midAddress1.pid = Custom_ProjectID;
  529. MessageBox.Show(LResource.WilluseLocalPID, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  530. }
  531. else if (midAddress1.pid != Custom_ProjectID && Custom_ProjectID.Trim().Length > 0)
  532. {
  533. if (midAddress1.pid != null)
  534. if (midAddress1.pid.Trim().Length > 0)
  535. PID_Num.Value = Convert.ToDecimal(midAddress1.pid);
  536. MessageBox.Show(LResource.WilluseOnlinePID, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  537. }
  538. midList1 = new MidList()
  539. {
  540. keytype = new Dictionary<string, string>(),
  541. clienttype = midAddress1.ctype,
  542. version = midAddress1.version,
  543. projectid = midAddress1.pid,
  544. host = "LocalPC"
  545. };
  546. if (SQLiteHelper.GetrokuCustomer(LocalDB, OrderText.Text, out RokuCustomer rokuCustomer_1))
  547. {
  548. midList1.rokuCustomer = rokuCustomer_1;
  549. };
  550. if (SQLiteHelper.Getdsn(LocalDB, OrderText.Text, out string firetvdsn))
  551. {
  552. midList1.keytype = new Dictionary<string, string>();
  553. midList1.keytype.Add("DSN", firetvdsn);
  554. };
  555. if (SQLiteHelper.Getwhitebalance(LocalDB, OrderText.Text, out WhiteBalanceInfo whiteBalanceInfo_1))
  556. {
  557. functionSetting1.WBPath = dbPath;
  558. functionSetting1.WriteWB = true;
  559. functionSetting1.NormalRGB = new byte[3];
  560. functionSetting1.CoolRGB = new byte[3];
  561. functionSetting1.WarmRGB = new byte[3];
  562. functionSetting1.NormalRGB[0] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmirgain);
  563. functionSetting1.NormalRGB[1] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmiggain);
  564. functionSetting1.NormalRGB[2] = (byte)Convert.ToDouble(whiteBalanceInfo_1.hdmibgain);
  565. functionSetting1.CoolRGB[0] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lrgain) + 256);
  566. functionSetting1.CoolRGB[1] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lggain) + 256);
  567. functionSetting1.CoolRGB[2] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.lbgain) + 256);
  568. functionSetting1.WarmRGB[0] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nrgain) + 256);
  569. functionSetting1.WarmRGB[1] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nggain) + 256);
  570. functionSetting1.WarmRGB[2] = (byte)(Convert.ToDouble(whiteBalanceInfo_1.nbgain) + 256);
  571. };
  572. }
  573. else
  574. {
  575. MessageBox.Show(LResource.FailtoReadLocalDB);
  576. return;
  577. }
  578. }
  579. else
  580. {
  581. MessageBox.Show(LResource.LocalDBIncomplete);
  582. return;
  583. }
  584. }
  585. else
  586. {
  587. MessageBox.Show(LResource.NofoundLocalDB);
  588. return;
  589. }
  590. }
  591. else
  592. {
  593. midList1 = new MidList()
  594. {
  595. keytype = new Dictionary<string, string>(),
  596. projectid = Custom_ProjectID,
  597. host = "LocalPC"
  598. };
  599. #region EDID离线模式;
  600. if (functionSetting1.edid_offline)
  601. {
  602. midList1.keytype.Add("edid_pid", functionSetting1.edid_pid);
  603. midList1.keytype.Add("edid_model_name", functionSetting1.edid_model_name);
  604. }
  605. #endregion
  606. }
  607. OperationPanel operationPanel1 = new OperationPanel(this, LocalDB, ErrorDB, null, functionSetting1, cfg_writecheck, cfg_readcheck, cfg_writedone, Preload.Checked, midList1, OrderText.Text.Trim());
  608. operationPanel1.StartPosition = FormStartPosition.Manual;
  609. if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width && LocationMark)
  610. {
  611. LocationMark = false;
  612. LocationNum = formlocationmsg.Count;
  613. }
  614. if (formlocationmsg.Count == 0)
  615. operationPanel1.Location = (Point)new Size(this.Right, this.Top);
  616. else if ((this.Right + operationPanel1.Size.Width * formlocationmsg.Count) > Screen.PrimaryScreen.Bounds.Width)
  617. {
  618. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  619. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * (formlocationmsg.Count - LocationNum), this.Top + operationPanel1.Size.Height);
  620. }
  621. else
  622. {
  623. Point point = ((Dictionary<IntPtr, Point>)formlocationmsg[formlocationmsg.Count - 1]).Last().Value;
  624. operationPanel1.Location = (Point)new Size(this.Right + operationPanel1.Size.Width * formlocationmsg.Count, this.Top);
  625. }
  626. operationPanel1.DeleteIntptr += new OperationPanel.DisplayUpdateDelegate(DeleteIntptr);
  627. operationPanel1.SNKeyDownEven += new OperationPanel.SNKeyDown(SNKeyDownEven);
  628. IntPtr intPtr = operationPanel1.Handle;
  629. Dictionary<IntPtr, Point> part1 = new Dictionary<IntPtr, Point>();
  630. part1.Add(intPtr, (Point)new Size(operationPanel1.Right, operationPanel1.Top));
  631. formlocationmsg.Add(part1);
  632. operationPanel1.Show();
  633. }
  634. catch
  635. {
  636. //
  637. }
  638. }
  639. OrderSubmit.Text = LResource.submitbutton;
  640. #if DEBUG
  641. #else
  642. LockSettingFunction(false);
  643. #endif
  644. if (!LocalWrite)
  645. {
  646. if (!uploadbackground.IsAlive)
  647. if (!Preload.Checked || LocalDB != null)
  648. uploadbackground.Start();
  649. }
  650. }
  651. /// <summary>
  652. /// 加载配置
  653. /// </summary>
  654. public void LoadJsonConfig()
  655. {
  656. StreamReader file = File.OpenText(LocalPath.localpath + "\\Config.json");
  657. using (JsonTextReader reader = new JsonTextReader(file))
  658. {
  659. JObject jObject = (JObject)JToken.ReadFrom(reader);
  660. reader.Close();
  661. var COM = jObject["COM"].Value<string>();
  662. var Baudrate = jObject["Baudrate"].Value<string>();
  663. var WriteChannelConfig = jObject["WriteChannel"].Value<string>();
  664. var ChannelSelect = jObject["ChannelSelect"].Value<string>();
  665. var WriteOSDLanguageConfig = jObject["WriteOSDLanguage"].Value<string>();
  666. var OSDLanguageSelect = jObject["OSDLanguageSelect"].Value<string>();
  667. var WriteSHOPLanguageConfig = jObject["WriteSHOPLanguage"].Value<string>();
  668. var SHOPLanguageSelect = jObject["SHOPLanguageSelect"].Value<string>();
  669. var WriteWhiteBalanceConfig = jObject["WriteWhiteBalance"].Value<string>();
  670. var WhiteBalanceInitConfig = jObject["WhiteBalanceInit"].Value<string>();
  671. var WhiteBalancePath = jObject["WhiteBalancePath"].Value<string>();
  672. var LastOrder = jObject["LastOrder"].Value<string>();
  673. var Preloadmode = jObject["Preload"].Value<string>();
  674. var UsingLocalPID = jObject["UsingLocalPID"].Value<string>();
  675. Custom_ProjectID = jObject["Custom_ProjectID"].Value<string>();
  676. functionSetting1.Wait_after_completion = jObject["Wait_after_completion"].Value<int>();
  677. functionSetting1.EnterFactoryRetry = jObject["EnterFactoryRetry"].Value<int>();
  678. functionSetting1.AllowNoScanning = jObject["AllowNoScanning"].Value<bool>();
  679. functionSetting1.ReportTimeOut = jObject["ReportTimeOut"].Value<int>();
  680. if (jObject["Parity"] == null)
  681. SaveJsonConfig("Parity", functionSetting1.TVParity);
  682. functionSetting1.TVParity = jObject["Parity"] != null ? jObject["Parity"].Value<int>() : 0;
  683. //本地离线抄写时key长度设置获取
  684. functionSetting1.LocalDidSize = jObject["LocalSize"]["DID"].Value<int>();
  685. functionSetting1.LocalMacSize = jObject["LocalSize"]["MAC"].Value<int>();
  686. functionSetting1.LocalHdcpSize = jObject["LocalSize"]["HDCP"].Value<int>();
  687. functionSetting1.LocalWidiSize = jObject["LocalSize"]["WIDI"].Value<int>();
  688. functionSetting1.LocalHdcp22Size = jObject["LocalSize"]["HDCP22"].Value<int>();
  689. functionSetting1.LocalEsnSize = jObject["LocalSize"]["ESN"].Value<int>();
  690. functionSetting1.LocalWidevineSize = jObject["LocalSize"]["WIDEVINE"].Value<int>();
  691. functionSetting1.LocalCiSize = jObject["LocalSize"]["CI"].Value<int>();
  692. functionSetting1.LocalMGKSize = jObject["LocalSize"]["MGK"].Value<int>();
  693. functionSetting1.LocalFairplaySize = jObject["LocalSize"]["Fairplay"] == null ? (CommonMethod.InsertJsonConfig("LocalSize", "Fairplay") ? -1 : 0) : jObject["LocalSize"]["Fairplay"].Value<int>();
  694. functionSetting1.LocalECPSize = jObject["LocalSize"]["ECP"] == null ? (CommonMethod.InsertJsonConfig("LocalSize", "ECP") ? -1 : 0) : jObject["LocalSize"]["ECP"].Value<int>();
  695. functionSetting1.LocalWifiMacSize = jObject["LocalSize"]["WifiMac"] == null ? (CommonMethod.InsertJsonConfig("LocalSize", "WifiMac") ? -1 : 0) : jObject["LocalSize"]["WifiMac"].Value<int>();
  696. functionSetting1.LocalBTMacSize = jObject["LocalSize"]["BTMac"] == null ? (CommonMethod.InsertJsonConfig("LocalSize", "BTMac") ? -1 : 0) : jObject["LocalSize"]["BTMac"].Value<int>();
  697. //本地DB离线抄写时是否不允许重复抄写
  698. functionSetting1.NoDoublewrite = jObject["NodoubleWrite"].Value<bool>();
  699. //条码限制
  700. functionSetting1.BarcodeLimit = jObject["BarcodeLimit"].Value<bool>();
  701. functionSetting1.BarcodeWrite = jObject["BarcodeWrite"] == null ? CommonMethod.AddJsonConfig("BarcodeWrite", false) : jObject["BarcodeWrite"].Value<bool>();
  702. functionSetting1.BarcodeLength = jObject["BarcodeLength"].Value<int>();
  703. functionSetting1.BarcodeKeyword = jObject["BarcodeKeyword"].Value<string>();
  704. //串口延迟
  705. //functionSetting1.SerailDelay = jObject["SerailDelay"].Value<int>(); // 名字不易理解,使用NextCommandWaitTime代替;
  706. //SerialCMD.SerialTimeout = jObject["SerialTimeout"].Value<int>(); // 名字不易理解,目前不再使用;
  707. // G客户防呆措施;
  708. functionSetting1.UsingGFoolProofing = jObject["UsingGFoolProofing"] == null ? false : jObject["UsingGFoolProofing"].Value<bool>();
  709. functionSetting1.GFoolProofingCount = jObject["GFoolProofingCount"] == null ? 2 : jObject["GFoolProofingCount"].Value<int>();
  710. functionSetting1.LeaveFactory = jObject["LeaveFactory"] == null ? false : jObject["LeaveFactory"].Value<bool>();
  711. functionSetting1.SNDoubleTips = jObject["SNDoubleTips"] == null ? false : jObject["SNDoubleTips"].Value<bool>();
  712. functionSetting1.EnableSanhuaMES = jObject["EnableSanhuaMES"] == null ? false : jObject["EnableSanhuaMES"].Value<bool>();
  713. #region 是否启用墨西哥抄写
  714. if (CommonMethod.GetLoginAccout().Equals("Mexico", StringComparison.OrdinalIgnoreCase) )
  715. {
  716. // NTF;
  717. if (jObject["Mexican_NTF"] == null)
  718. SaveJsonConfig("Mexican_NTF", functionSetting1.Mexican_NTF);
  719. else
  720. functionSetting1.Mexican_NTF = jObject["Mexican_NTF"].Value<bool>();
  721. GMethod.SetMexicanConfig(functionSetting1.Mexican_NTF);
  722. // IDM;
  723. if (jObject["Mexican_IDM"] == null)
  724. SaveJsonConfig("Mexican_IDM", functionSetting1.Mexican_IDM);
  725. else
  726. functionSetting1.Mexican_IDM = jObject["Mexican_IDM"].Value<bool>();
  727. if (functionSetting1.Mexican_IDM )
  728. V2Method.SetGetMessageUrl("http://10.138.96.32:81/IDManage/v1/order/getMessage");
  729. }
  730. #endregion
  731. // 导出日规acas与sn;
  732. if (jObject["ExportSNACASID"] == null)
  733. {
  734. SaveJsonConfig("ExportSNACASID", functionSetting1.ExportSNACASID);
  735. }
  736. else
  737. {
  738. functionSetting1.ExportSNACASID = jObject["ExportSNACASID"].Value<bool>();
  739. }
  740. // 获取ReadTimeout值;
  741. if (jObject["ReadTimeout"] == null)
  742. {
  743. SaveJsonConfig("ReadTimeout", SerialCMD.ReadTimeout);
  744. }
  745. else
  746. {
  747. functionSetting1.ReadTimeout = SerialCMD.ReadTimeout = jObject["ReadTimeout"].Value<int>();
  748. }
  749. // 获取NextCommandWaitTime值;
  750. if (jObject["NextCommandWaitTime"] == null)
  751. {
  752. SaveJsonConfig("NextCommandWaitTime", SerialCMD.NextCommandWaitTime);
  753. }
  754. else
  755. {
  756. functionSetting1.NextCommandWaitTime = SerialCMD.NextCommandWaitTime = jObject["NextCommandWaitTime"].Value<int>();
  757. }
  758. // 后台上报数据;
  759. if (jObject["BackgroudReportData"] == null)
  760. {
  761. SaveJsonConfig("BackgroudReportData", false);
  762. }
  763. else
  764. {
  765. functionSetting1.BackgroudReportData = jObject["BackgroudReportData"].Value<bool>();
  766. }
  767. #region EDID离线模式,使用offline账号登录;
  768. if (jObject["edid_offline"] == null)
  769. {
  770. SaveJsonConfig("edid_offline", functionSetting1.edid_offline);
  771. }
  772. else
  773. {
  774. functionSetting1.edid_offline = jObject["edid_offline"].Value<bool>();
  775. }
  776. if (jObject["edid_pid"] == null)
  777. {
  778. SaveJsonConfig("edid_pid", functionSetting1.edid_pid);
  779. }
  780. else
  781. {
  782. functionSetting1.edid_pid = jObject["edid_pid"].Value<string>();
  783. }
  784. if (jObject["edid_model_name"] == null)
  785. {
  786. SaveJsonConfig("edid_model_name", functionSetting1.edid_model_name);
  787. }
  788. else
  789. {
  790. functionSetting1.edid_model_name = jObject["edid_model_name"].Value<string>();
  791. }
  792. #endregion
  793. #region 波兰工厂DHA解决方案
  794. if (jObject["CheckDHAWaitTime"] == null)
  795. {
  796. SaveJsonConfig("CheckDHAWaitTime", functionSetting1.CheckDHAWaitTime);
  797. }
  798. else
  799. {
  800. functionSetting1.CheckDHAWaitTime = jObject["CheckDHAWaitTime"].Value<int>();
  801. }
  802. if (jObject["DHA"] == null)
  803. {
  804. SaveJsonConfig("DHA", functionSetting1.DHA);
  805. }
  806. else
  807. {
  808. functionSetting1.DHA = jObject["DHA"].Value<bool>();
  809. }
  810. #endregion
  811. #region G客户NTF功能;
  812. if ( jObject["NTF"] != null )
  813. {
  814. functionSetting1.NTF = jObject["NTF"].Value<bool>();
  815. if (functionSetting1.NTF == true)
  816. Log.WriteInfoLog("开启NTF功能");
  817. }
  818. else
  819. {
  820. SaveJsonConfig("NTF", false);
  821. }
  822. if (jObject["Line"] != null)
  823. {
  824. functionSetting1.Line = jObject["Line"].Value<string>();
  825. }
  826. else
  827. {
  828. SaveJsonConfig("Line", "");
  829. }
  830. #endregion
  831. #region 小米FireTV功能模块启用;
  832. if (jObject["MITVEnable"] != null)
  833. {
  834. functionSetting1.MITVEnable = jObject["MITVEnable"].Value<bool>();
  835. }
  836. else
  837. {
  838. SaveJsonConfig("MITVEnable", false);
  839. }
  840. // 获取key的url;
  841. if (jObject["MIKeyUrl"] != null)
  842. {
  843. functionSetting1.MIKeyUrl = jObject["MIKeyUrl"].Value<string>();
  844. }
  845. else
  846. {
  847. SaveJsonConfig("MIKeyUrl", functionSetting1.MIKeyUrl);
  848. }
  849. // 上报key的url;
  850. if (jObject["MIKeyReportUrl"] != null)
  851. {
  852. functionSetting1.MIKeyReportUrl = jObject["MIKeyReportUrl"].Value<string>();
  853. }
  854. else
  855. {
  856. SaveJsonConfig("MIKeyReportUrl", functionSetting1.MIKeyReportUrl);
  857. }
  858. if (jObject["IndiaMITVEnable"] != null)
  859. {
  860. functionSetting1.IndiaMITVEnable = jObject["IndiaMITVEnable"].Value<bool>();
  861. }
  862. else
  863. {
  864. SaveJsonConfig("IndiaMITVEnable", false);
  865. }
  866. // 变更接口地址;
  867. if (functionSetting1.IndiaMITVEnable)
  868. {
  869. functionSetting1.MIKeyUrl = "http://10.40.7.61:9006/api/SMESCustomer/GetXMCard";
  870. functionSetting1.MIKeyReportUrl = "http://10.40.7.61:9006/api/SMESCustomer/UploadXMDataControl";
  871. V2Method.SetGetMessageUrl("http://10.40.7.93:81/IDManage/v1/order/getMessage ");
  872. }
  873. #endregion
  874. #region 北美DSN的配置项使用SMES里面的
  875. if (jObject["UserDSNFromSmes"] == null)
  876. {
  877. SaveJsonConfig("UserDSNFromSmes", functionSetting1.UserDSNFromSmes);
  878. }
  879. else
  880. {
  881. functionSetting1.UserDSNFromSmes = jObject["UserDSNFromSmes"].Value<bool>();
  882. }
  883. #endregion
  884. #region 串口重试机制;
  885. if (jObject["EnableRetry"] != null)
  886. {
  887. functionSetting1.EnableRetry = jObject["EnableRetry"].Value<bool>();
  888. }
  889. else
  890. {
  891. SaveJsonConfig("EnableRetry", false);
  892. }
  893. if (jObject["RetryCount"] != null)
  894. {
  895. functionSetting1.RetryCount = jObject["RetryCount"].Value<int>();
  896. }
  897. else
  898. {
  899. SaveJsonConfig("RetryCount", 3);
  900. }
  901. #endregion
  902. #region 是否整机抄写
  903. if (jObject["IsSmt"] != null)
  904. {
  905. functionSetting1.IsSmt = jObject["IsSmt"].Value<string>();
  906. }
  907. else
  908. {
  909. SaveJsonConfig("IsSmt", functionSetting1.IsSmt);
  910. }
  911. #endregion
  912. foreach (var ss in jObject["Channel"]) //遍历Channel
  913. {
  914. Dictionary<string, string> ChannelValues = JsonConvert.DeserializeObject<Dictionary<string, string>>(ss.ToString());
  915. foreach (string key in ChannelValues.Keys)
  916. {
  917. ChannelMapList.Add(key, ChannelValues[key]);
  918. ChannelList.Items.Add(key);
  919. }
  920. }
  921. foreach (var ss in jObject["Language"]) //遍历Language
  922. {
  923. Dictionary<string, string> LanguageValues = JsonConvert.DeserializeObject<Dictionary<string, string>>(ss.ToString());
  924. foreach (string key in LanguageValues.Keys)
  925. {
  926. OSDList.Items.Add(key);
  927. SHOPList.Items.Add(key);
  928. LanguageMapList.Add(key, LanguageValues[key]);
  929. }
  930. }
  931. foreach (var ss in jObject["CustomCMD"]) //遍历自定义命令表
  932. {
  933. functionSetting1.CustomCMD = JsonConvert.DeserializeObject<Dictionary<string, string>>(ss.ToString());
  934. }
  935. #region ReadCheck配置读取
  936. cfg_readcheck.PIDReadcheck = jObject["ReadCheck"]["PID"].Value<bool>();
  937. cfg_readcheck.OSDReadcheck = jObject["ReadCheck"]["OSD"].Value<bool>();
  938. cfg_readcheck.SHOPReadcheck = jObject["ReadCheck"]["SHOP"].Value<bool>();
  939. cfg_readcheck.DIDReadcheck = jObject["ReadCheck"]["DID"].Value<bool>();
  940. cfg_readcheck.MacReadcheck = jObject["ReadCheck"]["MAC"].Value<bool>();
  941. cfg_readcheck.HDCPReadcheck = jObject["ReadCheck"]["HDCP"].Value<bool>();
  942. cfg_readcheck.HDCP22Readcheck = jObject["ReadCheck"]["HDCP22"].Value<bool>();
  943. cfg_readcheck.WidevineReadcheck = jObject["ReadCheck"]["WIDEVINE"].Value<bool>();
  944. cfg_readcheck.ESNReadcheck = jObject["ReadCheck"]["ESN"].Value<bool>();
  945. cfg_readcheck.CI_plusReadcheck = jObject["ReadCheck"]["CI"].Value<bool>();
  946. cfg_readcheck.AttestationReadcheck = jObject["ReadCheck"]["Attestation"].Value<bool>();
  947. cfg_readcheck.MGKReadcheck = jObject["ReadCheck"]["MGK"].Value<bool>();
  948. if(jObject["ReadCheck"]["Fairplay"] == null )
  949. {
  950. CommonMethod.InsertJsonConfig("ReadCheck", "Fairplay");
  951. cfg_readcheck.FairplayReadcheck = false;
  952. }
  953. else
  954. {
  955. cfg_readcheck.FairplayReadcheck = jObject["ReadCheck"]["Fairplay"].Value<bool>();
  956. }
  957. if(jObject["ReadCheck"]["ECP"] == null)
  958. {
  959. CommonMethod.InsertJsonConfig("ReadCheck", "ECP");
  960. cfg_readcheck.ECPReadcheck = false;
  961. }
  962. else
  963. {
  964. cfg_readcheck.ECPReadcheck = jObject["ReadCheck"]["ECP"].Value<bool>();
  965. }
  966. if(jObject["ReadCheck"]["WifiMac"] == null)
  967. {
  968. CommonMethod.InsertJsonConfig("ReadCheck", "WifiMac");
  969. cfg_readcheck.WifiMacReadcheck = false;
  970. }
  971. else
  972. {
  973. cfg_readcheck.WifiMacReadcheck = jObject["ReadCheck"]["WifiMac"].Value<bool>();
  974. }
  975. if(jObject["ReadCheck"]["BTMac"] == null)
  976. {
  977. CommonMethod.InsertJsonConfig("ReadCheck", "BTMac");
  978. cfg_readcheck.BTMacReadcheck = false;
  979. }
  980. else
  981. {
  982. cfg_readcheck.BTMacReadcheck = jObject["ReadCheck"]["BTMac"].Value<bool>();
  983. }
  984. if(jObject["ReadCheck"]["LEK"] == null)
  985. {
  986. CommonMethod.InsertJsonConfig("ReadCheck", "LEK");
  987. cfg_readcheck.LEKReadcheck = false;
  988. }
  989. else
  990. {
  991. cfg_readcheck.LEKReadcheck = jObject["ReadCheck"]["LEK"].Value<bool>();
  992. }
  993. if(jObject["ReadCheck"]["PEK"] == null)
  994. {
  995. CommonMethod.InsertJsonConfig("ReadCheck", "PEK");
  996. cfg_readcheck.PEKReadcheck = false;
  997. }
  998. else
  999. {
  1000. cfg_readcheck.PEKReadcheck = jObject["ReadCheck"]["PEK"].Value<bool>();
  1001. }
  1002. if(jObject["ReadCheck"]["Playready"] == null)
  1003. {
  1004. CommonMethod.InsertJsonConfig("ReadCheck", "Playready");
  1005. cfg_readcheck.PlayreadyReadcheck = false ;
  1006. }
  1007. else
  1008. {
  1009. cfg_readcheck.PlayreadyReadcheck = jObject["ReadCheck"]["Playready"].Value<bool>();
  1010. }
  1011. if (jObject["ReadCheck"]["Hash"] == null)
  1012. {
  1013. CommonMethod.InsertJsonConfig("ReadCheck", "Hash");
  1014. cfg_readcheck.HashReadcheck = false ;
  1015. }
  1016. else
  1017. {
  1018. cfg_readcheck.HashReadcheck = jObject["ReadCheck"]["Hash"].Value<bool>();
  1019. }
  1020. if(jObject["ReadCheck"]["DSN"] == null)
  1021. {
  1022. CommonMethod.InsertJsonConfig("ReadCheck", "DSN");
  1023. cfg_readcheck.DSNReadcheck = false;
  1024. }
  1025. else
  1026. {
  1027. cfg_readcheck.DSNReadcheck = jObject["ReadCheck"]["DSN"].Value<bool>();
  1028. }
  1029. if(jObject["ReadCheck"]["YouTube"] == null)
  1030. {
  1031. CommonMethod.InsertJsonConfig("ReadCheck", "YouTube");
  1032. cfg_readcheck.YouTubeReadcheck = false;
  1033. }
  1034. else
  1035. {
  1036. cfg_readcheck.YouTubeReadcheck = jObject["ReadCheck"]["YouTube"].Value<bool>();
  1037. }
  1038. if(jObject["ReadCheck"]["EDIDPID"] == null)
  1039. {
  1040. CommonMethod.InsertJsonConfig("ReadCheck", "EDIDPID");
  1041. cfg_readcheck.EDIDPIDReadcheck = false;
  1042. }
  1043. else
  1044. {
  1045. cfg_readcheck.EDIDPIDReadcheck = jObject["ReadCheck"]["EDIDPID"].Value<bool>();
  1046. }
  1047. if(jObject["ReadCheck"]["EDIDModeName"] == null)
  1048. {
  1049. CommonMethod.InsertJsonConfig("ReadCheck", "EDIDModeName");
  1050. cfg_readcheck.EDIDModeNameReadcheck = false;
  1051. }
  1052. else
  1053. {
  1054. cfg_readcheck.EDIDModeNameReadcheck = jObject["ReadCheck"]["EDIDModeName"].Value<bool>();
  1055. }
  1056. if(jObject["ReadCheck"]["ACASKey"] == null)
  1057. {
  1058. CommonMethod.InsertJsonConfig("ReadCheck", "ACASKey");
  1059. cfg_readcheck.ACASKeyReadcheck = false;
  1060. }
  1061. else
  1062. {
  1063. cfg_readcheck.ACASKeyReadcheck = jObject["ReadCheck"]["ACASKey"].Value<bool>();
  1064. }
  1065. if(jObject["ReadCheck"]["FVP"] == null)
  1066. {
  1067. CommonMethod.InsertJsonConfig("ReadCheck", "FVP");
  1068. cfg_readcheck.FVPReadcheck = false;
  1069. }
  1070. else
  1071. {
  1072. cfg_readcheck.FVPReadcheck = jObject["ReadCheck"]["FVP"].Value<bool>();
  1073. }
  1074. if (jObject["ReadCheck"]["DAK"] == null)
  1075. {
  1076. CommonMethod.InsertJsonConfig("ReadCheck", "DAK");
  1077. cfg_readcheck.DAKReadcheck = false;
  1078. }
  1079. else
  1080. {
  1081. cfg_readcheck.DAKReadcheck = jObject["ReadCheck"]["DAK"].Value<bool>();
  1082. }
  1083. if (jObject["ReadCheck"]["Dolby"] == null)
  1084. {
  1085. CommonMethod.InsertJsonConfig("ReadCheck", "Dolby");
  1086. cfg_readcheck.DolbyReadcheck = false;
  1087. }
  1088. else
  1089. {
  1090. cfg_readcheck.DolbyReadcheck=jObject["ReadCheck"]["Dolby"].Value<bool>();
  1091. }
  1092. if (jObject["ReadCheck"]["KFP"] == null)
  1093. {
  1094. CommonMethod.InsertJsonConfig("ReadCheck", "KFP");
  1095. cfg_readcheck.KFPReadcheck = false;
  1096. }
  1097. else
  1098. {
  1099. cfg_readcheck.KFPReadcheck = jObject["ReadCheck"]["KFP"].Value<bool>();
  1100. }
  1101. #endregion
  1102. #region WriteCheck配置读取
  1103. cfg_writecheck.DIDCheckcheck = jObject["WriteCheck"]["DID"].Value<bool>();
  1104. cfg_writecheck.MacCheckcheck = jObject["WriteCheck"]["MAC"].Value<bool>();
  1105. cfg_writecheck.HDCPCheckcheck = jObject["WriteCheck"]["HDCP"].Value<bool>();
  1106. cfg_writecheck.HDCP22Checkcheck = jObject["WriteCheck"]["HDCP22"].Value<bool>();
  1107. cfg_writecheck.WidevineCheckcheck = jObject["WriteCheck"]["WIDEVINE"].Value<bool>();
  1108. cfg_writecheck.ESNCheckcheck = jObject["WriteCheck"]["ESN"].Value<bool>();
  1109. cfg_writecheck.CI_plusCheckcheck = jObject["WriteCheck"]["CI"].Value<bool>();
  1110. cfg_writecheck.AttestationCheckcheck = jObject["WriteCheck"]["Attestation"].Value<bool>();
  1111. cfg_writecheck.MGKCheckcheck = jObject["WriteCheck"]["MGK"].Value<bool>();
  1112. if (jObject["WriteCheck"]["Fairplay"] == null)
  1113. {
  1114. CommonMethod.InsertJsonConfig("WriteCheck", "Fairplay");
  1115. cfg_writecheck.FairplayCheckcheck = false;
  1116. }
  1117. else
  1118. {
  1119. cfg_writecheck.FairplayCheckcheck = jObject["WriteCheck"]["Fairplay"].Value<bool>();
  1120. }
  1121. if (jObject["WriteCheck"]["ECP"] == null)
  1122. {
  1123. CommonMethod.InsertJsonConfig("WriteCheck", "ECP");
  1124. cfg_writecheck.ECPCheckcheck = false;
  1125. }
  1126. else
  1127. {
  1128. cfg_writecheck.ECPCheckcheck = jObject["WriteCheck"]["ECP"].Value<bool>();
  1129. }
  1130. if (jObject["WriteCheck"]["WifiMac"] == null)
  1131. {
  1132. CommonMethod.InsertJsonConfig("WriteCheck", "WifiMac");
  1133. cfg_writecheck.WifiMacCheckcheck = false;
  1134. }
  1135. else
  1136. {
  1137. cfg_writecheck.WifiMacCheckcheck = jObject["WriteCheck"]["WifiMac"].Value<bool>();
  1138. }
  1139. if (jObject["WriteCheck"]["BTMac"] == null)
  1140. {
  1141. CommonMethod.InsertJsonConfig("WriteCheck", "BTMac");
  1142. cfg_writecheck.BTMacCheckcheck = false;
  1143. }
  1144. else
  1145. {
  1146. cfg_writecheck.BTMacCheckcheck = jObject["WriteCheck"]["BTMac"].Value<bool>();
  1147. }
  1148. if (jObject["WriteCheck"]["LEK"] == null)
  1149. {
  1150. CommonMethod.InsertJsonConfig("WriteCheck", "LEK");
  1151. cfg_writecheck.LEKCheckcheck = false;
  1152. }
  1153. else
  1154. {
  1155. cfg_writecheck.LEKCheckcheck = jObject["WriteCheck"]["LEK"].Value<bool>();
  1156. }
  1157. if (jObject["WriteCheck"]["PEK"] == null)
  1158. {
  1159. CommonMethod.InsertJsonConfig("WriteCheck", "PEK");
  1160. cfg_writecheck.PEKCheckcheck = false;
  1161. }
  1162. else
  1163. {
  1164. cfg_writecheck.PEKCheckcheck = jObject["WriteCheck"]["PEK"].Value<bool>();
  1165. }
  1166. if (jObject["WriteCheck"]["Playready"] == null)
  1167. {
  1168. CommonMethod.InsertJsonConfig("WriteCheck", "Playready");
  1169. cfg_writecheck.PlayreadyCheckcheck = false;
  1170. }
  1171. else
  1172. {
  1173. cfg_writecheck.PlayreadyCheckcheck = jObject["WriteCheck"]["Playready"].Value<bool>();
  1174. }
  1175. if (jObject["WriteCheck"]["Hash"] == null)
  1176. {
  1177. CommonMethod.InsertJsonConfig("WriteCheck", "Hash");
  1178. cfg_writecheck.HashCheckcheck = false;
  1179. }
  1180. else
  1181. {
  1182. cfg_writecheck.HashCheckcheck = jObject["WriteCheck"]["Hash"].Value<bool>();
  1183. }
  1184. if (jObject["WriteCheck"]["DSN"] == null)
  1185. {
  1186. CommonMethod.InsertJsonConfig("WriteCheck", "DSN");
  1187. cfg_writecheck.DSNCheckcheck = false;
  1188. }
  1189. else
  1190. {
  1191. cfg_writecheck.DSNCheckcheck = jObject["WriteCheck"]["DSN"].Value<bool>();
  1192. }
  1193. if (jObject["WriteCheck"]["YouTube"] == null)
  1194. {
  1195. CommonMethod.InsertJsonConfig("WriteCheck", "YouTube");
  1196. cfg_writecheck.YouTubeCheckcheck = false;
  1197. }
  1198. else
  1199. {
  1200. cfg_writecheck.YouTubeCheckcheck = jObject["WriteCheck"]["YouTube"].Value<bool>();
  1201. }
  1202. if (jObject["WriteCheck"]["ACASKey"] == null)
  1203. {
  1204. CommonMethod.InsertJsonConfig("WriteCheck", "ACASKey");
  1205. cfg_writecheck.ACASKeyCheckcheck = false;
  1206. }
  1207. else
  1208. {
  1209. cfg_writecheck.ACASKeyCheckcheck = jObject["WriteCheck"]["ACASKey"].Value<bool>();
  1210. }
  1211. if (jObject["WriteCheck"]["FVP"] == null)
  1212. {
  1213. CommonMethod.InsertJsonConfig("WriteCheck", "FVP");
  1214. cfg_writecheck.FVPCheckcheck = false;
  1215. }
  1216. else
  1217. {
  1218. cfg_writecheck.FVPCheckcheck = jObject["WriteCheck"]["FVP"].Value<bool>();
  1219. }
  1220. if (jObject["WriteCheck"]["DAK"] == null)
  1221. {
  1222. CommonMethod.InsertJsonConfig("WriteCheck", "DAK");
  1223. cfg_writecheck.DAKCheckcheck = false;
  1224. }
  1225. else
  1226. {
  1227. cfg_writecheck.DAKCheckcheck = jObject["WriteCheck"]["DAK"].Value<bool>();
  1228. }
  1229. if (jObject["WriteCheck"]["Dolby"] == null)
  1230. {
  1231. CommonMethod.InsertJsonConfig("WriteCheck", "Dolby");
  1232. cfg_writecheck.DolbyCheckcheck = false;
  1233. }
  1234. else
  1235. {
  1236. cfg_writecheck.DolbyCheckcheck = jObject["WriteCheck"]["Dolby"].Value<bool>();
  1237. }
  1238. if (jObject["WriteCheck"]["KFP"] == null)
  1239. {
  1240. CommonMethod.InsertJsonConfig("WriteCheck", "KFP");
  1241. cfg_writecheck.KFPCheckcheck = false;
  1242. }
  1243. else
  1244. {
  1245. cfg_writecheck.KFPCheckcheck = jObject["WriteCheck"]["KFP"].Value<bool>();
  1246. }
  1247. #endregion
  1248. #region WriteDone配置读取
  1249. cfg_writedone.PIDWrite_YesNo = jObject["WriteDone"]["PID"].Value<bool>();
  1250. cfg_writedone.PIDWriteDelay = jObject["WriteDone"]["PIDWirteDelay"].Value<int>();
  1251. cfg_writedone.ClientTypeCheck_YesNo = jObject["WriteDone"]["ClientType"].Value<bool>();
  1252. cfg_writedone.SoftwareVersionCheck_YesNo = jObject["WriteDone"]["SoftwareVersion"].Value<bool>();
  1253. cfg_writedone.DIDWrite_YesNo = jObject["WriteDone"]["DID"].Value<bool>();
  1254. cfg_writedone.MacWrite_YesNo = jObject["WriteDone"]["MAC"].Value<bool>();
  1255. cfg_writedone.HDCPWrite_YesNo = jObject["WriteDone"]["HDCP"].Value<bool>();
  1256. cfg_writedone.HDCP22Write_YesNo = jObject["WriteDone"]["HDCP22"].Value<bool>();
  1257. cfg_writedone.WidevineWrite_YesNo = jObject["WriteDone"]["WIDEVINE"].Value<bool>();
  1258. cfg_writedone.ESNWrite_YesNo = jObject["WriteDone"]["ESN"].Value<bool>();
  1259. cfg_writedone.CI_plusWrite_YesNo = jObject["WriteDone"]["CI"].Value<bool>();
  1260. cfg_writedone.AttestationWrite_YesNo = jObject["WriteDone"]["Attestation"].Value<bool>();
  1261. cfg_writedone.MGKWrite_YesNo = jObject["WriteDone"]["MGK"].Value<bool>();
  1262. if (jObject["WriteDone"]["Fairplay"] == null)
  1263. {
  1264. CommonMethod.InsertJsonConfig("WriteDone", "Fairplay");
  1265. cfg_writedone.FairplayWrite_YesNo = false;
  1266. }
  1267. else
  1268. {
  1269. cfg_writedone.FairplayWrite_YesNo = jObject["WriteDone"]["Fairplay"].Value<bool>();
  1270. }
  1271. if (jObject["WriteDone"]["ECP"] == null)
  1272. {
  1273. CommonMethod.InsertJsonConfig("WriteDone", "ECP");
  1274. cfg_writedone.ECPWrite_YesNo = false;
  1275. }
  1276. else
  1277. {
  1278. cfg_writedone.ECPWrite_YesNo = jObject["WriteDone"]["ECP"].Value<bool>();
  1279. }
  1280. if (jObject["WriteDone"]["WifiMac"] == null)
  1281. {
  1282. CommonMethod.InsertJsonConfig("WriteDone", "WifiMac");
  1283. cfg_writedone.WifiMacWrite_YesNo = false;
  1284. }
  1285. else
  1286. {
  1287. jObject["WriteDone"]["WifiMac"].Value<bool>();
  1288. }
  1289. if (jObject["WriteDone"]["BTMac"] == null)
  1290. {
  1291. CommonMethod.InsertJsonConfig("WriteDone", "BTMac");
  1292. cfg_writedone.BTMacWrite_YesNo = false;
  1293. }
  1294. else
  1295. {
  1296. cfg_writedone.BTMacWrite_YesNo = jObject["WriteDone"]["BTMac"].Value<bool>();
  1297. }
  1298. if (jObject["WriteDone"]["LEK"] == null)
  1299. {
  1300. CommonMethod.InsertJsonConfig("WriteDone", "LEK");
  1301. cfg_writedone.LEKWrite_YesNo = false;
  1302. }
  1303. else
  1304. {
  1305. cfg_writedone.LEKWrite_YesNo = jObject["WriteDone"]["LEK"].Value<bool>();
  1306. }
  1307. if (jObject["WriteDone"]["PEK"] == null)
  1308. {
  1309. CommonMethod.InsertJsonConfig("WriteDone", "PEK");
  1310. cfg_writedone.PEKWrite_YesNo = false;
  1311. }
  1312. else
  1313. {
  1314. cfg_writedone.PEKWrite_YesNo = jObject["WriteDone"]["PEK"].Value<bool>();
  1315. }
  1316. if (jObject["WriteDone"]["Playready"] == null)
  1317. {
  1318. CommonMethod.InsertJsonConfig("WriteDone", "Playready");
  1319. cfg_writedone.PlayreadyWrite_YesNo = false;
  1320. }
  1321. else
  1322. {
  1323. cfg_writedone.PlayreadyWrite_YesNo = jObject["WriteDone"]["Playready"].Value<bool>();
  1324. }
  1325. if (jObject["WriteDone"]["Hash"] == null)
  1326. {
  1327. CommonMethod.InsertJsonConfig("WriteDone", "Hash");
  1328. cfg_writedone.HashWrite_YesNo = false;
  1329. }
  1330. else
  1331. {
  1332. cfg_writedone.HashWrite_YesNo = jObject["WriteDone"]["Hash"].Value<bool>();
  1333. }
  1334. if (jObject["WriteDone"]["DSN"] == null)
  1335. {
  1336. CommonMethod.InsertJsonConfig("WriteDone", "DSN");
  1337. cfg_writedone.DSNWrite_YesNo = false;
  1338. }
  1339. else
  1340. {
  1341. cfg_writedone.DSNWrite_YesNo = jObject["WriteDone"]["DSN"].Value<bool>();
  1342. }
  1343. if(jObject["WriteDone"]["AutoWhiteBalance"] == null)
  1344. {
  1345. CommonMethod.InsertJsonConfig("WriteDone", "AutoWhiteBalance");
  1346. cfg_writedone.AutoWhiteBalance = false;
  1347. }
  1348. else
  1349. {
  1350. cfg_writedone.AutoWhiteBalance = jObject["WriteDone"]["AutoWhiteBalance"].Value<bool>();
  1351. }
  1352. ///
  1353. if (jObject["WriteDone"]["YouTube"] == null)
  1354. {
  1355. CommonMethod.InsertJsonConfig("WriteDone", "YouTube");
  1356. cfg_writedone.YouTubeWrite_YesNo = false;
  1357. }
  1358. else
  1359. {
  1360. cfg_writedone.YouTubeWrite_YesNo = jObject["WriteDone"]["YouTube"].Value<bool>();
  1361. }
  1362. if (jObject["WriteDone"]["EDIDPID"] == null)
  1363. {
  1364. CommonMethod.InsertJsonConfig("WriteDone", "EDIDPID");
  1365. cfg_writedone.EDIDPIDWrite_YesNo = false;
  1366. }
  1367. else
  1368. {
  1369. cfg_writedone.EDIDPIDWrite_YesNo = jObject["WriteDone"]["EDIDPID"].Value<bool>();
  1370. }
  1371. if (jObject["WriteDone"]["EDIDModeName"] == null)
  1372. {
  1373. CommonMethod.InsertJsonConfig("WriteDone", "EDIDModeName");
  1374. cfg_writedone.EDIDModeNameWrite_YesNo = false;
  1375. }
  1376. else
  1377. {
  1378. cfg_writedone.EDIDModeNameWrite_YesNo = jObject["WriteDone"]["EDIDModeName"].Value<bool>();
  1379. }
  1380. if (jObject["WriteDone"]["ACASKey"] == null)
  1381. {
  1382. CommonMethod.InsertJsonConfig("WriteDone", "ACASKey");
  1383. cfg_writedone.ACASKeyWrite_YesNo = false;
  1384. }
  1385. else
  1386. {
  1387. cfg_writedone.ACASKeyWrite_YesNo = jObject["WriteDone"]["ACASKey"].Value<bool>();
  1388. }
  1389. if (jObject["WriteDone"]["FVP"] == null)
  1390. {
  1391. CommonMethod.InsertJsonConfig("WriteDone", "FVP");
  1392. cfg_writedone.FVPWrite_YesNo = false;
  1393. }
  1394. else
  1395. {
  1396. cfg_writedone.FVPWrite_YesNo = jObject["WriteDone"]["FVP"].Value<bool>();
  1397. }
  1398. if (jObject["WriteDone"]["DAK"] == null)
  1399. {
  1400. CommonMethod.InsertJsonConfig("WriteDone", "DAK");
  1401. cfg_writedone.DAKWrite_YesNo = false;
  1402. }
  1403. else
  1404. {
  1405. cfg_writedone.DAKWrite_YesNo = jObject["WriteDone"]["DAK"].Value<bool>();
  1406. }
  1407. if (jObject["WriteDone"]["Dolby"] == null)
  1408. {
  1409. CommonMethod.InsertJsonConfig("WriteDone", "Dolby");
  1410. cfg_writedone.DolbyWrite_YesNo = false;
  1411. }
  1412. else
  1413. {
  1414. cfg_writedone.DolbyWrite_YesNo = jObject["WriteDone"]["Dolby"].Value<bool>();
  1415. }
  1416. if (jObject["WriteDone"]["KFP"] == null)
  1417. {
  1418. CommonMethod.InsertJsonConfig("WriteDone", "KFP");
  1419. cfg_writedone.KFPWrite_YesNo = false;
  1420. }
  1421. else
  1422. {
  1423. cfg_writedone.KFPWrite_YesNo = jObject["WriteDone"]["KFP"].Value<bool>();
  1424. }
  1425. #endregion
  1426. file.Close();
  1427. if (Custom_ProjectID != null)
  1428. if (Custom_ProjectID.Trim().Length > 0)
  1429. PID_Num.Value = Convert.ToDecimal(Custom_ProjectID);
  1430. if (TVCOM.Items.Contains(COM))
  1431. TVCOM.SelectedItem = COM;
  1432. if (TVBaud.Items.Contains(Baudrate))
  1433. TVBaud.SelectedItem = Baudrate;
  1434. if (ChannelList.Items.Contains(ChannelSelect))
  1435. {
  1436. ChannelList.SelectedItem = ChannelSelect;
  1437. functionSetting1.ChannelCode = SerialInit.HexToByte(ChannelMapList[ChannelSelect]);
  1438. }
  1439. if (OSDList.Items.Contains(OSDLanguageSelect))
  1440. {
  1441. OSDList.SelectedItem = OSDLanguageSelect;
  1442. functionSetting1.OSDLCode = SerialInit.HexToByte(LanguageMapList[OSDLanguageSelect]);
  1443. }
  1444. if (SHOPList.Items.Contains(SHOPLanguageSelect))
  1445. {
  1446. SHOPList.SelectedItem = SHOPLanguageSelect;
  1447. functionSetting1.ShopLCode = SerialInit.HexToByte(LanguageMapList[SHOPLanguageSelect]);
  1448. }
  1449. BarcodeLimit.Checked = functionSetting1.BarcodeLimit;
  1450. BarcodeWrite.Checked = functionSetting1.BarcodeWrite;
  1451. BarCodeKeyCodeText.Text = functionSetting1.BarcodeKeyword;
  1452. BarCodeLengthText.Value = functionSetting1.BarcodeLength;
  1453. Preload.Checked = Preloadmode == "True";
  1454. WriteChannel.Checked = WriteChannelConfig == "True";
  1455. WriteOSD.Checked = WriteOSDLanguageConfig == "True";
  1456. WriteSHOP.Checked = WriteSHOPLanguageConfig == "True";
  1457. WBInit.Checked = WhiteBalanceInitConfig == "True";
  1458. UsinglocalIDCheck.Checked = UsingLocalPID == "True";
  1459. OrderText.Text = LastOrder;
  1460. if (File.Exists(WhiteBalancePath))
  1461. {
  1462. if (!LoadWBConfig(WhiteBalancePath))
  1463. {
  1464. MessageBox.Show(LResource.ReadWBError);
  1465. WriteWB.Checked = false;
  1466. }
  1467. else
  1468. {
  1469. WBPath.Text = WhiteBalancePath;
  1470. WriteWB.Checked = WriteWhiteBalanceConfig == "True";
  1471. }
  1472. }
  1473. else
  1474. WriteWB.Checked = false;
  1475. }
  1476. }
  1477. /// <summary>
  1478. /// 加载本地白平衡配置
  1479. /// </summary>
  1480. /// <param name="filepath"></param>
  1481. /// <returns></returns>
  1482. public bool LoadWBConfig(string filepath)
  1483. {
  1484. try
  1485. {
  1486. functionSetting1.NormalRGB = new byte[3];
  1487. functionSetting1.CoolRGB = new byte[3];
  1488. functionSetting1.WarmRGB = new byte[3];
  1489. functionSetting1.NormalRGB[0] = (byte)Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "HDMI white R:", null, filepath));
  1490. functionSetting1.NormalRGB[1] = (byte)Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "HDMI white G:", null, filepath));
  1491. functionSetting1.NormalRGB[2] = (byte)Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "HDMI white B:", null, filepath));
  1492. functionSetting1.CoolRGB[0] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Cool white R:", null, filepath)) + 256);
  1493. functionSetting1.CoolRGB[1] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Cool white G:", null, filepath)) + 256);
  1494. functionSetting1.CoolRGB[2] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Cool white B:", null, filepath)) + 256);
  1495. functionSetting1.WarmRGB[0] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Warm white R:", null, filepath)) + 256);
  1496. functionSetting1.WarmRGB[1] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Warm white G:", null, filepath)) + 256);
  1497. functionSetting1.WarmRGB[2] = (byte)(Convert.ToDouble(Iniconfig.OperateIniFile.ReadIniData("WBA value:", "Warm white B:", null, filepath)) + 256);
  1498. return true;
  1499. }
  1500. catch (Exception ex)
  1501. {
  1502. MessageBox.Show(ex.Message);
  1503. return false;
  1504. }
  1505. }
  1506. private void ChannelList_SelectedIndexChanged(object sender, EventArgs e)
  1507. {
  1508. string ChannelSelect = ChannelList.SelectedItem.ToString();
  1509. string channelcode = ChannelMapList[ChannelSelect];
  1510. functionSetting1.ChannelCode = SerialInit.HexToByte(channelcode);
  1511. SaveJsonConfig("ChannelSelect", ChannelSelect);
  1512. Log.WriteInfoLog("\r\nSet channel setting to " + ChannelSelect + "\r\nchannel code is " + channelcode);
  1513. }
  1514. private void OSDList_SelectedIndexChanged(object sender, EventArgs e)
  1515. {
  1516. string OSDLanguageSelect = OSDList.SelectedItem.ToString();
  1517. string OSDLcode = LanguageMapList[OSDLanguageSelect];
  1518. functionSetting1.OSDLCode = SerialInit.HexToByte(OSDLcode);
  1519. SaveJsonConfig("OSDLanguageSelect", OSDLanguageSelect);
  1520. Log.WriteInfoLog("\r\nSet channel setting to " + OSDLanguageSelect + "\r\nchannel code is " + OSDLcode);
  1521. }
  1522. private void SHOPList_SelectedIndexChanged(object sender, EventArgs e)
  1523. {
  1524. string SHOPLanguageSelect = SHOPList.SelectedItem.ToString();
  1525. string SHOPLcode = LanguageMapList[SHOPLanguageSelect];
  1526. functionSetting1.ShopLCode = SerialInit.HexToByte(SHOPLcode);
  1527. SaveJsonConfig("SHOPLanguageSelect", SHOPLanguageSelect);
  1528. Log.WriteInfoLog("\r\nSet channel setting to " + SHOPLanguageSelect + "\r\nchannel code is " + SHOPLcode);
  1529. }
  1530. private void skinButton1_Click(object sender, EventArgs e)
  1531. {
  1532. SaveJsonConfig("COM", "COM3");
  1533. string strFileName = null;
  1534. openFileDialog1.Filter = "WBConfig file|*.wba";
  1535. openFileDialog1.FileName = "";
  1536. openFileDialog1.Title = "Please select the WB config file";
  1537. if (openFileDialog1.ShowDialog() == DialogResult.OK)
  1538. {
  1539. strFileName = System.IO.Path.GetFullPath(openFileDialog1.FileName);
  1540. WBPath.Text = strFileName;
  1541. if (LoadWBConfig(strFileName))
  1542. {
  1543. functionSetting1.WBFileName = Path.GetFileName(openFileDialog1.FileName);
  1544. SaveJsonConfig("WhiteBalancePath", strFileName);
  1545. MessageBox.Show(LResource.LoadWBsuccess);
  1546. }
  1547. }
  1548. }
  1549. private void WriteWB_CheckedChanged(object sender, EventArgs e)
  1550. {
  1551. if (WriteWB.Checked == true)
  1552. {
  1553. if (WBPath.Text.Trim().Length > 0)
  1554. {
  1555. LoadWBConfig(WBPath.Text.Trim());
  1556. SaveJsonConfig("WriteWhiteBalance", true);
  1557. }
  1558. else
  1559. {
  1560. MessageBox.Show(LResource.SelectWBfirst);
  1561. WriteWB.Checked = false;
  1562. }
  1563. }
  1564. else
  1565. {
  1566. SaveJsonConfig("WriteWhiteBalance", false);
  1567. }
  1568. }
  1569. public void SaveJsonConfig(string node, object value)
  1570. {
  1571. StreamReader file = File.OpenText(LocalPath.localpath + "\\Config.json");
  1572. using (JsonTextReader reader = new JsonTextReader(file))
  1573. {
  1574. JObject jObject = (JObject)JToken.ReadFrom(reader);
  1575. jObject[node] = value.ToString();
  1576. file.Close();
  1577. using (StreamWriter writer = new StreamWriter(LocalPath.localpath + "\\Config.json"))
  1578. {
  1579. writer.Write(jObject.ToString()); //将JToken.ReadFrom(reader)的数据写入文件,这样的数据有空行。
  1580. }
  1581. }
  1582. }
  1583. private void WBInit_CheckedChanged(object sender, EventArgs e)
  1584. {
  1585. if (WBInit.Checked)
  1586. {
  1587. SaveJsonConfig("WhiteBalanceInit", true);
  1588. }
  1589. else
  1590. SaveJsonConfig("WhiteBalanceInit", false);
  1591. }
  1592. private void WriteChannel_CheckedChanged(object sender, EventArgs e)
  1593. {
  1594. if (WriteChannel.Checked)
  1595. {
  1596. SaveJsonConfig("WriteChannel", true);
  1597. }
  1598. else
  1599. SaveJsonConfig("WriteChannel", false);
  1600. }
  1601. private void WriteOSD_CheckedChanged(object sender, EventArgs e)
  1602. {
  1603. if (WriteOSD.Checked)
  1604. {
  1605. SaveJsonConfig("WriteOSDLanguage", true);
  1606. }
  1607. else
  1608. SaveJsonConfig("WriteOSDLanguage", false);
  1609. }
  1610. private void WriteSHOP_CheckedChanged(object sender, EventArgs e)
  1611. {
  1612. if (WriteSHOP.Checked)
  1613. {
  1614. SaveJsonConfig("WriteSHOPLanguage", true);
  1615. }
  1616. else
  1617. SaveJsonConfig("WriteSHOPLanguage", false);
  1618. }
  1619. private void TVCOM_SelectedIndexChanged(object sender, EventArgs e)
  1620. {
  1621. SaveJsonConfig("COM", TVCOM.SelectedItem.ToString());
  1622. }
  1623. private void TVBaud_SelectedIndexChanged(object sender, EventArgs e)
  1624. {
  1625. SaveJsonConfig("Baudrate", TVBaud.SelectedItem.ToString());
  1626. }
  1627. private void Form1_FormClosed(object sender, FormClosedEventArgs e)
  1628. {
  1629. Environment.Exit(0);
  1630. }
  1631. public void LockSettingFunction(bool locksetting)
  1632. {
  1633. ChannelList.Enabled = locksetting;
  1634. WriteOSD.Enabled = locksetting;
  1635. WriteSHOP.Enabled = locksetting;
  1636. WriteChannel.Enabled = locksetting;
  1637. OSDList.Enabled = locksetting;
  1638. SHOPList.Enabled = locksetting;
  1639. skinButton1.Enabled = locksetting;
  1640. WriteOSD.Enabled = locksetting;
  1641. WBInit.Enabled = locksetting;
  1642. WriteWB.Enabled = locksetting;
  1643. OrderText.Enabled = locksetting;
  1644. Preload.Enabled = locksetting;
  1645. PID_Num.Enabled = locksetting;
  1646. BarcodeLimit.Enabled = locksetting;
  1647. BarCodeLengthText.Enabled = locksetting;
  1648. BarCodeKeyCodeText.Enabled = locksetting;
  1649. }
  1650. private void TVCOM_MouseClick(object sender, MouseEventArgs e)
  1651. {
  1652. TVCOM.Items.Clear();
  1653. TVCOM.Items.AddRange(SerialPort.GetPortNames());
  1654. }
  1655. private void CreateKeyManually_Click(object sender, EventArgs e)
  1656. {
  1657. CreateDBManually CreateDBManually1 = new CreateDBManually(TestMode.serverurl, ErrorDB);
  1658. CreateDBManually1.ShowDialog();
  1659. }
  1660. private void Preload_CheckedChanged(object sender, EventArgs e)
  1661. {
  1662. SaveJsonConfig("Preload", Preload.Checked.ToString());
  1663. }
  1664. private void Form1_Move(object sender, EventArgs e)
  1665. {
  1666. if (this.MoveEvent != null)
  1667. {
  1668. Point XY = this.Location;
  1669. XY.X = this.Right;
  1670. XY.Y = this.Top;
  1671. this.MoveEvent(XY, formlocationmsg, LocationNum);
  1672. }
  1673. }
  1674. private void DeleteIntptr(IntPtr intPtr)
  1675. {
  1676. foreach (Dictionary<IntPtr, Point> pairs in formlocationmsg)
  1677. {
  1678. if (pairs.ContainsKey(intPtr))
  1679. {
  1680. formlocationmsg.Remove(pairs);
  1681. if (this.MoveEvent != null)
  1682. {
  1683. Point XY = this.Location;
  1684. XY.X = this.Right;
  1685. XY.Y = this.Top;
  1686. this.MoveEvent(XY, formlocationmsg, LocationNum);
  1687. }
  1688. break;
  1689. }
  1690. }
  1691. }
  1692. private void SNKeyDownEven(IntPtr intPtr)
  1693. {
  1694. this.KeyDownEvent(formlocationmsg, intPtr);
  1695. }
  1696. private void timer1_Tick(object sender, EventArgs e)
  1697. {
  1698. string count = SQLiteHelper.GetProductionNum(ErrorDB, OrderText.Text.Trim());
  1699. UpdateCountLabel(ProductionNum_Text, count);
  1700. }
  1701. /// <summary>
  1702. /// 刷新订单数量
  1703. /// </summary>
  1704. /// <param name="label"></param>
  1705. /// <param name="str"></param>
  1706. public void UpdateCountLabel(Label label, string str)
  1707. {
  1708. if (label.InvokeRequired)
  1709. {
  1710. BeginInvoke(new Action<string>(x => { label.Text = x.ToString(); }), str);
  1711. }
  1712. else
  1713. {
  1714. label.Text = str;
  1715. }
  1716. }
  1717. /// <summary>
  1718. /// 后台上报
  1719. /// </summary>
  1720. public void UploadBackGround()
  1721. {
  1722. while (true)
  1723. {
  1724. if (!CommonMethod.HTTPChecker(StructList.CheckServerConnectionUrl))
  1725. {
  1726. Thread.Sleep(20000);
  1727. continue;
  1728. }
  1729. try
  1730. {
  1731. string url;
  1732. string content;
  1733. string id;
  1734. if (SQLiteHelper.GetDelayReportData(ErrorDB, out url, out content, out id))
  1735. {
  1736. if (content.Contains("@"))
  1737. {
  1738. string[] data = content.Split('@');
  1739. if (V2Method.ReportOfflineData(url, data[1], data[0], LocalDB, ErrorDB, true, id))
  1740. {
  1741. SQLiteHelper.UpdateReportData(ErrorDB, "CopyDelayReport", "ID", id);
  1742. }
  1743. }
  1744. else if (V2Method.ReportOnlineData(url, OrderText.Text.Trim(), content, ErrorDB, true, id, functionSetting1.ReportTimeOut))
  1745. {
  1746. SQLiteHelper.UpdateReportData(ErrorDB, "CopyDelayReport", "ID", id);
  1747. }
  1748. }
  1749. }
  1750. catch (Exception ex)
  1751. {
  1752. Log.WriteErrorLog(ex.Message);
  1753. }
  1754. try
  1755. {
  1756. string url;
  1757. string content;
  1758. string id;
  1759. if (SQLiteHelper.GetErrorReportData(ErrorDB, out url, out content, out id))
  1760. {
  1761. bool mark = false;
  1762. if ( url.EndsWith("smes/RecordKey") )
  1763. {
  1764. GMethod.ReportDataBurningResultToMES(url, content, out mark);
  1765. }
  1766. else
  1767. {
  1768. CommonMethod.ReportErrormsg2(url, content, out mark);
  1769. }
  1770. if (mark)
  1771. {
  1772. SQLiteHelper.UpdateReportData(ErrorDB, "ErrorReport", "ID", id);
  1773. }
  1774. }
  1775. }
  1776. catch (Exception ex)
  1777. {
  1778. Log.WriteErrorLog(ex.Message);
  1779. }
  1780. try
  1781. {
  1782. string url;
  1783. string content;
  1784. string id;
  1785. if (SQLiteHelper.GetReportData(ReportDB, out id, out url, out content))
  1786. {
  1787. if ( V2Method.ReportOnlineDataSQL(url, content, 5000) )
  1788. {
  1789. // 删除该记录;
  1790. SQLiteCommand cmd = new SQLiteCommand();
  1791. cmd.Connection = ReportDB;
  1792. cmd.CommandText = string.Format("delete from ReportData where id = {0}", id);
  1793. cmd.ExecuteNonQuery();
  1794. cmd.Dispose();
  1795. }
  1796. }
  1797. }
  1798. catch (Exception ex)
  1799. {
  1800. Log.WriteErrorLog(ex.Message);
  1801. }
  1802. // 频率5秒一次;
  1803. Thread.Sleep(5000);
  1804. }
  1805. }
  1806. private void PID_Num_ValueChanged(object sender, EventArgs e)
  1807. {
  1808. Custom_ProjectID = PID_Num.Value.ToString();
  1809. SaveJsonConfig("Custom_ProjectID", Custom_ProjectID);
  1810. }
  1811. private void BarCodeLengthText_ValueChanged(object sender, EventArgs e)
  1812. {
  1813. functionSetting1.BarcodeLength = Convert.ToInt32(BarCodeLengthText.Value);
  1814. SaveJsonConfig("BarcodeLength", functionSetting1.BarcodeLength);
  1815. }
  1816. private void BarcodeLimit_CheckedChanged(object sender, EventArgs e)
  1817. {
  1818. functionSetting1.BarcodeLimit = BarcodeLimit.Checked;
  1819. SaveJsonConfig("BarcodeLimit", BarcodeLimit.Checked);
  1820. }
  1821. private void BarCodeKeyCodeText_TextChanged(object sender, EventArgs e)
  1822. {
  1823. functionSetting1.BarcodeKeyword = BarCodeKeyCodeText.Text;
  1824. SaveJsonConfig("BarcodeKeyword", BarCodeKeyCodeText.Text);
  1825. }
  1826. private void UsinglocalIDCheck_CheckedChanged(object sender, EventArgs e)
  1827. {
  1828. SaveJsonConfig("UsingLocalPID", UsinglocalIDCheck.Checked);
  1829. }
  1830. private void BarcodeWrite_CheckedChanged(object sender, EventArgs e)
  1831. {
  1832. functionSetting1.BarcodeWrite = BarcodeWrite.Checked;
  1833. SaveJsonConfig("BarcodeWrite", BarcodeWrite.Checked);
  1834. }
  1835. }
  1836. }