Main.cs 97 KB

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