OperationPanel.cs 277 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820
  1. using CCWin;
  2. using Newtonsoft.Json.Linq;
  3. using SufeiUtil;
  4. using SXLibrary;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.Data.SQLite;
  9. using System.Drawing;
  10. using System.IO;
  11. using System.IO.Ports;
  12. using System.Text;
  13. using System.Threading;
  14. using System.Windows.Forms;
  15. using System.Net;
  16. using System.Net.Sockets;
  17. using System.Linq;
  18. using System.Text.RegularExpressions;
  19. namespace MOKA_Factory_Tools
  20. {
  21. public partial class OperationPanel : Skin_Color
  22. {
  23. //白平衡URL
  24. MidList midListNow = new MidList();
  25. MidList localmidList = new MidList();
  26. MidAddress MidAddressNow = new MidAddress();
  27. FunctionSetting FunctionSettingNow = new FunctionSetting();
  28. WhiteBalanceList WhiteBalanceListNow = new WhiteBalanceList();
  29. WriteCheck writeCheckNow = new WriteCheck();
  30. ReadCheck readCheckNow = new ReadCheck();
  31. WriteDone writeDoneNow = new WriteDone();
  32. SerialPort TVPort = new SerialPort();
  33. SQLiteConnection localDBNow;
  34. SQLiteConnection errorDBNow;
  35. KeyInfo keyInfo = new KeyInfo();
  36. FireTVKey fireTVKey = new FireTVKey();
  37. bool preloadNow;
  38. string SN;
  39. string orderNow;
  40. Main mainform;
  41. int usingTime = 0;
  42. Thread SNTextFocus;
  43. bool FocusMark = false;
  44. Thread WritekeyThread;
  45. string availableCount = "unknow";
  46. //删除界面指针委托
  47. public delegate void DisplayUpdateDelegate(IntPtr intPtr);
  48.         //删除界面指针事件
  49.         public event DisplayUpdateDelegate DeleteIntptr;
  50. //扫描回车触发委托
  51. public delegate void SNKeyDown(IntPtr intPtr);
  52.         //扫描回车触发事件
  53.         public event SNKeyDown SNKeyDownEven;
  54. //自动key提取委托
  55. public delegate void AutoKeyRequireDelegate(IntPtr intPtr, string key, string keytype);
  56.         //自动key提取事件
  57.         public event AutoKeyRequireDelegate AutoKeyRequire;
  58. public OperationPanel(Main form1, SQLiteConnection localDB, SQLiteConnection errorDB, MidAddress midAddress1, FunctionSetting functionSetting, WriteCheck writeCheck1, ReadCheck readCheck1, WriteDone writeDone1, bool preload, MidList midList1, string order)
  59. {
  60. InitializeComponent();
  61. MidAddressNow = midAddress1;
  62. FunctionSettingNow = functionSetting;
  63. writeCheckNow = writeCheck1;
  64. readCheckNow = readCheck1;
  65. writeDoneNow = writeDone1;
  66. localDBNow = localDB;
  67. errorDBNow = errorDB;
  68. preloadNow = preload;
  69. midListNow = midList1;
  70. orderNow = order;
  71. InitPanel();
  72. mainform = form1;
  73. this.mainform.MoveEvent += new MoveHandler(SetFormLocation);
  74. this.mainform.KeyDownEvent += new KeyDownHandler(SetFocus);
  75. if (midListNow.rokuCustomer != null)
  76. ProductMsg_Text.Text = "Roku:";
  77. }
  78. /// <summary>
  79. /// 控制界面跟随主界面移动
  80. /// </summary>
  81. /// <param name="XY"></param>
  82. /// <param name="formlocationmsg"></param>
  83. /// <param name="num"></param>
  84. void SetFormLocation(Point XY, ArrayList formlocationmsg, int num)
  85. {
  86. foreach (Dictionary<IntPtr, Point> pairs in formlocationmsg)
  87. {
  88. if (!this.IsDisposed)
  89. {
  90. if (pairs.ContainsKey(this.Handle))
  91. {
  92. if (formlocationmsg.IndexOf(pairs) >= num && num > 0)
  93. {
  94. this.Left = XY.X + this.Size.Width * (formlocationmsg.IndexOf(pairs) - num);
  95. this.Top = XY.Y + this.Size.Height;
  96. }
  97. else
  98. {
  99. this.Left = XY.X + this.Size.Width * formlocationmsg.IndexOf(pairs);
  100. this.Top = XY.Y;
  101. }
  102. break;
  103. }
  104. }
  105. }
  106. }
  107. /// <summary>
  108. /// 按指针设置是否聚焦
  109. /// </summary>
  110. /// <param name="formlocationmsg"></param>
  111. /// <param name="intPtr"></param>
  112. void SetFocus(ArrayList formlocationmsg, IntPtr intPtr)
  113. {
  114. bool mark = false;
  115. bool mark2 = false;
  116. foreach (Dictionary<IntPtr, Point> pairs in formlocationmsg)
  117. {
  118. if (!this.IsDisposed)
  119. {
  120. if (pairs.ContainsKey(this.Handle) && formlocationmsg.IndexOf(pairs) == 0)
  121. {
  122. mark2 = true;
  123. }
  124. if (mark)
  125. {
  126. if (pairs.ContainsKey(this.Handle))
  127. FocusMark = true;
  128. else
  129. mark = false;
  130. }
  131. if (pairs.ContainsKey(intPtr))
  132. {
  133. if (formlocationmsg.IndexOf(pairs) == (formlocationmsg.Count - 1))
  134. {
  135. if (mark2)
  136. FocusMark = true;
  137. }
  138. mark = true;
  139. }
  140. }
  141. }
  142. }
  143. /// <summary>
  144. /// 界面控件初始化
  145. /// </summary>
  146. public void InitPanel()
  147. {
  148. COMText.Text = FunctionSettingNow.TVCOM;
  149. COMText.BackColor = Color.FromArgb(128, 255, 128);
  150. BaudText.Text = FunctionSettingNow.TVBaud;
  151. BaudText.BackColor = Color.FromArgb(128, 255, 128);
  152. WritePSN.Checked = FunctionSettingNow.BarcodeWrite;
  153. if (!writeCheckNow.DIDCheckcheck)
  154. SetspecificText(m_checkdid, LResource.Skip, Color.Yellow);
  155. if (!writeCheckNow.MacCheckcheck)
  156. SetspecificText(m_checkmac, LResource.Skip, Color.Yellow);
  157. if (!writeCheckNow.HDCPCheckcheck)
  158. SetspecificText(m_checkhdcp, LResource.Skip, Color.Yellow);
  159. if (!writeCheckNow.HDCP22Checkcheck)
  160. SetspecificText(m_checkhdcp22, LResource.Skip, Color.Yellow);
  161. if (!writeCheckNow.WiDiCheckcheck)
  162. SetspecificText(m_checkwidi, LResource.Skip, Color.Yellow);
  163. if (!writeCheckNow.WidevineCheckcheck)
  164. SetspecificText(m_checkwidevine, LResource.Skip, Color.Yellow);
  165. if (!writeCheckNow.ESNCheckcheck)
  166. SetspecificText(m_checkesn, LResource.Skip, Color.Yellow);
  167. if (!writeCheckNow.CI_plusCheckcheck)
  168. SetspecificText(m_checkci, LResource.Skip, Color.Yellow);
  169. if (!writeCheckNow.AttestationCheckcheck)
  170. SetspecificText(m_checkattestation, LResource.Skip, Color.Yellow);
  171. if (!writeCheckNow.MGKCheckcheck)
  172. SetspecificText(m_checkMGK, LResource.Skip, Color.Yellow);
  173. if (!writeCheckNow.FairplayCheckcheck)
  174. SetspecificText(m_checkFairplay, LResource.Skip, Color.Yellow);
  175. if (!writeCheckNow.ECPCheckcheck)
  176. SetspecificText(m_checkECP, LResource.Skip, Color.Yellow);
  177. if (!writeCheckNow.WifiMacCheckcheck)
  178. SetspecificText(m_checkWifiMac, LResource.Skip, Color.Yellow);
  179. if (!writeCheckNow.BTMacCheckcheck)
  180. SetspecificText(m_checkBTMac, LResource.Skip, Color.Yellow);
  181. if (!writeCheckNow.LEKCheckcheck)
  182. SetspecificText(m_checkLEK, LResource.Skip, Color.Yellow);
  183. if (!writeCheckNow.PEKCheckcheck)
  184. SetspecificText(m_checkPEK, LResource.Skip, Color.Yellow);
  185. if (!writeCheckNow.PlayreadyCheckcheck)
  186. SetspecificText(m_checkPlayready, LResource.Skip, Color.Yellow);
  187. if (!writeCheckNow.HashCheckcheck)
  188. SetspecificText(m_checkHash, LResource.Skip, Color.Yellow);
  189. if (!writeCheckNow.DSNCheckcheck)
  190. SetspecificText(m_checkDSN, LResource.Skip, Color.Yellow);
  191. if (!writeCheckNow.YouTubeCheckcheck)
  192. SetspecificText(m_checkYouTube, LResource.Skip, Color.Yellow);
  193. if (!writeCheckNow.ACASKeyCheckcheck)
  194. SetspecificText(m_checkACASKey, LResource.Skip, Color.Yellow);
  195. /////////////////////////////////////////////////////////////////
  196. if (!readCheckNow.PIDReadcheck)
  197. SetspecificText(ProjectIDNote, LResource.SkipReadCheck, Color.Yellow);
  198. if (!readCheckNow.DIDReadcheck)
  199. SetspecificText(m_readdid, LResource.Skip, Color.Yellow);
  200. if (!readCheckNow.MacReadcheck)
  201. SetspecificText(m_readmac, LResource.Skip, Color.Yellow);
  202. if (!readCheckNow.HDCPReadcheck)
  203. SetspecificText(m_readhdcp, LResource.Skip, Color.Yellow);
  204. if (!readCheckNow.HDCP22Readcheck)
  205. SetspecificText(m_readhdcp22, LResource.Skip, Color.Yellow);
  206. if (!readCheckNow.WiDiReadcheck)
  207. SetspecificText(m_readwidi, LResource.Skip, Color.Yellow);
  208. if (!readCheckNow.WidevineReadcheck)
  209. SetspecificText(m_readwidevine, LResource.Skip, Color.Yellow);
  210. if (!readCheckNow.ESNReadcheck)
  211. SetspecificText(m_readesn, LResource.Skip, Color.Yellow);
  212. if (!readCheckNow.CI_plusReadcheck)
  213. SetspecificText(m_readci, LResource.Skip, Color.Yellow);
  214. if (!readCheckNow.AttestationReadcheck)
  215. SetspecificText(m_readattestation, LResource.Skip, Color.Yellow);
  216. if (!readCheckNow.MGKReadcheck)
  217. SetspecificText(m_readMGK, LResource.Skip, Color.Yellow);
  218. if (!readCheckNow.FairplayReadcheck)
  219. SetspecificText(m_readFairplay, LResource.Skip, Color.Yellow);
  220. if (!readCheckNow.ECPReadcheck)
  221. SetspecificText(m_readECP, LResource.Skip, Color.Yellow);
  222. if (!readCheckNow.WifiMacReadcheck)
  223. SetspecificText(m_readWifiMac, LResource.Skip, Color.Yellow);
  224. if (!readCheckNow.BTMacReadcheck)
  225. SetspecificText(m_readBTMac, LResource.Skip, Color.Yellow);
  226. if (!readCheckNow.LEKReadcheck)
  227. SetspecificText(m_readLEK, LResource.Skip, Color.Yellow);
  228. if (!readCheckNow.PEKReadcheck)
  229. SetspecificText(m_readPEK, LResource.Skip, Color.Yellow);
  230. if (!readCheckNow.PlayreadyReadcheck)
  231. SetspecificText(m_readPlayready, LResource.Skip, Color.Yellow);
  232. if (!readCheckNow.HashReadcheck)
  233. SetspecificText(m_readHash, LResource.Skip, Color.Yellow);
  234. if (!readCheckNow.DSNReadcheck)
  235. SetspecificText(m_readDSN, LResource.Skip, Color.Yellow);
  236. if (!readCheckNow.SHOPReadcheck)
  237. SetspecificText(SHOPNote, LResource.SkipChecking, Color.Yellow);
  238. if (!readCheckNow.OSDReadcheck)
  239. SetspecificText(OSDNote, LResource.SkipChecking, Color.Yellow);
  240. if (!readCheckNow.YouTubeReadcheck)
  241. SetspecificText(m_readYouTube, LResource.SkipChecking, Color.Yellow);
  242. if (!readCheckNow.EDIDPIDReadcheck)
  243. SetspecificText(m_readEDIDPID, LResource.SkipChecking, Color.Yellow);
  244. if (!readCheckNow.EDIDModeNameReadcheck)
  245. SetspecificText(m_readEDIDName, LResource.SkipChecking, Color.Yellow);
  246. if (!readCheckNow.ACASKeyReadcheck)
  247. SetspecificText(m_readACASKey, LResource.SkipChecking, Color.Yellow);
  248. if (FunctionSettingNow.ExportSNACASID)
  249. SetspecificText(m_readACASID, LResource.SkipChecking, Color.Yellow);
  250. /////////////////////////////////////////////////////////////////
  251. if (!writeDoneNow.PIDWrite_YesNo)
  252. SetspecificText(ProjectIDNote, LResource.SkipCovering, Color.Yellow);
  253. if (!writeDoneNow.ClientTypeCheck_YesNo)
  254. SetspecificText(ClientTypeNote, LResource.SkipChecking, Color.Yellow);
  255. if (!writeDoneNow.SoftwareVersionCheck_YesNo)
  256. SetspecificText(SoftwareVersionNote, LResource.SkipChecking, Color.Yellow);
  257. if (!writeDoneNow.DIDWrite_YesNo)
  258. SetspecificText(m_writedid, LResource.Skip, Color.Yellow);
  259. if (!writeDoneNow.MacWrite_YesNo)
  260. SetspecificText(m_writemac, LResource.Skip, Color.Yellow);
  261. if (!writeDoneNow.HDCPWrite_YesNo)
  262. SetspecificText(m_writehdcp, LResource.Skip, Color.Yellow);
  263. if (!writeDoneNow.HDCP22Write_YesNo)
  264. SetspecificText(m_writehdcp22, LResource.Skip, Color.Yellow);
  265. if (!writeDoneNow.WiDiWrite_YesNo)
  266. SetspecificText(m_writewidi, LResource.Skip, Color.Yellow);
  267. if (!writeDoneNow.WidevineWrite_YesNo)
  268. SetspecificText(m_writewidevine, LResource.Skip, Color.Yellow);
  269. if (!writeDoneNow.ESNWrite_YesNo)
  270. SetspecificText(m_writeesn, LResource.Skip, Color.Yellow);
  271. if (!writeDoneNow.CI_plusWrite_YesNo)
  272. SetspecificText(m_writeci, LResource.Skip, Color.Yellow);
  273. if (!writeDoneNow.AttestationWrite_YesNo)
  274. SetspecificText(m_writeattestation, LResource.Skip, Color.Yellow);
  275. if (!writeDoneNow.MGKWrite_YesNo)
  276. SetspecificText(m_writeMGK, LResource.Skip, Color.Yellow);
  277. if (!writeDoneNow.FairplayWrite_YesNo)
  278. SetspecificText(m_writeFairplay, LResource.Skip, Color.Yellow);
  279. if (!writeDoneNow.ECPWrite_YesNo)
  280. SetspecificText(m_writeECP, LResource.Skip, Color.Yellow);
  281. if (!writeDoneNow.WifiMacWrite_YesNo)
  282. SetspecificText(m_writeWifiMac, LResource.Skip, Color.Yellow);
  283. if (!writeDoneNow.BTMacWrite_YesNo)
  284. SetspecificText(m_writeBTMac, LResource.Skip, Color.Yellow);
  285. if (!writeDoneNow.LEKWrite_YesNo)
  286. SetspecificText(m_writeLEK, LResource.Skip, Color.Yellow);
  287. if (!writeDoneNow.PEKWrite_YesNo)
  288. SetspecificText(m_writePEK, LResource.Skip, Color.Yellow);
  289. if (!writeDoneNow.PlayreadyWrite_YesNo)
  290. SetspecificText(m_writePlayready, LResource.Skip, Color.Yellow);
  291. if (!writeDoneNow.HashWrite_YesNo)
  292. SetspecificText(m_writeHash, LResource.Skip, Color.Yellow);
  293. if (!writeDoneNow.DSNWrite_YesNo)
  294. SetspecificText(m_writeDSN, LResource.Skip, Color.Yellow);
  295. if (!writeDoneNow.YouTubeWrite_YesNo)
  296. SetspecificText(m_writeYouTube, LResource.Skip, Color.Yellow);
  297. if (!writeDoneNow.EDIDPIDWrite_YesNo)
  298. SetspecificText(m_writeEDIDPID, LResource.Skip, Color.Yellow);
  299. if (!writeDoneNow.EDIDModeNameWrite_YesNo)
  300. SetspecificText(m_writeEDIDName, LResource.Skip, Color.Yellow);
  301. if (!writeDoneNow.ACASKeyWrite_YesNo)
  302. SetspecificText(m_writeACASKey, LResource.Skip, Color.Yellow);
  303. if (FunctionSettingNow.WriteChannel)
  304. ChannelText.Text = FunctionSettingNow.ChannelList;
  305. else
  306. {
  307. ChannelText.Text = LResource.Default;
  308. ChannelText.BackColor = Color.Yellow;
  309. }
  310. if (FunctionSettingNow.WriteOSD)
  311. OSDText.Text = FunctionSettingNow.OSDList;
  312. else
  313. {
  314. OSDText.Text = LResource.Default;
  315. OSDText.BackColor = Color.Yellow;
  316. }
  317. if (FunctionSettingNow.WriteSHOP)
  318. SHOPText.Text = FunctionSettingNow.SHOPList;
  319. else
  320. {
  321. SHOPText.Text = LResource.Default;
  322. SHOPText.BackColor = Color.Yellow;
  323. }
  324. if (midListNow.host != "LocalPC")
  325. {
  326. if ((!FunctionSettingNow.WriteWB) && (!writeDoneNow.AutoWhiteBalance))
  327. {
  328. WBPathText.Text = LResource.SkipAutoWB;
  329. WBPathText.BackColor = Color.Yellow;
  330. }
  331. else
  332. {
  333. // 如果是抄写EDID,则不获取白平衡数据;
  334. if (CommonMethod.IsEDIDCopy(midListNow))
  335. midListNow.whiteType = "-1";
  336. switch (midListNow.whiteType)//订单白平衡预置状态
  337. {
  338. case "0"://旧订单,默认值
  339. {
  340. if (CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, orderNow, TestMode.MAC, errorDBNow, out WhiteBalanceListNow))
  341. {
  342. if (WhiteBalanceListNow.whiteBalanceInfo != null)
  343. {
  344. if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "0")
  345. {
  346. if (FunctionSettingNow.WriteWB)
  347. {
  348. MessageBoxButtons messButton = MessageBoxButtons.YesNo;
  349. DialogResult dr = MessageBox.Show(LResource.HaveWBfromServer, LResource.Error, messButton);
  350. if (dr == DialogResult.Yes)
  351. {
  352. FunctionSettingNow.NormalRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmirgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmiggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmibgain) + 256) };
  353. FunctionSettingNow.CoolRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lbgain) + 256) };
  354. FunctionSettingNow.WarmRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nbgain) + 256) };
  355. WBPathText.Text = LResource.LoadFromServer;
  356. }
  357. else
  358. {
  359. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  360. }
  361. }
  362. else
  363. {
  364. MessageBox.Show(LResource.FindWBfromServer, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  365. FunctionSettingNow.WriteWB = true;
  366. FunctionSettingNow.NormalRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmirgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmiggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmibgain) + 256) };
  367. FunctionSettingNow.CoolRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lbgain) + 256) };
  368. FunctionSettingNow.WarmRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nbgain) + 256) };
  369. WBPathText.Text = LResource.LoadFromServer;
  370. }
  371. }
  372. else if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "1")
  373. {
  374. WBPathText.Text = LResource.WBExemptOrder;
  375. WBPathText.BackColor = Color.Yellow;
  376. }
  377. }
  378. else
  379. {
  380. if (FunctionSettingNow.WriteWB)
  381. {
  382. MessageBoxButtons messButton = MessageBoxButtons.YesNo;
  383. DialogResult dr = MessageBox.Show(LResource.HaveNoWBfromServer, LResource.Error, messButton);
  384. if (dr == DialogResult.OK)
  385. {
  386. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  387. }
  388. }
  389. else
  390. {
  391. WBPathText.Text = LResource.WBNull;
  392. WBPathText.BackColor = Color.Yellow;
  393. FunctionSettingNow.WriteWB = false;
  394. }
  395. }
  396. }
  397. else
  398. {
  399. MessageBox.Show(LResource.GetWBInfoFail);
  400. if (FunctionSettingNow.WriteWB)
  401. {
  402. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  403. }
  404. else
  405. {
  406. WBPathText.Text = LResource.WBNull;
  407. WBPathText.BackColor = Color.Yellow;
  408. }
  409. }
  410. break;
  411. }
  412. case "1"://未预置或预置LR数据
  413. {
  414. if (CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, orderNow, TestMode.MAC, errorDBNow, out WhiteBalanceListNow))
  415. {
  416. if (WhiteBalanceListNow.whiteBalanceInfo != null)
  417. {
  418. if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "0")//0是正常白平衡绑定订单,1是白平衡豁免订单
  419. {
  420. if (FunctionSettingNow.WriteWB)
  421. {
  422. MessageBoxButtons messButton = MessageBoxButtons.YesNo;
  423. DialogResult dr = MessageBox.Show(LResource.HaveWBfromServer, LResource.Error, messButton);
  424. if (dr == DialogResult.Yes)
  425. {
  426. FunctionSettingNow.NormalRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmirgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmiggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmibgain) + 256) };
  427. FunctionSettingNow.CoolRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lbgain) + 256) };
  428. FunctionSettingNow.WarmRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nbgain) + 256) };
  429. WBPathText.Text = LResource.LoadFromServer;
  430. }
  431. else
  432. {
  433. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  434. }
  435. }
  436. else
  437. {
  438. MessageBox.Show(LResource.FindWBfromServer, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  439. FunctionSettingNow.WriteWB = true;
  440. FunctionSettingNow.NormalRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmirgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmiggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmibgain) + 256) };
  441. FunctionSettingNow.CoolRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lbgain) + 256) };
  442. FunctionSettingNow.WarmRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nbgain) + 256) };
  443. WBPathText.Text = LResource.LoadFromServer;
  444. }
  445. }
  446. else if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "1")
  447. {
  448. WBPathText.Text = LResource.WBExemptOrder;
  449. WBPathText.BackColor = Color.Yellow;
  450. }
  451. }
  452. else
  453. {
  454. if (FunctionSettingNow.WriteWB)
  455. {
  456. MessageBoxButtons messButton = MessageBoxButtons.YesNo;
  457. DialogResult dr = MessageBox.Show(LResource.HaveNoWBfromServer, LResource.Error, messButton);
  458. if (dr == DialogResult.OK)
  459. {
  460. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  461. }
  462. }
  463. else
  464. {
  465. WBPathText.Text = LResource.WBNull;
  466. WBPathText.BackColor = Color.Yellow;
  467. FunctionSettingNow.WriteWB = false;
  468. }
  469. }
  470. }
  471. else
  472. {
  473. if (FunctionSettingNow.WriteWB)
  474. {
  475. MessageBox.Show(LResource.GetWBInfoFail);
  476. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  477. }
  478. else
  479. {
  480. MessageBox.Show(LResource.GetWBInfoFail2);
  481. this.Close();
  482. return;
  483. }
  484. }
  485. break;
  486. }
  487. case "2"://已预置PR数据
  488. {
  489. if (CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, orderNow, TestMode.MAC, errorDBNow, out WhiteBalanceListNow))
  490. {
  491. if (WhiteBalanceListNow.whiteBalanceInfo != null)
  492. {
  493. if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "0")
  494. {
  495. if (FunctionSettingNow.WriteWB)
  496. {
  497. MessageBoxButtons messButton = MessageBoxButtons.YesNo;
  498. DialogResult dr = MessageBox.Show(LResource.HaveWBfromServer, LResource.Error, messButton);
  499. if (dr == DialogResult.Yes)
  500. {
  501. FunctionSettingNow.NormalRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmirgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmiggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmibgain) + 256) };
  502. FunctionSettingNow.CoolRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lbgain) + 256) };
  503. FunctionSettingNow.WarmRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nbgain) + 256) };
  504. WBPathText.Text = LResource.LoadFromServer;
  505. }
  506. else
  507. {
  508. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  509. }
  510. }
  511. else
  512. {
  513. MessageBox.Show(LResource.FindWBfromServer, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  514. FunctionSettingNow.WriteWB = true;
  515. FunctionSettingNow.NormalRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmirgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmiggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.hdmibgain) + 256) };
  516. FunctionSettingNow.CoolRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.lbgain) + 256) };
  517. FunctionSettingNow.WarmRGB = new byte[3] { (byte)Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nrgain), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nggain) + 256), (byte)(Convert.ToDouble(WhiteBalanceListNow.whiteBalanceInfo.nbgain) + 256) };
  518. WBPathText.Text = LResource.LoadFromServer;
  519. }
  520. }
  521. else if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "1")
  522. {
  523. WBPathText.Text = LResource.WBExemptOrder;
  524. WBPathText.BackColor = Color.Yellow;
  525. }
  526. }
  527. else
  528. {
  529. if (FunctionSettingNow.WriteWB)
  530. {
  531. MessageBoxButtons messButton = MessageBoxButtons.YesNo;
  532. DialogResult dr = MessageBox.Show(LResource.HaveNoWBfromServer, LResource.Error, messButton);
  533. if (dr == DialogResult.OK)
  534. {
  535. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  536. }
  537. }
  538. else
  539. {
  540. WBPathText.Text = LResource.WBNull;
  541. WBPathText.BackColor = Color.Yellow;
  542. FunctionSettingNow.WriteWB = false;
  543. }
  544. }
  545. }
  546. else
  547. {
  548. MessageBox.Show(LResource.GetWBInfoFail);
  549. if (FunctionSettingNow.WriteWB)
  550. {
  551. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  552. }
  553. else
  554. {
  555. WBPathText.Text = LResource.WBNull;
  556. WBPathText.BackColor = Color.Yellow;
  557. }
  558. }
  559. break;
  560. }
  561. case "3"://已预置客户指定数据
  562. {
  563. if (FunctionSettingNow.WriteWB)
  564. {
  565. MessageBox.Show(LResource.PreloadCustomerWB);
  566. this.Close();
  567. return;
  568. }
  569. break;
  570. }
  571. }
  572. }
  573. }
  574. else
  575. {
  576. if (FunctionSettingNow.WriteWB)
  577. {
  578. WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
  579. }
  580. else
  581. {
  582. WBPathText.Text = LResource.WBNull;
  583. WBPathText.BackColor = Color.Yellow;
  584. }
  585. }
  586. try
  587. {
  588. TVPort.PortName = FunctionSettingNow.TVCOM;
  589. TVPort.BaudRate = Convert.ToInt32(FunctionSettingNow.TVBaud);
  590. TVPort.WriteBufferSize = 20480;
  591. TVPort.ReadBufferSize = 20480;
  592. TVPort.Open();
  593. }
  594. catch (Exception ex)
  595. {
  596. MessageBox.Show(ex.Message);
  597. this.Close();
  598. }
  599. this.Text = FunctionSettingNow.TVCOM;
  600. }
  601. private void OperationPanel_Load(object sender, EventArgs e)
  602. {
  603. if (midListNow.host == "LocalPC")
  604. {
  605. OrderText.Text = orderNow;
  606. ClientTypeText.Text = midListNow.clienttype;
  607. SVText.Text = midListNow.version;
  608. ProjectIDText.Text = midListNow.projectid;
  609. GetLocalKeysCount();
  610. }
  611. else if (!preloadNow)
  612. {
  613. OrderText.Text = orderNow;
  614. ClientTypeText.Text = midListNow.clienttype;
  615. SVText.Text = midListNow.version;
  616. ProjectIDText.Text = midListNow.projectid;
  617. UpdateKeys(midListNow.keytype, false);
  618. }
  619. else
  620. {
  621. OrderText.Text = MidAddressNow.order;
  622. ClientTypeText.Text = MidAddressNow.ctype;
  623. SVText.Text = MidAddressNow.version;
  624. ProjectIDText.Text = MidAddressNow.pid;
  625. }
  626. SNText.Text = "";
  627. SNTextFocus = new Thread(TextBoxFocus);
  628. SNTextFocus.Start();
  629. SNText.Focus();
  630. }
  631. /// <summary>
  632. /// 强制聚焦扫描框
  633. /// </summary>
  634. public void TextBoxFocus()
  635. {
  636. while (true)
  637. {
  638. if (FocusMark)
  639. {
  640. if (this.CaptionBackColorTop != Color.Yellow || this.CaptionBackColorBottom != Color.Orange)
  641. {
  642. if (this.InvokeRequired)
  643. {
  644. this.BeginInvoke(new Action(() =>
  645. {
  646. this.CaptionBackColorTop = Color.Yellow;
  647. this.CaptionBackColorBottom = Color.Orange;
  648. this.Refresh();
  649. }));
  650. }
  651. }
  652. if (SNText.InvokeRequired)
  653. {
  654. SNText.BeginInvoke(new Action(() =>
  655. {
  656. if (!SNText.Focus())
  657. {
  658. SNText.Focus();
  659. }
  660. }));
  661. }
  662. }
  663. Thread.Sleep(500);
  664. }
  665. }
  666. private void OperationPanel_FormClosing(object sender, FormClosingEventArgs e)
  667. {
  668. if (TVPort.IsOpen)
  669. TVPort.Close();
  670. DeleteIntptr(this.Handle);
  671. GC.Collect();
  672. }
  673. /// <summary>
  674. /// 扫描触发抄写,以回车终结触发
  675. /// </summary>
  676. /// <param name="sender"></param>
  677. /// <param name="e"></param>
  678. private void SNText_KeyDown(object sender, KeyEventArgs e)
  679. {
  680. if (e.KeyCode == Keys.Enter)
  681. {
  682. keyInfo = new KeyInfo();
  683. FocusMark = false;
  684. SNKeyDownEven(this.Handle);
  685. SetInitialStatus();
  686. SN = SNText.Text;
  687. SNText.Enabled = false;
  688. if (FunctionSettingNow.BarcodeLimit)
  689. {
  690. if (SN.Length != FunctionSettingNow.BarcodeLength || !SN.StartsWith(FunctionSettingNow.BarcodeKeyword))
  691. {
  692. MessageBox.Show(LResource.WrongBarcode + "\r\n" + SN);
  693. SNText.Enabled = true;
  694. SNText.Text = "";
  695. return;
  696. }
  697. if (!FunctionSettingNow.BarcodeWrite && (midListNow.keytype != null && midListNow.keytype.ContainsKey("DSN")))
  698. {
  699. // 如果不是全大写字母+数字,返回;
  700. Regex r = new Regex(@"^[A-Z0-9]+$");
  701. if (!r.Match(SN).Success)
  702. {
  703. MessageBox.Show(LResource.WrongBarcode + "\r\n" + SN);
  704. SNText.Enabled = true;
  705. SNText.Text = "";
  706. return;
  707. }
  708. }
  709. }
  710. // 是否启用G客户防呆措施;
  711. if (FunctionSettingNow.UsingGFoolProofing)
  712. {
  713. StringBuilder strValue = new StringBuilder(256);
  714. // 获取上一次的SN号;
  715. CommonMethod.GetProfileString("MOKAFactoryTools", "LastGSN", "", strValue, 256);
  716. if (strValue.ToString().Equals(SN, StringComparison.OrdinalIgnoreCase))
  717. {
  718. // 上次失败次数;
  719. int lastCount = 0;
  720. CommonMethod.GetProfileString("MOKAFactoryTools", "GFailCount", "0", strValue, 256);
  721. int.TryParse(strValue.ToString(), out lastCount);
  722. if (lastCount >= FunctionSettingNow.GFoolProofingCount)
  723. {
  724. MessageBox.Show(LResource.DefectiveProducts + "\r\n" + SN);
  725. SNText.Enabled = true;
  726. SNText.Text = "";
  727. return;
  728. }
  729. }
  730. else
  731. {
  732. CommonMethod.WriteProfileString("MOKAFactoryTools", "LastGSN", SN);
  733. // 重置失败次数为0;
  734. CommonMethod.WriteProfileString("MOKAFactoryTools", "GFailCount", "0");
  735. }
  736. }
  737. if (preloadNow)
  738. {
  739. bool copydone = false;
  740. string keyjson = SQLiteHelper.Getkeys(localDBNow, SNText.Text.Trim(), out copydone);
  741. if (FunctionSettingNow.NoDoublewrite && copydone)
  742. {
  743. MessageBox.Show(LResource.FindcopiedSN + SN);
  744. SNText.Enabled = true;
  745. SNText.Focus();
  746. }
  747. else if (keyjson.Length > 0)
  748. {
  749. JObject jObject = JObject.Parse(keyjson);
  750. keyInfo.DID = jObject["did"].Value<string>();
  751. keyInfo.Mac = jObject["mac"].Value<string>();
  752. keyInfo.HDCP = jObject["hdcp"].Value<string>();
  753. keyInfo.HDCP22 = jObject["hdcp22"].Value<string>();
  754. keyInfo.WiDi = jObject["widi"].Value<string>();
  755. keyInfo.Widevine = jObject["widevine"].Value<string>();
  756. keyInfo.ESN = jObject["esn"].Value<string>();
  757. keyInfo.CI_plus = jObject["cikey"].Value<string>();
  758. keyInfo.MGK = jObject["mgk"].Value<string>();
  759. keyInfo.Attestation = jObject["attestation"].Value<string>();
  760. keyInfo.Fairplay = jObject["fairplay"].Value<string>();
  761. keyInfo.ECP = jObject["ecp"].Value<string>();
  762. keyInfo.WiFi_MAC = jObject["wifimac"].Value<string>();
  763. keyInfo.BT_MAC = jObject["btmac"].Value<string>();
  764. keyInfo.LEK = jObject["lek"].Value<string>();
  765. keyInfo.PEK = jObject["pek"].Value<string>();
  766. keyInfo.Playready = jObject["playready"].Value<string>();
  767. keyInfo.Hashkey = jObject["hash"].Value<string>();
  768. keyInfo.YouTube_KEY = jObject["youtubekey"].Value<string>();
  769. keyInfo.ACASKey = jObject["acaskey"].Value<string>();
  770. WriteDID.Checked = (keyInfo.DID.Length > 0 && m_writedid.Text != LResource.Skip);
  771. if (WriteDID.Checked)
  772. Log.WriteGetKeyLog("\r\nLocal DB DeviceID=" + keyInfo.DID);
  773. WriteMac.Checked = (keyInfo.Mac.Length > 0 && m_writemac.Text != LResource.Skip);
  774. if (WriteMac.Checked)
  775. Log.WriteGetKeyLog("\r\nLocal DB Mac=" + keyInfo.Mac);
  776. WriteHDCP.Checked = (keyInfo.HDCP.Length > 0 && m_writehdcp.Text != LResource.Skip);
  777. if (WriteHDCP.Checked)
  778. Log.WriteGetKeyLog("\r\nLocal DB HDCP=" + keyInfo.HDCP);
  779. WriteHDCP22.Checked = (keyInfo.HDCP22.Length > 0 && m_writehdcp22.Text != LResource.Skip);
  780. if (WriteHDCP22.Checked)
  781. Log.WriteGetKeyLog("\r\nLocal DB HDCP22=" + keyInfo.HDCP22);
  782. WriteWiDi.Checked = (keyInfo.WiDi.Length > 0 && m_writewidi.Text != LResource.Skip);
  783. if (WriteWiDi.Checked)
  784. Log.WriteGetKeyLog("\r\nLocal DB WiDi=" + keyInfo.WiDi);
  785. WriteWidevine.Checked = (keyInfo.Widevine.Length > 0 && m_writewidevine.Text != LResource.Skip);
  786. if (WriteWidevine.Checked)
  787. Log.WriteGetKeyLog("\r\nLocal DB Widevine=" + keyInfo.Widevine);
  788. WriteESN.Checked = (keyInfo.ESN.Length > 0 && m_writeesn.Text != LResource.Skip);
  789. if (WriteESN.Checked)
  790. Log.WriteGetKeyLog("\r\nLocal DB ESN=" + keyInfo.ESN);
  791. WriteCiplus.Checked = (keyInfo.CI_plus.Length > 0 && m_writeci.Text != LResource.Skip);
  792. if (WriteCiplus.Checked)
  793. Log.WriteGetKeyLog("\r\nLocal DB Ci=" + keyInfo.CI_plus);
  794. WriteMGK.Checked = (keyInfo.MGK.Length > 0 && m_writeMGK.Text != LResource.Skip);
  795. if (WriteMGK.Checked)
  796. Log.WriteGetKeyLog("\r\nLocal DB MGK=" + keyInfo.MGK);
  797. WriteAttestation.Checked = (keyInfo.Attestation.Length > 0 && m_writeattestation.Text != LResource.Skip);
  798. if (WriteAttestation.Checked)
  799. Log.WriteGetKeyLog("\r\nLocal DB Attestation=" + keyInfo.Attestation);
  800. WriteFairplay.Checked = (keyInfo.Fairplay.Length > 0 && m_writeFairplay.Text != LResource.Skip);
  801. if (WriteFairplay.Checked)
  802. Log.WriteGetKeyLog("\r\nLocal DB Fairplay=" + keyInfo.Fairplay);
  803. WriteECP.Checked = (keyInfo.ECP.Length > 0 && m_writeECP.Text != LResource.Skip);
  804. if (WriteECP.Checked)
  805. Log.WriteGetKeyLog("\r\nLocal DB ECP=" + keyInfo.ECP);
  806. WriteWifiMac.Checked = (keyInfo.WiFi_MAC.Length > 0 && m_writeWifiMac.Text != LResource.Skip);
  807. if (WriteWifiMac.Checked)
  808. Log.WriteGetKeyLog("\r\nLocal DB WifiMac=" + keyInfo.WiFi_MAC);
  809. WriteBTMac.Checked = (keyInfo.BT_MAC.Length > 0 && m_writeBTMac.Text != LResource.Skip);
  810. if (WriteBTMac.Checked)
  811. Log.WriteGetKeyLog("\r\nLocal DB BTMac=" + keyInfo.BT_MAC);
  812. WriteLEK.Checked = (keyInfo.LEK.Length > 0 && m_writeLEK.Text != LResource.Skip);
  813. if (WriteLEK.Checked)
  814. Log.WriteGetKeyLog("\r\nLocal DB LEK=" + keyInfo.LEK);
  815. WritePEK.Checked = (keyInfo.PEK.Length > 0 && m_writePEK.Text != LResource.Skip);
  816. if (WritePEK.Checked)
  817. Log.WriteGetKeyLog("\r\nLocal DB PEK=" + keyInfo.PEK);
  818. WritePlayready.Checked = (keyInfo.Playready.Length > 0 && m_writePlayready.Text != LResource.Skip);
  819. if (WritePlayready.Checked)
  820. Log.WriteGetKeyLog("\r\nLocal DB Playready=" + keyInfo.Playready);
  821. WriteHash.Checked = (keyInfo.Hashkey.Length > 0 && m_writeHash.Text != LResource.Skip);
  822. if (WriteHash.Checked)
  823. Log.WriteGetKeyLog("\r\nLocal DB Hashkey=" + keyInfo.Hashkey);
  824. WriteYouTube.Checked = (keyInfo.YouTube_KEY.Length > 0 && m_writeYouTube.Text != LResource.Skip);
  825. if (WriteYouTube.Checked)
  826. Log.WriteGetKeyLog("\r\nLocal DB YouTube_KEY=" + keyInfo.YouTube_KEY);
  827. WriteACASKey.Checked = (keyInfo.ACASKey.Length > 0 && m_writeACASKey.Text != LResource.Skip);
  828. if (WriteACASKey.Checked)
  829. Log.WriteGetKeyLog("\r\nLocal DB ACAS_KEY=" + keyInfo.ACASKey);
  830. WriteDSN.Checked = midListNow.keytype == null ? false : midListNow.keytype.ContainsKey("DSN") && m_writeDSN.Text != LResource.Skip;
  831. WritePSN.Checked = FunctionSettingNow.BarcodeWrite;
  832. timer1.Start();
  833. Thread t = new Thread(Writekey);
  834. t.Start();
  835. }
  836. else
  837. {
  838. MessageBox.Show(LResource.FindNullSnInDB + SN);
  839. SNText.Enabled = true;
  840. SNText.Focus();
  841. }
  842. }
  843. else
  844. {
  845. Onlinemode();
  846. }
  847. SNText.Text = "";
  848. }
  849. }
  850. /// <summary>
  851. /// 设置成功状态显示
  852. /// </summary>
  853. /// <param name="label"></param>
  854. public void SetsuccessStatus(Label label)
  855. {
  856. if (label.InvokeRequired && label.Text != LResource.Skip)
  857. {
  858. //BeginInvoke(new Action<string>(x => { label.Text = x.ToString(); }), 参数);
  859. label.BeginInvoke(new Action(() => { label.Text = "OK"; label.BackColor = Color.FromArgb(128, 255, 128); }));
  860. }
  861. }
  862. /// <summary>
  863. /// 设置失败状态显示
  864. /// </summary>
  865. /// <param name="label"></param>
  866. public void SetfailStatus(Label label)
  867. {
  868. if (label.InvokeRequired)
  869. {
  870. label.BeginInvoke(new Action(() => { label.Text = "NG"; label.BackColor = Color.Red; }));
  871. }
  872. }
  873. /// <summary>
  874. /// 设置扫描框为输入状态
  875. /// </summary>
  876. /// <param name="textBox"></param>
  877. public void EnableText(TextBox textBox)
  878. {
  879. if (textBox.InvokeRequired)
  880. {
  881. textBox.BeginInvoke(new Action(() => { textBox.Enabled = true; textBox.Focus(); }));
  882. }
  883. else
  884. {
  885. textBox.Enabled = true;
  886. textBox.Focus();
  887. }
  888. }
  889. /// <summary>
  890. /// 设置按钮为可点击状态
  891. /// </summary>
  892. /// <param name="button"></param>
  893. public void EnableButton(Button button)
  894. {
  895. if (button.InvokeRequired)
  896. {
  897. button.BeginInvoke(new Action(() => { button.Enabled = true; }));
  898. }
  899. else
  900. button.Enabled = true;
  901. }
  902. /// <summary>
  903. /// 设置特殊的文本和颜色
  904. /// </summary>
  905. /// <param name="label">标签控件</param>
  906. /// <param name="str">需要显示的文本</param>
  907. /// <param name="color">需要设置的控件背景颜色</param>
  908. public void SetspecificText(Label label, string str, Color color)
  909. {
  910. if (label.InvokeRequired)
  911. {
  912. BeginInvoke(new Action<string>(x => { label.Text = x.ToString(); }), str);
  913. label.BeginInvoke(new Action(() => { label.BackColor = color; }));
  914. }
  915. else
  916. {
  917. label.Text = str;
  918. label.BackColor = color;
  919. }
  920. }
  921. /// <summary>
  922. /// 设置标签控件颜色
  923. /// </summary>
  924. /// <param name="label">标签控件对象</param>
  925. /// <param name="color">需要设置的标签背景颜色</param>
  926. public void SetcolorStatus(Label label, Color color)
  927. {
  928. if (label.InvokeRequired)
  929. {
  930. label.BeginInvoke(new Action(() => { label.BackColor = color; }));
  931. }
  932. }
  933. /// <summary>
  934. /// 跨线程关闭窗口
  935. /// </summary>
  936. /// <param name="label"></param>
  937. /// <param name="color"></param>
  938. public void Closeform()
  939. {
  940. if (this.InvokeRequired)
  941. {
  942. this.BeginInvoke(new Action(() => { this.Close(); }));
  943. }
  944. }
  945. /// <summary>
  946. /// 设置标签控件文本
  947. /// </summary>
  948. /// <param name="label">标签控件对象</param>
  949. /// <param name="color">需要设置的标签文本</param>
  950. public void SetTextStatus(Label label, string txt)
  951. {
  952. if (label.InvokeRequired)
  953. {
  954. label.BeginInvoke(new Action(() => { label.Text = txt; }));
  955. }
  956. else
  957. label.Text = txt;
  958. }
  959. /// <summary>
  960. /// 线程内&跨线程设置key数量显示控件
  961. /// </summary>
  962. /// <param name="label">数量提示控件</param>
  963. /// <param name="str">数量值</param>
  964. /// <param name="status">状态,0为正常,1为获取失败,2为数量不足</param>
  965. public void SetKeyCountStatus(Label label, string str, int status)
  966. {
  967. if (label.InvokeRequired)
  968. {
  969. BeginInvoke(new Action<string>(x => { label.Text = x.ToString(); }), str);
  970. switch (status)
  971. {
  972. case 0:
  973. label.BeginInvoke(new Action(() => { label.ForeColor = Color.Green; }));
  974. break;
  975. case 1:
  976. label.BeginInvoke(new Action(() => { label.BackColor = Color.Red; }));
  977. break;
  978. case 2:
  979. label.BeginInvoke(new Action(() => { label.ForeColor = Color.Red; }));
  980. break;
  981. }
  982. }
  983. else
  984. {
  985. label.Text = str;
  986. switch (status)
  987. {
  988. case 0:
  989. label.ForeColor = Color.Green; ;
  990. break;
  991. case 1:
  992. label.BackColor = Color.Red;
  993. break;
  994. case 2:
  995. label.ForeColor = Color.Red;
  996. break;
  997. }
  998. }
  999. }
  1000. /// <summary>
  1001. /// 线程内&跨线程设置checkbox控件的checked值
  1002. /// </summary>
  1003. /// <param name="checkBox">checkbox控件</param>
  1004. /// <param name="status">需要设置的布尔状态</param>
  1005. public void SetCheckboxStatus(CheckBox checkBox, bool status)
  1006. {
  1007. if (checkBox.InvokeRequired)
  1008. {
  1009. BeginInvoke(new Action<bool>(x => { checkBox.Checked = x; }), status);
  1010. }
  1011. else
  1012. {
  1013. checkBox.Checked = status;
  1014. }
  1015. }
  1016. /// <summary>
  1017. /// 重置控件状态,skip除外
  1018. /// </summary>
  1019. public void SetInitialStatus()
  1020. {
  1021. this.CaptionBackColorTop = Color.RoyalBlue;
  1022. this.CaptionBackColorBottom = Color.Cyan;
  1023. this.Refresh();
  1024. /////////////////////////////////////////////////////////////
  1025. /// Set Write;
  1026. if (m_writeci.Text != LResource.Skip)
  1027. {
  1028. m_writeci.Text = "Null";
  1029. m_writeci.BackColor = Color.Transparent;
  1030. }
  1031. if (m_writemac.Text != LResource.Skip)
  1032. {
  1033. m_writemac.Text = "Null";
  1034. m_writemac.BackColor = Color.Transparent;
  1035. }
  1036. if (m_writedid.Text != LResource.Skip)
  1037. {
  1038. m_writedid.Text = "Null";
  1039. m_writedid.BackColor = Color.Transparent;
  1040. }
  1041. if (m_writeesn.Text != LResource.Skip)
  1042. {
  1043. m_writeesn.Text = "Null";
  1044. m_writeesn.BackColor = Color.Transparent;
  1045. }
  1046. if (m_writewidi.Text != LResource.Skip)
  1047. {
  1048. m_writewidi.Text = "Null";
  1049. m_writewidi.BackColor = Color.Transparent;
  1050. }
  1051. if (m_writewidevine.Text != LResource.Skip)
  1052. {
  1053. m_writewidevine.Text = "Null";
  1054. m_writewidevine.BackColor = Color.Transparent;
  1055. }
  1056. if (m_writehdcp.Text != LResource.Skip)
  1057. {
  1058. m_writehdcp.Text = "Null";
  1059. m_writehdcp.BackColor = Color.Transparent;
  1060. }
  1061. if (m_writehdcp22.Text != LResource.Skip)
  1062. {
  1063. m_writehdcp22.Text = "Null";
  1064. m_writehdcp22.BackColor = Color.Transparent;
  1065. }
  1066. if (m_writeattestation.Text != LResource.Skip)
  1067. {
  1068. m_writeattestation.Text = "Null";
  1069. m_writeattestation.BackColor = Color.Transparent;
  1070. }
  1071. if (m_writeMGK.Text != LResource.Skip)
  1072. {
  1073. m_writeMGK.Text = "Null";
  1074. m_writeMGK.BackColor = Color.Transparent;
  1075. }
  1076. if (m_writeFairplay.Text != LResource.Skip)
  1077. {
  1078. m_writeFairplay.Text = "Null";
  1079. m_writeFairplay.BackColor = Color.Transparent;
  1080. }
  1081. if (m_writeECP.Text != LResource.Skip)
  1082. {
  1083. m_writeECP.Text = "Null";
  1084. m_writeECP.BackColor = Color.Transparent;
  1085. }
  1086. if (m_writeLEK.Text != LResource.Skip)
  1087. {
  1088. m_writeLEK.Text = "Null";
  1089. m_writeLEK.BackColor = Color.Transparent;
  1090. }
  1091. if (m_writePEK.Text != LResource.Skip)
  1092. {
  1093. m_writePEK.Text = "Null";
  1094. m_writePEK.BackColor = Color.Transparent;
  1095. }
  1096. if (m_writeHash.Text != LResource.Skip)
  1097. {
  1098. m_writeHash.Text = "Null";
  1099. m_writeHash.BackColor = Color.Transparent;
  1100. }
  1101. if (m_writeDSN.Text != LResource.Skip)
  1102. {
  1103. m_writeDSN.Text = "Null";
  1104. m_writeDSN.BackColor = Color.Transparent;
  1105. }
  1106. if (m_writeWifiMac.Text != LResource.Skip)
  1107. {
  1108. m_writeWifiMac.Text = "Null";
  1109. m_writeWifiMac.BackColor = Color.Transparent;
  1110. }
  1111. if (m_writeBTMac.Text != LResource.Skip)
  1112. {
  1113. m_writeBTMac.Text = "Null";
  1114. m_writeBTMac.BackColor = Color.Transparent;
  1115. }
  1116. if (m_writeDSN.Text != LResource.Skip)
  1117. {
  1118. m_writeDSN.Text = "Null";
  1119. m_writeDSN.BackColor = Color.Transparent;
  1120. }
  1121. if (m_writePlayready.Text != LResource.Skip)
  1122. {
  1123. m_writePlayready.Text = "Null";
  1124. m_writePlayready.BackColor = Color.Transparent;
  1125. }
  1126. if (m_writeYouTube.Text != LResource.Skip)
  1127. {
  1128. m_writeYouTube.Text = "Null";
  1129. m_writeYouTube.BackColor = Color.Transparent;
  1130. }
  1131. if (m_writePSN.Text != LResource.Skip)
  1132. {
  1133. m_writePSN.Text = "Null";
  1134. m_writePSN.BackColor = Color.Transparent;
  1135. }
  1136. if (m_writeACASKey.Text != LResource.Skip)
  1137. {
  1138. m_writeACASKey.Text = "Null";
  1139. m_writeACASKey.BackColor = Color.Transparent;
  1140. }
  1141. if (m_writeEDIDPID.Text != LResource.Skip)
  1142. {
  1143. m_writeEDIDPID.Text = "Null";
  1144. m_writeEDIDPID.BackColor = Color.Transparent;
  1145. }
  1146. if (m_writeEDIDName.Text != LResource.Skip)
  1147. {
  1148. m_writeEDIDName.Text = "Null";
  1149. m_writeEDIDName.BackColor = Color.Transparent;
  1150. }
  1151. /////////////////////////////////////////////////////////////
  1152. /// Write Check;
  1153. if (m_checkci.Text != LResource.Skip)
  1154. {
  1155. m_checkci.Text = "Null";
  1156. m_checkci.BackColor = Color.Transparent;
  1157. }
  1158. if (m_checkmac.Text != LResource.Skip)
  1159. {
  1160. m_checkmac.Text = "Null";
  1161. m_checkmac.BackColor = Color.Transparent;
  1162. }
  1163. if (m_checkdid.Text != LResource.Skip)
  1164. {
  1165. m_checkdid.Text = "Null";
  1166. m_checkdid.BackColor = Color.Transparent;
  1167. }
  1168. if (m_checkesn.Text != LResource.Skip)
  1169. {
  1170. m_checkesn.Text = "Null";
  1171. m_checkesn.BackColor = Color.Transparent;
  1172. }
  1173. if (m_checkwidi.Text != LResource.Skip)
  1174. {
  1175. m_checkwidi.Text = "Null";
  1176. m_checkwidi.BackColor = Color.Transparent;
  1177. }
  1178. if (m_checkwidevine.Text != LResource.Skip)
  1179. {
  1180. m_checkwidevine.Text = "Null";
  1181. m_checkwidevine.BackColor = Color.Transparent;
  1182. }
  1183. if (m_checkhdcp.Text != LResource.Skip)
  1184. {
  1185. m_checkhdcp.Text = "Null";
  1186. m_checkhdcp.BackColor = Color.Transparent;
  1187. }
  1188. if (m_checkhdcp22.Text != LResource.Skip)
  1189. {
  1190. m_checkhdcp22.Text = "Null";
  1191. m_checkhdcp22.BackColor = Color.Transparent;
  1192. }
  1193. if (m_checkattestation.Text != LResource.Skip)
  1194. {
  1195. m_checkattestation.Text = "Null";
  1196. m_checkattestation.BackColor = Color.Transparent;
  1197. }
  1198. if (m_checkMGK.Text != LResource.Skip)
  1199. {
  1200. m_checkMGK.Text = "Null";
  1201. m_checkMGK.BackColor = Color.Transparent;
  1202. }
  1203. if (m_checkFairplay.Text != LResource.Skip)
  1204. {
  1205. m_checkFairplay.Text = "Null";
  1206. m_checkFairplay.BackColor = Color.Transparent;
  1207. }
  1208. if (m_checkECP.Text != LResource.Skip)
  1209. {
  1210. m_checkECP.Text = "Null";
  1211. m_checkECP.BackColor = Color.Transparent;
  1212. }
  1213. if (m_checkLEK.Text != LResource.Skip)
  1214. {
  1215. m_checkLEK.Text = "Null";
  1216. m_checkLEK.BackColor = Color.Transparent;
  1217. }
  1218. if (m_checkPEK.Text != LResource.Skip)
  1219. {
  1220. m_checkPEK.Text = "Null";
  1221. m_checkPEK.BackColor = Color.Transparent;
  1222. }
  1223. if (m_checkHash.Text != LResource.Skip)
  1224. {
  1225. m_checkHash.Text = "Null";
  1226. m_checkHash.BackColor = Color.Transparent;
  1227. }
  1228. if (m_checkDSN.Text != LResource.Skip)
  1229. {
  1230. m_checkDSN.Text = "Null";
  1231. m_checkDSN.BackColor = Color.Transparent;
  1232. }
  1233. if (m_checkWifiMac.Text != LResource.Skip)
  1234. {
  1235. m_checkWifiMac.Text = "Null";
  1236. m_checkWifiMac.BackColor = Color.Transparent;
  1237. }
  1238. if (m_checkBTMac.Text != LResource.Skip)
  1239. {
  1240. m_checkBTMac.Text = "Null";
  1241. m_checkBTMac.BackColor = Color.Transparent;
  1242. }
  1243. if (m_checkDSN.Text != LResource.Skip)
  1244. {
  1245. m_checkDSN.Text = "Null";
  1246. m_checkDSN.BackColor = Color.Transparent;
  1247. }
  1248. if (m_checkPlayready.Text != LResource.Skip)
  1249. {
  1250. m_checkPlayready.Text = "Null";
  1251. m_checkPlayready.BackColor = Color.Transparent;
  1252. }
  1253. if (m_checkYouTube.Text != LResource.Skip)
  1254. {
  1255. m_checkYouTube.Text = "Null";
  1256. m_checkYouTube.BackColor = Color.Transparent;
  1257. }
  1258. /////////////////////////////////////////////////////////////
  1259. /// Read Check;
  1260. if (m_readci.Text != LResource.Skip)
  1261. {
  1262. m_readci.Text = "Null";
  1263. m_readci.BackColor = Color.Transparent;
  1264. }
  1265. if (m_readmac.Text != LResource.Skip)
  1266. {
  1267. m_readmac.Text = "Null";
  1268. m_readmac.BackColor = Color.Transparent;
  1269. }
  1270. if (m_readdid.Text != LResource.Skip)
  1271. {
  1272. m_readdid.Text = "Null";
  1273. m_readdid.BackColor = Color.Transparent;
  1274. }
  1275. if (m_readesn.Text != LResource.Skip)
  1276. {
  1277. m_readesn.Text = "Null";
  1278. m_readesn.BackColor = Color.Transparent;
  1279. }
  1280. if (m_readwidi.Text != LResource.Skip)
  1281. {
  1282. m_readwidi.Text = "Null";
  1283. m_readwidi.BackColor = Color.Transparent;
  1284. }
  1285. if (m_readwidevine.Text != LResource.Skip)
  1286. {
  1287. m_readwidevine.Text = "Null";
  1288. m_readwidevine.BackColor = Color.Transparent;
  1289. }
  1290. if (m_readhdcp.Text != LResource.Skip)
  1291. {
  1292. m_readhdcp.Text = "Null";
  1293. m_readhdcp.BackColor = Color.Transparent;
  1294. }
  1295. if (m_readhdcp22.Text != LResource.Skip)
  1296. {
  1297. m_readhdcp22.Text = "Null";
  1298. m_readhdcp22.BackColor = Color.Transparent;
  1299. }
  1300. if (m_readattestation.Text != LResource.Skip)
  1301. {
  1302. m_readattestation.Text = "Null";
  1303. m_readattestation.BackColor = Color.Transparent;
  1304. }
  1305. if (m_readMGK.Text != LResource.Skip)
  1306. {
  1307. m_readMGK.Text = "Null";
  1308. m_readMGK.BackColor = Color.Transparent;
  1309. }
  1310. if (m_readFairplay.Text != LResource.Skip)
  1311. {
  1312. m_readFairplay.Text = "Null";
  1313. m_readFairplay.BackColor = Color.Transparent;
  1314. }
  1315. if (m_readECP.Text != LResource.Skip)
  1316. {
  1317. m_readECP.Text = "Null";
  1318. m_readECP.BackColor = Color.Transparent;
  1319. }
  1320. if (m_readLEK.Text != LResource.Skip)
  1321. {
  1322. m_readLEK.Text = "Null";
  1323. m_readLEK.BackColor = Color.Transparent;
  1324. }
  1325. if (m_readPEK.Text != LResource.Skip)
  1326. {
  1327. m_readPEK.Text = "Null";
  1328. m_readPEK.BackColor = Color.Transparent;
  1329. }
  1330. if (m_readHash.Text != LResource.Skip)
  1331. {
  1332. m_readHash.Text = "Null";
  1333. m_readHash.BackColor = Color.Transparent;
  1334. }
  1335. if (m_readDSN.Text != LResource.Skip)
  1336. {
  1337. m_readDSN.Text = "Null";
  1338. m_readDSN.BackColor = Color.Transparent;
  1339. }
  1340. if (m_readWifiMac.Text != LResource.Skip)
  1341. {
  1342. m_readWifiMac.Text = "Null";
  1343. m_readWifiMac.BackColor = Color.Transparent;
  1344. }
  1345. if (m_readBTMac.Text != LResource.Skip)
  1346. {
  1347. m_readBTMac.Text = "Null";
  1348. m_readBTMac.BackColor = Color.Transparent;
  1349. }
  1350. if (m_readDSN.Text != LResource.Skip)
  1351. {
  1352. m_readDSN.Text = "Null";
  1353. m_readDSN.BackColor = Color.Transparent;
  1354. }
  1355. if (m_readPlayready.Text != LResource.Skip)
  1356. {
  1357. m_readPlayready.Text = "Null";
  1358. m_readPlayready.BackColor = Color.Transparent;
  1359. }
  1360. if (m_readYouTube.Text != LResource.Skip)
  1361. {
  1362. m_readYouTube.Text = "Null";
  1363. m_readYouTube.BackColor = Color.Transparent;
  1364. }
  1365. if (m_readPSN.Text != LResource.Skip)
  1366. {
  1367. m_readPSN.Text = "Null";
  1368. m_readPSN.BackColor = Color.Transparent;
  1369. }
  1370. if(m_readACASID.Text != LResource.Skip)
  1371. {
  1372. m_readACASID.Text = "Null";
  1373. m_readACASID.BackColor = Color.Transparent;
  1374. }
  1375. if(m_readEDIDPID.Text != LResource.Skip)
  1376. {
  1377. m_readEDIDPID.Text = "Null";
  1378. m_readEDIDPID.BackColor = Color.Transparent;
  1379. }
  1380. if(m_readEDIDName.Text != LResource.Skip)
  1381. {
  1382. m_readEDIDName.Text = "Null";
  1383. m_readEDIDName.BackColor = Color.Transparent;
  1384. }
  1385. if (m_readACASKey.Text != LResource.Skip)
  1386. {
  1387. m_readACASKey.Text = "Null";
  1388. m_readACASKey.BackColor = Color.Transparent;
  1389. }
  1390. ResultStatus.Text = "Wait";
  1391. ResultStatus.BackColor = Color.Transparent;
  1392. SHOPText.BackColor = Color.Transparent;
  1393. OSDText.BackColor = Color.Transparent;
  1394. WBPathText.BackColor = Color.Transparent;
  1395. ProductMsg_Text.BackColor = Color.Transparent;
  1396. }
  1397. /// <summary>
  1398. /// 执行抄key等动作
  1399. /// </summary>
  1400. public void Writekey()
  1401. {
  1402. ArrayList keypath = new ArrayList();
  1403. ArrayList keyStream = new ArrayList();
  1404. ArrayList keyReader = new ArrayList();
  1405. int SerailDelay = FunctionSettingNow.SerailDelay;
  1406. Log.WriteInfoLog(SN + " start testing");
  1407. bool TestResult = false;
  1408. string keycontent = "";
  1409. if (SN != null)
  1410. if (SN.Trim().Length > 0)
  1411. keycontent += "sn=" + SN + "&";
  1412. bool EnterFactoryResult = false;
  1413. byte[] result;
  1414. byte[] data;
  1415. string error;
  1416. //进工厂
  1417. if (!TVPort.IsOpen)
  1418. {
  1419. try
  1420. {
  1421. TVPort.Open();
  1422. }
  1423. catch (Exception ex)
  1424. {
  1425. MessageBox.Show(ex.Message);
  1426. return;
  1427. }
  1428. }
  1429. for (int i = 0; i <= FunctionSettingNow.EnterFactoryRetry; i++)
  1430. {
  1431. if (i == 0)
  1432. Log.WriteInfoLog("Enter factory...");
  1433. else
  1434. Log.WriteInfoLog("Retry enter factory " + i.ToString() + " ...");
  1435. if (SerialCMD.EnterFactory(TVPort, out result, out data, out error, SerailDelay))
  1436. {
  1437. EnterFactoryResult = true;
  1438. break;
  1439. }
  1440. }
  1441. if (!EnterFactoryResult)
  1442. {
  1443. Log.WriteErrorLog(SN + " Enter factory fail");
  1444. MessageBox.Show(LResource.EnterFactoryError);
  1445. goto end;
  1446. }
  1447. //烧录SN
  1448. if (WritePSN.Checked)
  1449. {
  1450. Log.WriteInfoLog("Write PSN");
  1451. if (SerialCMD.SetFireTVPSN(TVPort, Encoding.ASCII.GetBytes(SN), out result, out data, out error, SerailDelay))
  1452. {
  1453. SetsuccessStatus(m_writePSN);
  1454. Log.WriteInfoLog("Read PSN");
  1455. if (SerialCMD.ReadFireTVPSN(TVPort, out result, out data, out error, SerailDelay))
  1456. {
  1457. if (!Encoding.ASCII.GetString(data).Equals(SN))
  1458. {
  1459. Log.WriteErrorLog("Compare PSN error!\r\n" + SN);
  1460. MessageBox.Show("Compare PSN error!\r\n" + SN);
  1461. goto end;
  1462. }
  1463. SetsuccessStatus(m_readPSN);
  1464. }
  1465. else
  1466. {
  1467. SetfailStatus(m_readPSN);
  1468. Log.WriteErrorLog("Read S/N error!\r\n" + SN);
  1469. MessageBox.Show("Read S/N error!\r\n" + SN);
  1470. goto end;
  1471. }
  1472. }
  1473. else
  1474. {
  1475. SetfailStatus(m_writePSN);
  1476. Log.WriteErrorLog("Write S/N error!\r\n" + SN);
  1477. MessageBox.Show("Write S/N error!\r\n" + SN);
  1478. goto end;
  1479. }
  1480. }
  1481. // 如果是G客户,要在抄写其他key前时行fsn+psn查重处理;
  1482. if (WriteDSN.Checked)
  1483. {
  1484. if (SN == null)
  1485. {
  1486. MessageBox.Show("Please scan to trigger testing");
  1487. goto end;
  1488. }
  1489. if (SN.Trim().Length == 0)
  1490. {
  1491. MessageBox.Show("Please scan to trigger testing");
  1492. goto end;
  1493. }
  1494. Log.WriteInfoLog("Read FireTV Device Code...\r\n");
  1495. if (SerialCMD.GetFireTVDevcieCode(TVPort, out result, out data, out error, SerailDelay))
  1496. {
  1497. string devicecode = Encoding.ASCII.GetString(data);
  1498. if (devicecode == "N/A")
  1499. {
  1500. Log.WriteErrorLog("Device code format error!\r\n" + devicecode);
  1501. MessageBox.Show(LResource.DeviceCodeFormatError + "\r\n" + devicecode);
  1502. goto end;
  1503. }
  1504. // 先读取psn的值;
  1505. byte[] result_psn;
  1506. byte[] data_psn;
  1507. string error_psn;
  1508. if (SerialCMD.ReadFireTVPSN(TVPort, out result_psn, out data_psn, out error_psn, SerailDelay))
  1509. {
  1510. string psn = Encoding.ASCII.GetString(data_psn);
  1511. if (CommonMethod.GetFireTVDsn(midListNow.host, orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, out error_psn, errorDBNow))
  1512. {
  1513. keyInfo.DSN = dsn;
  1514. if (!CommonMethod.IsNumberAndWord(keyInfo.DSN))
  1515. {
  1516. Log.WriteErrorLog("DSN format error!\r\n" + keyInfo.DSN);
  1517. MessageBox.Show(LResource.DSNFormatError + "\r\n" + keyInfo.DSN);
  1518. goto end;
  1519. }
  1520. byte[] DSNData = System.Text.Encoding.ASCII.GetBytes(keyInfo.DSN);
  1521. Log.WriteInfoLog("Write DSN...");
  1522. if (SerialCMD.SetFireTVDSN(TVPort, DSNData, out result, out data, out error, SerailDelay))
  1523. {
  1524. SetsuccessStatus(m_writeDSN);
  1525. Log.WriteInfoLog("Check DSN...");
  1526. if (writeCheckNow.DSNCheckcheck ? SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
  1527. {
  1528. SetsuccessStatus(m_checkDSN);
  1529. Log.WriteInfoLog("Read DSN...");
  1530. if (readCheckNow.DSNReadcheck ? SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
  1531. {
  1532. if (SerialInit.BytesCompare_Base64(data, DSNData))
  1533. {
  1534. SetsuccessStatus(m_readDSN);
  1535. //DSN读取别对成功
  1536. }
  1537. else
  1538. {
  1539. Log.WriteErrorLog(SN + " contrast DSN fail");
  1540. MessageBox.Show(LResource.ContrastDSNError);
  1541. goto end;
  1542. }
  1543. }
  1544. else
  1545. {
  1546. SetfailStatus(m_readDSN);
  1547. Log.WriteErrorLog(SN + " read DSN fail");
  1548. MessageBox.Show(LResource.ReadDSNError);
  1549. goto end;
  1550. }
  1551. }
  1552. else
  1553. {
  1554. SetfailStatus(m_checkDSN);
  1555. Log.WriteErrorLog(SN + " check DSN fail");
  1556. MessageBox.Show(LResource.CheckDSNError);
  1557. goto end;
  1558. }
  1559. }
  1560. else
  1561. {
  1562. SetfailStatus(m_writeDSN);
  1563. Log.WriteErrorLog(SN + " Write DSN fail");
  1564. MessageBox.Show(LResource.SetDSNError);
  1565. goto end;
  1566. }
  1567. }
  1568. else
  1569. {
  1570. MessageBox.Show(error_psn);
  1571. goto end;
  1572. }
  1573. }
  1574. else
  1575. {
  1576. Log.WriteErrorLog("Failed to read PSN when requesting DSN !\r\n" + devicecode);
  1577. MessageBox.Show(LResource.ReadPSNError);
  1578. goto end;
  1579. }
  1580. }
  1581. else
  1582. {
  1583. MessageBox.Show(LResource.GetDeviceCodeError);
  1584. goto end;
  1585. }
  1586. }
  1587. // 如果是要导出ACASID+SN,先判断ACASID是否等于20位长度;
  1588. if (FunctionSettingNow.ExportSNACASID)
  1589. {
  1590. if (SerialCMD.ReadJapaneseACASID(TVPort, out result, out data, out error, SerailDelay))
  1591. {
  1592. if (data.Length != 20)
  1593. {
  1594. SetfailStatus(m_readACASID);
  1595. Log.WriteErrorLog("The ACAS ID length doesn't equal 20!\r\n" + data.ToString());
  1596. MessageBox.Show(LResource.ACASIDLengthError + "\r\n" + data.ToString());
  1597. goto end;
  1598. }
  1599. SetsuccessStatus(m_readACASID);
  1600. }
  1601. else
  1602. {
  1603. SetfailStatus(m_readACASID);
  1604. Log.WriteErrorLog("Read ACAS ID error!\r\n");
  1605. MessageBox.Show(LResource.ReadACASIDError + "\r\n");
  1606. goto end;
  1607. }
  1608. }
  1609. //获取key
  1610. if (midListNow.host == "LocalPC" && !preloadNow)
  1611. {
  1612. string Didpath = "";
  1613. string Macpath = "";
  1614. string Hdcppath = "";
  1615. string Hdcp22path = "";
  1616. string Esnpath = "";
  1617. string MGKpath = "";
  1618. string Widipath = "";
  1619. string Widevinepath = "";
  1620. string Cipath = "";
  1621. string Attestationpath = "";
  1622. string Fairplaypath = "";
  1623. string LEKpath = "";
  1624. string PEKpath = "";
  1625. string Playreadypath = "";
  1626. string Hashkeypath = "";
  1627. string AcasKeypath = "";
  1628. if (WriteDID.Checked)
  1629. {
  1630. if (GetLocalKeyCount.GetLocalStringKeys(orderNow, "DeviceID", FunctionSettingNow.LocalDidSize, out FileStream Stream, out StreamReader Reader, out string did, out Didpath, out error, errorDBNow, ref localmidList, SN))
  1631. {
  1632. keyInfo.DID = did;
  1633. Log.WriteGetKeyLog("\r\nLocal DeviceID=" + keyInfo.DID);
  1634. if (Stream != null && Reader != null)
  1635. {
  1636. keypath.Add(Didpath);
  1637. keyStream.Add(Stream);
  1638. keyReader.Add(Reader);
  1639. }
  1640. }
  1641. else
  1642. {
  1643. Log.WriteErrorLog(error);
  1644. MessageBox.Show(LResource.GetDIDError + "\r\n" + error);
  1645. goto end;
  1646. }
  1647. }
  1648. if (WriteMac.Checked)
  1649. {
  1650. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "MAC", FunctionSettingNow.LocalMacSize, out FileStream Stream, out BinaryReader Reader, out string mac, out Macpath, out error, errorDBNow, ref localmidList, SN))
  1651. {
  1652. keyInfo.Mac = mac;
  1653. Log.WriteGetKeyLog("\r\nLocal Mac=" + keyInfo.Mac);
  1654. if (Stream != null && Reader != null)
  1655. {
  1656. keypath.Add(Macpath);
  1657. keyStream.Add(Stream);
  1658. keyReader.Add(Reader);
  1659. }
  1660. }
  1661. else
  1662. {
  1663. Log.WriteErrorLog(error);
  1664. MessageBox.Show(LResource.GetMacError + "\r\n" + error);
  1665. goto end;
  1666. }
  1667. }
  1668. if (WriteHDCP.Checked)
  1669. {
  1670. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "HDCPKEY", FunctionSettingNow.LocalHdcpSize, out FileStream Stream, out BinaryReader Reader, out string hdcp, out Hdcppath, out error, errorDBNow, ref localmidList, SN))
  1671. {
  1672. keyInfo.HDCP = hdcp;
  1673. Log.WriteGetKeyLog("\r\nLocal HDCP=" + keyInfo.HDCP);
  1674. if (Stream != null && Reader != null)
  1675. {
  1676. keypath.Add(Hdcppath);
  1677. keyStream.Add(Stream);
  1678. keyReader.Add(Reader);
  1679. }
  1680. }
  1681. else
  1682. {
  1683. Log.WriteErrorLog(error);
  1684. MessageBox.Show(LResource.GetHDCPError + error);
  1685. goto end;
  1686. }
  1687. }
  1688. if (WriteHDCP22.Checked)
  1689. {
  1690. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "HDCPKEY22", FunctionSettingNow.LocalHdcp22Size, out FileStream Stream, out BinaryReader Reader, out string hdcp22, out Hdcp22path, out error, errorDBNow, ref localmidList, SN))
  1691. {
  1692. keyInfo.HDCP22 = hdcp22;
  1693. Log.WriteGetKeyLog("\r\nLocal HDCP22=" + keyInfo.HDCP22);
  1694. if (Stream != null && Reader != null)
  1695. {
  1696. keypath.Add(Hdcp22path);
  1697. keyStream.Add(Stream);
  1698. keyReader.Add(Reader);
  1699. }
  1700. }
  1701. else
  1702. {
  1703. Log.WriteErrorLog(error);
  1704. MessageBox.Show(LResource.GetHDCP22Error + error);
  1705. goto end;
  1706. }
  1707. }
  1708. if (WriteESN.Checked)
  1709. {
  1710. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "ESN", FunctionSettingNow.LocalEsnSize, out FileStream Stream, out BinaryReader Reader, out string esn, out Esnpath, out error, errorDBNow, ref localmidList, SN))
  1711. {
  1712. keyInfo.ESN = esn;
  1713. Log.WriteGetKeyLog("\r\nLocal ESN=" + keyInfo.ESN);
  1714. if (Stream != null && Reader != null)
  1715. {
  1716. keypath.Add(Esnpath);
  1717. keyStream.Add(Stream);
  1718. keyReader.Add(Reader);
  1719. }
  1720. }
  1721. else
  1722. {
  1723. Log.WriteErrorLog(error);
  1724. MessageBox.Show(LResource.GetESNError + error);
  1725. goto end;
  1726. }
  1727. }
  1728. if (WriteMGK.Checked)
  1729. {
  1730. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "MGK", FunctionSettingNow.LocalMGKSize, out FileStream Stream, out BinaryReader Reader, out string mgk, out MGKpath, out error, errorDBNow, ref localmidList, SN))
  1731. {
  1732. keyInfo.MGK = mgk;
  1733. Log.WriteGetKeyLog("\r\nLocal MGK=" + keyInfo.MGK);
  1734. if (Stream != null && Reader != null)
  1735. {
  1736. keypath.Add(MGKpath);
  1737. keyStream.Add(Stream);
  1738. keyReader.Add(Reader);
  1739. }
  1740. }
  1741. else
  1742. {
  1743. Log.WriteErrorLog(error);
  1744. MessageBox.Show(LResource.GetMGKError + error);
  1745. goto end;
  1746. }
  1747. }
  1748. if (WriteFairplay.Checked)
  1749. {
  1750. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Fairplay", FunctionSettingNow.LocalFairplaySize, out FileStream Stream, out BinaryReader Reader, out string fairplay, out Fairplaypath, out error, errorDBNow, ref localmidList, SN))
  1751. {
  1752. keyInfo.Fairplay = fairplay;
  1753. Log.WriteGetKeyLog("\r\nLocal Fairplay=" + keyInfo.Fairplay);
  1754. if (Stream != null && Reader != null)
  1755. {
  1756. keypath.Add(Fairplaypath);
  1757. keyStream.Add(Stream);
  1758. keyReader.Add(Reader);
  1759. }
  1760. }
  1761. else
  1762. {
  1763. Log.WriteErrorLog(error);
  1764. MessageBox.Show(LResource.GetFairplayError + error);
  1765. goto end;
  1766. }
  1767. }
  1768. if (WriteWiDi.Checked)
  1769. {
  1770. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "WiDi", FunctionSettingNow.LocalWidiSize, out FileStream Stream, out BinaryReader Reader, out string widi, out Widipath, out error, errorDBNow, ref localmidList, SN))
  1771. {
  1772. keyInfo.WiDi = widi;
  1773. Log.WriteGetKeyLog("\r\nLocal WiDi=" + keyInfo.WiDi);
  1774. if (Stream != null && Reader != null)
  1775. {
  1776. keypath.Add(Widipath);
  1777. keyStream.Add(Stream);
  1778. keyReader.Add(Reader);
  1779. }
  1780. }
  1781. else
  1782. {
  1783. Log.WriteErrorLog(error);
  1784. MessageBox.Show(LResource.GetWiDiError + error);
  1785. goto end;
  1786. }
  1787. }
  1788. if (WriteWidevine.Checked)
  1789. {
  1790. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Widevine", FunctionSettingNow.LocalWidevineSize, out FileStream Stream, out BinaryReader Reader, out string widevine, out Widevinepath, out error, errorDBNow, ref localmidList, SN))
  1791. {
  1792. keyInfo.Widevine = widevine;
  1793. Log.WriteGetKeyLog("\r\nLocal Widevine=" + keyInfo.Widevine);
  1794. if (Stream != null && Reader != null)
  1795. {
  1796. keypath.Add(Widevinepath);
  1797. keyStream.Add(Stream);
  1798. keyReader.Add(Reader);
  1799. }
  1800. }
  1801. else
  1802. {
  1803. Log.WriteErrorLog(error);
  1804. MessageBox.Show(LResource.GetWidevineError + error);
  1805. goto end;
  1806. }
  1807. }
  1808. if (WriteCiplus.Checked)
  1809. {
  1810. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "CIKEY", FunctionSettingNow.LocalCiSize, out FileStream Stream, out BinaryReader Reader, out string ci, out Cipath, out error, errorDBNow, ref localmidList, SN))
  1811. {
  1812. keyInfo.CI_plus = ci;
  1813. Log.WriteGetKeyLog("\r\nLocal CI_plus=" + keyInfo.CI_plus);
  1814. if (Stream != null && Reader != null)
  1815. {
  1816. keypath.Add(Cipath);
  1817. keyStream.Add(Stream);
  1818. keyReader.Add(Reader);
  1819. }
  1820. }
  1821. else
  1822. {
  1823. Log.WriteErrorLog(error);
  1824. MessageBox.Show(LResource.GetCiError + error);
  1825. goto end;
  1826. }
  1827. }
  1828. if (WriteAttestation.Checked)
  1829. {
  1830. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Attestation", FunctionSettingNow.LocalCiSize, out FileStream Stream, out BinaryReader Reader, out string attestation, out Attestationpath, out error, errorDBNow, ref localmidList, SN))
  1831. {
  1832. keyInfo.Attestation = attestation;
  1833. Log.WriteGetKeyLog("\r\nLocal attestation=" + keyInfo.Attestation);
  1834. if (Stream != null && Reader != null)
  1835. {
  1836. keypath.Add(Attestationpath);
  1837. keyStream.Add(Stream);
  1838. keyReader.Add(Reader);
  1839. }
  1840. }
  1841. else
  1842. {
  1843. Log.WriteErrorLog(error);
  1844. MessageBox.Show(LResource.GetAttestationError + error);
  1845. goto end;
  1846. }
  1847. }
  1848. if (fireTVKey.LEK)
  1849. {
  1850. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "LEK", -1, out FileStream Stream, out BinaryReader Reader, out string lek, out LEKpath, out error, errorDBNow, ref localmidList, SN))
  1851. {
  1852. keyInfo.LEK = lek;
  1853. Log.WriteGetKeyLog("\r\nLocal LEK=" + keyInfo.LEK);
  1854. if (Stream != null && Reader != null)
  1855. {
  1856. keypath.Add(LEKpath);
  1857. keyStream.Add(Stream);
  1858. keyReader.Add(Reader);
  1859. }
  1860. }
  1861. else
  1862. {
  1863. Log.WriteErrorLog(error);
  1864. MessageBox.Show("获取LEK失败" + error);
  1865. goto end;
  1866. }
  1867. }
  1868. if (fireTVKey.PEK)
  1869. {
  1870. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "PEK", -1, out FileStream Stream, out BinaryReader Reader, out string pek, out PEKpath, out error, errorDBNow, ref localmidList, SN))
  1871. {
  1872. keyInfo.PEK = pek;
  1873. Log.WriteGetKeyLog("\r\nLocal LEK=" + keyInfo.PEK);
  1874. if (Stream != null && Reader != null)
  1875. {
  1876. keypath.Add(PEKpath);
  1877. keyStream.Add(Stream);
  1878. keyReader.Add(Reader);
  1879. }
  1880. }
  1881. else
  1882. {
  1883. Log.WriteErrorLog(error);
  1884. MessageBox.Show("获取PEK失败" + error);
  1885. goto end;
  1886. }
  1887. }
  1888. if (fireTVKey.Playready)
  1889. {
  1890. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Playready", -1, out FileStream Stream, out BinaryReader Reader, out string playready, out Playreadypath, out error, errorDBNow, ref localmidList, SN))
  1891. {
  1892. keyInfo.Playready = playready;
  1893. Log.WriteGetKeyLog("\r\nLocal Playready=" + keyInfo.Playready);
  1894. if (Stream != null && Reader != null)
  1895. {
  1896. keypath.Add(Playreadypath);
  1897. keyStream.Add(Stream);
  1898. keyReader.Add(Reader);
  1899. }
  1900. }
  1901. else
  1902. {
  1903. Log.WriteErrorLog(error);
  1904. MessageBox.Show("获取Playready失败" + error);
  1905. goto end;
  1906. }
  1907. }
  1908. if (fireTVKey.Hashkey)
  1909. {
  1910. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Hashkey", -1, out FileStream Stream, out BinaryReader Reader, out string hashkey, out Hashkeypath, out error, errorDBNow, ref localmidList, SN))
  1911. {
  1912. keyInfo.Hashkey = hashkey;
  1913. Log.WriteGetKeyLog("\r\nLocal Hashkey=" + keyInfo.Hashkey);
  1914. if (Stream != null && Reader != null)
  1915. {
  1916. keypath.Add(Fairplaypath);
  1917. keyStream.Add(Stream);
  1918. keyReader.Add(Reader);
  1919. }
  1920. }
  1921. else
  1922. {
  1923. Log.WriteErrorLog(error);
  1924. MessageBox.Show("获取hashkey失败" + error);
  1925. goto end;
  1926. }
  1927. }
  1928. if (WriteACASKey.Checked)
  1929. {
  1930. if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "ACAS_KEY", FunctionSettingNow.localACASKeySize, out FileStream Stream, out BinaryReader Reader, out string acaskey, out AcasKeypath, out error, errorDBNow, ref localmidList, SN))
  1931. {
  1932. keyInfo.ACASKey = acaskey;
  1933. Log.WriteGetKeyLog("\r\nLocal ACASKey=" + keyInfo.ACASKey);
  1934. if (Stream != null && Reader != null)
  1935. {
  1936. keypath.Add(AcasKeypath);
  1937. keyStream.Add(Stream);
  1938. keyReader.Add(Reader);
  1939. }
  1940. }
  1941. else
  1942. {
  1943. Log.WriteErrorLog(error);
  1944. MessageBox.Show(LResource.GetACASKeyError + error);
  1945. goto end;
  1946. }
  1947. }
  1948. if (localmidList.host != null)
  1949. {
  1950. if (ClientTypeText.Text.Length == 0)
  1951. {
  1952. SetTextStatus(ClientTypeText, localmidList.clienttype);
  1953. }
  1954. if (SVText.Text.Length == 0)
  1955. {
  1956. SetTextStatus(SVText, localmidList.version);
  1957. }
  1958. if (ProjectIDText.Text.Length == 0)
  1959. {
  1960. SetTextStatus(ProjectIDText, localmidList.projectid);
  1961. }
  1962. }
  1963. }
  1964. else if (!preloadNow)
  1965. {
  1966. if (WriteDID.Checked)
  1967. {
  1968. if (CommonMethod.GetKeys(midListNow.host, "DeviceID", SN, "devicetype=tcl_unknown_model", errorDBNow, out string did, out error, orderNow, out string md5))
  1969. {
  1970. keyInfo.DID = did;
  1971. Log.WriteGetKeyLog("\r\nDeviceID=" + keyInfo.DID);
  1972. }
  1973. else
  1974. {
  1975. MessageBox.Show(LResource.GetDIDError + "\r\n" + error);
  1976. goto end;
  1977. }
  1978. }
  1979. if (WriteMac.Checked)
  1980. {
  1981. if (CommonMethod.GetKeys(midListNow.host, "MAC", SN, midListNow.keytype["MAC"], errorDBNow, out string mac, out error, orderNow, out string md5))
  1982. {
  1983. keyInfo.Mac = mac;
  1984. Log.WriteGetKeyLog("\r\nMac=" + keyInfo.Mac);
  1985. }
  1986. else
  1987. {
  1988. MessageBox.Show(LResource.GetMacError + "\r\n" + error);
  1989. goto end;
  1990. }
  1991. }
  1992. if (WriteHDCP.Checked)
  1993. {
  1994. if (CommonMethod.GetKeys(midListNow.host, "HDCP_KEY", SN, midListNow.keytype["HDCP_KEY"], errorDBNow, out string hdcp, out error, orderNow, out string md5))
  1995. {
  1996. keyInfo.HDCP = hdcp;
  1997. Log.WriteGetKeyLog("\r\nHDCP=" + keyInfo.HDCP);
  1998. }
  1999. else
  2000. {
  2001. MessageBox.Show(LResource.GetHDCPError + error);
  2002. goto end;
  2003. }
  2004. }
  2005. if (WriteHDCP22.Checked)
  2006. {
  2007. if (CommonMethod.GetKeys(midListNow.host, "HDCP2.2_KEY", SN, midListNow.keytype["HDCP2.2_KEY"], errorDBNow, out string hdcp22, out error, orderNow, out string md5))
  2008. {
  2009. keyInfo.HDCP22 = hdcp22;
  2010. Log.WriteGetKeyLog("\r\nHDCP22=" + keyInfo.HDCP22);
  2011. }
  2012. else
  2013. {
  2014. MessageBox.Show(LResource.GetHDCP22Error + error);
  2015. goto end;
  2016. }
  2017. }
  2018. if (WriteESN.Checked)
  2019. {
  2020. if (CommonMethod.GetKeys(midListNow.host, "NETFILX_ESN", SN, midListNow.keytype["NETFILX_ESN"], errorDBNow, out string esn, out error, orderNow, out string md5))
  2021. {
  2022. keyInfo.ESN = esn;
  2023. Log.WriteGetKeyLog("\r\nESN=" + keyInfo.ESN);
  2024. }
  2025. else
  2026. {
  2027. MessageBox.Show(LResource.GetESNError + error);
  2028. goto end;
  2029. }
  2030. }
  2031. if (WriteWiDi.Checked)
  2032. {
  2033. if (CommonMethod.GetKeys(midListNow.host, "WiDi", SN, midListNow.keytype["WiDi"], errorDBNow, out string widi, out error, orderNow, out string md5))
  2034. {
  2035. keyInfo.WiDi = widi;
  2036. Log.WriteGetKeyLog("\r\nWiDi=" + keyInfo.WiDi);
  2037. }
  2038. else
  2039. {
  2040. MessageBox.Show(LResource.GetWiDiError + error);
  2041. goto end;
  2042. }
  2043. }
  2044. if (WriteCiplus.Checked)
  2045. {
  2046. if (CommonMethod.GetKeys(midListNow.host, "CI_PLUS_KEY", SN, midListNow.keytype["CI_PLUS_KEY"], errorDBNow, out string ci, out error, orderNow, out string md5))
  2047. {
  2048. keyInfo.CI_plus = ci;
  2049. Log.WriteGetKeyLog("\r\nCI_plus=" + keyInfo.CI_plus);
  2050. }
  2051. else
  2052. {
  2053. MessageBox.Show(LResource.GetCiError + error);
  2054. goto end;
  2055. }
  2056. }
  2057. if (WriteWidevine.Checked)
  2058. {
  2059. if (CommonMethod.GetWidevineAnAttestationKey(
  2060. midListNow.host,
  2061. SN,
  2062. midListNow.keytype["Widevine_KEY"],
  2063. errorDBNow,
  2064. out bool isAndroidTV,
  2065. out string widevine,
  2066. out string attestation,
  2067. out error,
  2068. orderNow,
  2069. out string md5))
  2070. {
  2071. keyInfo.Widevine = widevine;
  2072. Log.WriteGetKeyLog("\r\nWidevine=" + keyInfo.Widevine);
  2073. if (isAndroidTV)
  2074. {
  2075. keyInfo.Attestation = attestation;
  2076. keyInfo.AttestationMD5 = md5;
  2077. Log.WriteGetKeyLog("\r\nAttestationMD5=" + keyInfo.AttestationMD5);
  2078. }
  2079. }
  2080. else
  2081. {
  2082. MessageBox.Show(LResource.GetWidevineError + error);
  2083. goto end;
  2084. }
  2085. }
  2086. if (WriteMGK.Checked)
  2087. {
  2088. if (CommonMethod.GetKeys(midListNow.host, "MGK_KEY", SN, midListNow.keytype["MGK_KEY"], errorDBNow, out string mgk, out error, orderNow, out string md5))
  2089. {
  2090. keyInfo.MGK = mgk;
  2091. Log.WriteGetKeyLog("\r\nMGK=" + keyInfo.MGK);
  2092. }
  2093. else
  2094. {
  2095. MessageBox.Show(LResource.GetMGKError + error);
  2096. goto end;
  2097. }
  2098. }
  2099. if (WriteFairplay.Checked)
  2100. {
  2101. if (CommonMethod.GetKeys(midListNow.host, "Fairplay_KEY", SN, midListNow.keytype["Fairplay_KEY"], errorDBNow, out string fairplay, out error, orderNow, out string md5))
  2102. {
  2103. keyInfo.Fairplay = fairplay;
  2104. Log.WriteGetKeyLog("\r\nFairplay=" + keyInfo.Fairplay);
  2105. }
  2106. else
  2107. {
  2108. MessageBox.Show(LResource.GetFairplayError + error);
  2109. goto end;
  2110. }
  2111. }
  2112. if (WriteWifiMac.Checked)
  2113. {
  2114. if (CommonMethod.GetKeys(midListNow.host, "MAC", "WiFi_MAC" + SN, midListNow.keytype["MAC"], errorDBNow, out string mac, out error, orderNow, out string md5))
  2115. {
  2116. keyInfo.WiFi_MAC = mac;
  2117. Log.WriteGetKeyLog("\r\nWiFi_MAC=" + keyInfo.WiFi_MAC);
  2118. }
  2119. else
  2120. {
  2121. MessageBox.Show(LResource.GetMacError + "\r\n" + error);
  2122. goto end;
  2123. }
  2124. }
  2125. if (WriteBTMac.Checked)
  2126. {
  2127. if (CommonMethod.GetKeys(midListNow.host, "MAC", "BT_MAC" + SN, midListNow.keytype["MAC"], errorDBNow, out string mac, out error, orderNow, out string md5))
  2128. {
  2129. keyInfo.BT_MAC = mac;
  2130. Log.WriteGetKeyLog("\r\nBT_MAC=" + keyInfo.BT_MAC);
  2131. }
  2132. else
  2133. {
  2134. MessageBox.Show(LResource.GetMacError + "\r\n" + error);
  2135. goto end;
  2136. }
  2137. }
  2138. if (WriteECP.Checked)
  2139. {
  2140. if (CommonMethod.GetKeys(midListNow.host, "ECP_KEY", SN, midListNow.keytype["ECP_KEY"], errorDBNow, out string ecp, out error, orderNow, out string md5))
  2141. {
  2142. keyInfo.ECP = ecp;
  2143. Log.WriteGetKeyLog("\r\nECP_KEY=" + keyInfo.ECP);
  2144. }
  2145. else
  2146. {
  2147. MessageBox.Show(LResource.GetECPError + "\r\n" + error);
  2148. goto end;
  2149. }
  2150. }
  2151. if (WriteLEK.Checked)
  2152. {
  2153. if (CommonMethod.GetKeys(midListNow.host, "LEK", SN, midListNow.keytype["LEK"], errorDBNow, out string lek, out error, orderNow, out string md5))
  2154. {
  2155. keyInfo.LEK = lek;
  2156. Log.WriteGetKeyLog("\r\nLEK=" + keyInfo.LEK);
  2157. }
  2158. else
  2159. {
  2160. MessageBox.Show(LResource.GetLEKError + "\r\n" + error);
  2161. goto end;
  2162. }
  2163. }
  2164. if (WritePEK.Checked)
  2165. {
  2166. if (CommonMethod.GetKeys(midListNow.host, "PEK", SN, midListNow.keytype["PEK"], errorDBNow, out string pek, out error, orderNow, out string md5))
  2167. {
  2168. keyInfo.PEK = pek;
  2169. Log.WriteGetKeyLog("\r\nPEK=" + keyInfo.PEK);
  2170. }
  2171. else
  2172. {
  2173. MessageBox.Show(LResource.GetPEKError + "\r\n" + error);
  2174. goto end;
  2175. }
  2176. }
  2177. if (WritePlayready.Checked)
  2178. {
  2179. if (CommonMethod.GetKeys(midListNow.host, "PlayReady_key", SN, midListNow.keytype["PlayReady_key"], errorDBNow, out string playready, out error, orderNow, out string md5))
  2180. {
  2181. keyInfo.Playready = playready;
  2182. Log.WriteGetKeyLog("\r\nPlayReady_key=" + keyInfo.Playready);
  2183. }
  2184. else
  2185. {
  2186. MessageBox.Show(LResource.GetPlayreadyError + "\r\n" + error);
  2187. goto end;
  2188. }
  2189. }
  2190. if (WriteHash.Checked)
  2191. {
  2192. if (CommonMethod.GetKeys(midListNow.host, "Hashkey", SN, midListNow.keytype["Hashkey"], errorDBNow, out string hash, out error, orderNow, out string md5))
  2193. {
  2194. keyInfo.Hashkey = hash;
  2195. Log.WriteGetKeyLog("\r\nHashkey=" + keyInfo.Hashkey);
  2196. }
  2197. else
  2198. {
  2199. MessageBox.Show(LResource.GetHashkeyError + "\r\n" + error);
  2200. goto end;
  2201. }
  2202. }
  2203. if (WriteYouTube.Checked)
  2204. {
  2205. if (CommonMethod.GetKeys(midListNow.host, "YouTube_KEY", SN, midListNow.keytype["YouTube_KEY"], errorDBNow, out string youtube, out error, orderNow, out string md5))
  2206. {
  2207. keyInfo.YouTube_KEY = youtube;
  2208. Log.WriteGetKeyLog("\r\nYouTube_KEY=" + keyInfo.YouTube_KEY);
  2209. }
  2210. else
  2211. {
  2212. MessageBox.Show(LResource.GetYouTubekeyError + "\r\n" + error);
  2213. goto end;
  2214. }
  2215. }
  2216. if (WriteEDIDPID.Checked)
  2217. {
  2218. keyInfo.EDIDPid = midListNow.keytype["edid_pid"];
  2219. }
  2220. if (WriteEDIDName.Checked)
  2221. {
  2222. keyInfo.EDIDModelName = midListNow.keytype["edid_model_name"];
  2223. }
  2224. if (WriteACASKey.Checked)
  2225. {
  2226. if (CommonMethod.GetKeys(midListNow.host, "ACAS_KEY", SN, midListNow.keytype["ACAS_KEY"], errorDBNow, out string acaskey, out error, orderNow, out string md5))
  2227. {
  2228. keyInfo.ACASKey = acaskey;
  2229. keyInfo.ACASKeyMd5 = md5;
  2230. Log.WriteGetKeyLog("\r\nACAS_KEY=" + keyInfo.ACASKey + "\r\nACAS_KEY_MD5=" + keyInfo.ACASKeyMd5);
  2231. }
  2232. else
  2233. {
  2234. MessageBox.Show(LResource.GetACASKeyError + "\r\n" + error);
  2235. goto end;
  2236. }
  2237. }
  2238. }
  2239. // 如果是抄写EDID,则不获取白平衡数据;
  2240. if (CommonMethod.IsEDIDCopy(midListNow))
  2241. {
  2242. SetspecificText(SoftwareVersionNote, LResource.SkipChecking, Color.Yellow);
  2243. SetspecificText(ClientTypeNote, LResource.SkipChecking, Color.Yellow);
  2244. if(midListNow.projectid.Equals("0"))
  2245. SetspecificText(ProjectIDNote, LResource.SkipCovering, Color.Yellow);
  2246. }
  2247. //检查Software version
  2248. if (SoftwareVersionNote.Text != LResource.SkipChecking)
  2249. {
  2250. Log.WriteInfoLog("Check software version...\r\n");
  2251. if (SerialCMD.GetSoftVersion(TVPort, out result, out data, out error, SerailDelay))
  2252. {
  2253. string sfv = Encoding.ASCII.GetString(data);
  2254. if (sfv != SVText.Text)
  2255. {
  2256. MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
  2257. DialogResult dr = MessageBox.Show(LResource.MainboardFV + sfv + LResource.differentfromserver + SVText.Text + "\r\n" + LResource.SkipFVChecking, LResource.Error, messButton);
  2258. if (dr == DialogResult.OK)
  2259. {
  2260. SetspecificText(SoftwareVersionNote, LResource.SkipChecking, Color.Yellow);
  2261. SetcolorStatus(SVText, Color.Yellow);
  2262. }
  2263. else
  2264. {
  2265. SetspecificText(SoftwareVersionNote, sfv, Color.Red);
  2266. SetcolorStatus(SVText, Color.Red);
  2267. goto end;
  2268. }
  2269. }
  2270. else
  2271. {
  2272. SetcolorStatus(SVText, Color.FromArgb(128, 255, 128));
  2273. }
  2274. }
  2275. else
  2276. {
  2277. Log.WriteErrorLog(SN + " Read software version fail");
  2278. MessageBox.Show(LResource.ReadSVError);
  2279. goto end;
  2280. }
  2281. }
  2282. //DID抄写
  2283. if (WriteDID.Checked)
  2284. {
  2285. if (!CommonMethod.IsNumberAndWord(keyInfo.DID))
  2286. {
  2287. Log.WriteErrorLog("DID format error!\r\n" + keyInfo.DID);
  2288. MessageBox.Show(LResource.DIDFormatError + "\r\n" + keyInfo.DID);
  2289. goto end;
  2290. }
  2291. byte[] DIDData = Encoding.ASCII.GetBytes(keyInfo.DID);
  2292. Log.WriteInfoLog("Write DID...");
  2293. if (SerialCMD.SetDeviceID(TVPort, DIDData, out result, out data, out error, SerailDelay))
  2294. {
  2295. SetsuccessStatus(m_writedid);
  2296. keycontent += "deviceid=" + keyInfo.DID + "&";
  2297. Log.WriteInfoLog("Check DID...");
  2298. if (writeCheckNow.DIDCheckcheck ? SerialCMD.CheckDeviceId(TVPort, out result, out data, out error, SerailDelay) : true)
  2299. {
  2300. SetsuccessStatus(m_checkdid);
  2301. Log.WriteInfoLog("Read DID...");
  2302. if (readCheckNow.DIDReadcheck ? SerialCMD.GetDeviceId(TVPort, out result, out data, out error, SerailDelay) : true)
  2303. {
  2304. if (readCheckNow.DIDReadcheck)
  2305. {
  2306. if (SerialInit.BytesCompare_Base64(data, DIDData))
  2307. {
  2308. SetsuccessStatus(m_readdid);
  2309. }
  2310. else
  2311. {
  2312. SetfailStatus(m_readdid);
  2313. Log.WriteErrorLog(SN + " contrast DID fail");
  2314. MessageBox.Show(LResource.ContrastDIDError);
  2315. goto end; ;
  2316. }
  2317. }
  2318. }
  2319. else
  2320. {
  2321. SetfailStatus(m_readdid);
  2322. Log.WriteErrorLog(SN + " read DID fail");
  2323. MessageBox.Show(LResource.ReadDIDError);
  2324. goto end;
  2325. }
  2326. }
  2327. else
  2328. {
  2329. SetfailStatus(m_checkdid);
  2330. Log.WriteErrorLog(SN + " check DID fail");
  2331. MessageBox.Show(LResource.CheckDIDError);
  2332. goto end;
  2333. }
  2334. }
  2335. else
  2336. {
  2337. SetfailStatus(m_writedid);
  2338. Log.WriteErrorLog(SN + " Write DID fail");
  2339. MessageBox.Show(LResource.SetDIDError);
  2340. goto end;
  2341. }
  2342. }
  2343. //Eth_Mac抄写
  2344. if (WriteMac.Checked)
  2345. {
  2346. string mac = keyInfo.Mac.Replace("-", "");
  2347. if (!CommonMethod.IsNumberAndWord(mac))
  2348. {
  2349. Log.WriteErrorLog("Mac format error!\r\n" + mac);
  2350. MessageBox.Show(LResource.MacFormatError + "\r\n" + mac);
  2351. goto end;
  2352. }
  2353. byte[] MacData = SerialInit.HexToByte(mac);
  2354. Log.WriteInfoLog("Write Mac...");
  2355. if (SerialCMD.SetMAC(TVPort, MacData, out result, out data, out error, SerailDelay))
  2356. {
  2357. SetsuccessStatus(m_writemac);
  2358. keycontent += "mac=" + keyInfo.Mac + "&";
  2359. Log.WriteInfoLog("Check Mac...");
  2360. if (writeCheckNow.MacCheckcheck ? SerialCMD.CheckMAC(TVPort, out result, out data, out error, SerailDelay) : true)
  2361. {
  2362. SetsuccessStatus(m_checkmac);
  2363. Log.WriteInfoLog("Read Mac...");
  2364. if (readCheckNow.MacReadcheck ? SerialCMD.GetMAC(TVPort, out result, out data, out error, SerailDelay) : true)
  2365. {
  2366. if (readCheckNow.MacReadcheck)
  2367. {
  2368. if (SerialInit.BytesCompare_Base64(data, MacData))
  2369. {
  2370. SetsuccessStatus(m_readmac);
  2371. }
  2372. else
  2373. {
  2374. SetfailStatus(m_readmac);
  2375. Log.WriteErrorLog(SN + " contrast Mac fail");
  2376. MessageBox.Show(LResource.ContrastMacError);
  2377. goto end;
  2378. }
  2379. }
  2380. }
  2381. else
  2382. {
  2383. SetfailStatus(m_readmac);
  2384. Log.WriteErrorLog(SN + " read Mac fail");
  2385. MessageBox.Show(LResource.ReadMacError);
  2386. goto end;
  2387. }
  2388. }
  2389. else
  2390. {
  2391. SetfailStatus(m_checkmac);
  2392. Log.WriteErrorLog(SN + " check Mac fail");
  2393. MessageBox.Show(LResource.CheckMacError);
  2394. goto end;
  2395. }
  2396. }
  2397. else
  2398. {
  2399. SetfailStatus(m_writemac);
  2400. Log.WriteErrorLog(SN + " Write Mac fail");
  2401. MessageBox.Show(LResource.WriteMacError);
  2402. goto end;
  2403. }
  2404. }
  2405. //WiFi_MAC抄写
  2406. if (WriteWifiMac.Checked)
  2407. {
  2408. string wifimac = keyInfo.WiFi_MAC.Replace("-", "");
  2409. if (!CommonMethod.IsNumberAndWord(wifimac))
  2410. {
  2411. Log.WriteErrorLog("Wifi Mac format error!\r\n" + wifimac);
  2412. MessageBox.Show(LResource.MacFormatError + "\r\n" + wifimac);
  2413. goto end;
  2414. }
  2415. byte[] WifiMacData = Encoding.ASCII.GetBytes(wifimac);
  2416. Log.WriteInfoLog("Write WifiMac...");
  2417. if (SerialCMD.SetFireTVWifiMac(TVPort, WifiMacData, out result, out data, out error, SerailDelay))
  2418. {
  2419. keycontent += "wifimac=" + keyInfo.WiFi_MAC + "&";
  2420. SetsuccessStatus(m_writeWifiMac);
  2421. Log.WriteInfoLog("Check WifiMac...");
  2422. if (writeCheckNow.WifiMacCheckcheck ? SerialCMD.CheckFireTVWifiMac(TVPort, out result, out data, out error, SerailDelay) : true)
  2423. {
  2424. SetsuccessStatus(m_checkWifiMac);
  2425. Log.WriteInfoLog("Read WifiMac...");
  2426. if (readCheckNow.WifiMacReadcheck ? SerialCMD.GetFireTVWiFi_Mac(TVPort, out result, out data, out error, SerailDelay) : true)
  2427. {
  2428. if (readCheckNow.WifiMacReadcheck)
  2429. {
  2430. if (SerialInit.BytesCompare_Base64(data, WifiMacData))
  2431. {
  2432. SetsuccessStatus(m_readWifiMac);
  2433. }
  2434. else
  2435. {
  2436. SetfailStatus(m_readWifiMac);
  2437. Log.WriteErrorLog(SN + " contrast Wifi Mac fail");
  2438. MessageBox.Show(LResource.ContrastMacError);
  2439. goto end;
  2440. }
  2441. }
  2442. }
  2443. else
  2444. {
  2445. SetfailStatus(m_readWifiMac);
  2446. Log.WriteErrorLog(SN + " read Wifi Mac fail");
  2447. MessageBox.Show(LResource.ReadMacError);
  2448. goto end;
  2449. }
  2450. }
  2451. else
  2452. {
  2453. SetfailStatus(m_checkWifiMac);
  2454. Log.WriteErrorLog(SN + " check Wifi Mac fail");
  2455. MessageBox.Show(LResource.CheckMacError);
  2456. goto end;
  2457. }
  2458. }
  2459. else
  2460. {
  2461. SetfailStatus(m_writeWifiMac);
  2462. Log.WriteErrorLog(SN + " Write Wifi Mac fail");
  2463. MessageBox.Show(LResource.WriteMacError);
  2464. goto end;
  2465. }
  2466. }
  2467. //BT_MAC抄写
  2468. if (WriteBTMac.Checked)
  2469. {
  2470. string btmac = keyInfo.BT_MAC.Replace("-", "");
  2471. if (!CommonMethod.IsNumberAndWord(btmac))
  2472. {
  2473. Log.WriteErrorLog("BTMac format error!\r\n" + btmac);
  2474. MessageBox.Show(LResource.MacFormatError + "\r\n" + btmac);
  2475. goto end;
  2476. }
  2477. byte[] BTMacData = Encoding.ASCII.GetBytes(btmac);
  2478. Log.WriteInfoLog("Write BTMac...");
  2479. if (SerialCMD.SetFireTVBTMac(TVPort, BTMacData, out result, out data, out error, SerailDelay))
  2480. {
  2481. keycontent += "btmac=" + keyInfo.BT_MAC + "&";
  2482. SetsuccessStatus(m_writeBTMac);
  2483. Log.WriteInfoLog("Check BTMac...");
  2484. if (writeCheckNow.BTMacCheckcheck ? SerialCMD.CheckFireTVBTMac(TVPort, out result, out data, out error, SerailDelay) : true)
  2485. {
  2486. SetsuccessStatus(m_checkBTMac);
  2487. Log.WriteInfoLog("Read BTMac...");
  2488. if (readCheckNow.BTMacReadcheck ? SerialCMD.GetFireTVBT_Mac(TVPort, out result, out data, out error, SerailDelay) : true)
  2489. {
  2490. if (readCheckNow.BTMacReadcheck)
  2491. {
  2492. if (SerialInit.BytesCompare_Base64(data, BTMacData))
  2493. {
  2494. SetsuccessStatus(m_readBTMac);
  2495. }
  2496. else
  2497. {
  2498. SetfailStatus(m_readBTMac);
  2499. Log.WriteErrorLog(SN + " contrast BT Mac fail");
  2500. MessageBox.Show(LResource.ContrastMacError);
  2501. goto end;
  2502. }
  2503. }
  2504. }
  2505. else
  2506. {
  2507. SetfailStatus(m_readBTMac);
  2508. Log.WriteErrorLog(SN + " read BT Mac fail");
  2509. MessageBox.Show(LResource.ReadMacError);
  2510. goto end;
  2511. }
  2512. }
  2513. else
  2514. {
  2515. SetfailStatus(m_checkBTMac);
  2516. Log.WriteErrorLog(SN + " check BT Mac fail");
  2517. MessageBox.Show(LResource.CheckMacError);
  2518. goto end;
  2519. }
  2520. }
  2521. else
  2522. {
  2523. SetfailStatus(m_writeBTMac);
  2524. Log.WriteErrorLog(SN + " Write BT Mac fail");
  2525. MessageBox.Show(LResource.WriteMacError);
  2526. goto end;
  2527. }
  2528. }
  2529. //HDCP KEY抄写
  2530. if (WriteHDCP.Checked)
  2531. {
  2532. if (!CommonMethod.IsNumberAndWord(keyInfo.HDCP))
  2533. {
  2534. Log.WriteErrorLog("HDCP format error!\r\n" + keyInfo.HDCP);
  2535. MessageBox.Show(LResource.HDCPFormatError + "\r\n" + keyInfo.HDCP);
  2536. goto end;
  2537. }
  2538. byte[] HDCPData = SerialInit.HexToByte(keyInfo.HDCP);
  2539. Log.WriteInfoLog("Write HDCP...");
  2540. if (SerialCMD.SetHDCPKey(TVPort, HDCPData, out result, out data, out error, SerailDelay))
  2541. {
  2542. SetsuccessStatus(m_writehdcp);
  2543. keycontent += "hdcpkey=" + keyInfo.HDCP + "&";
  2544. Log.WriteInfoLog("Check HDCP...");
  2545. if (writeCheckNow.HDCPCheckcheck ? SerialCMD.CheckHDCP(TVPort, out result, out data, out error, SerailDelay) : true)
  2546. {
  2547. SetsuccessStatus(m_checkhdcp);
  2548. Log.WriteInfoLog("Read HDCP...");
  2549. if (readCheckNow.HDCPReadcheck ? SerialCMD.GetHDCPKey(TVPort, out result, out data, out error, SerailDelay) : true)
  2550. {
  2551. if (readCheckNow.HDCPReadcheck)
  2552. {
  2553. if (SerialInit.BytesCompare_Base64(data, HDCPData))
  2554. {
  2555. SetsuccessStatus(m_readhdcp);
  2556. }
  2557. else
  2558. {
  2559. SetfailStatus(m_readhdcp);
  2560. Log.WriteErrorLog(SN + " contrast HDCP fail");
  2561. MessageBox.Show(LResource.ContrastHDCPError);
  2562. goto end;
  2563. }
  2564. }
  2565. }
  2566. else
  2567. {
  2568. SetfailStatus(m_readhdcp);
  2569. Log.WriteErrorLog(SN + " read HDCP fail");
  2570. MessageBox.Show(LResource.ReadHDCPError);
  2571. goto end;
  2572. }
  2573. }
  2574. else
  2575. {
  2576. SetfailStatus(m_checkhdcp);
  2577. Log.WriteErrorLog(SN + " check HDCP fail");
  2578. MessageBox.Show(LResource.CheckHDCPError);
  2579. goto end;
  2580. }
  2581. }
  2582. else
  2583. {
  2584. SetfailStatus(m_writehdcp);
  2585. Log.WriteErrorLog(SN + " Write HDCP fail");
  2586. MessageBox.Show(LResource.WriteHDCPError);
  2587. goto end;
  2588. }
  2589. }
  2590. //HDCP22 KEY抄写
  2591. if (WriteHDCP22.Checked)
  2592. {
  2593. if (!CommonMethod.IsNumberAndWord(keyInfo.HDCP22))
  2594. {
  2595. Log.WriteErrorLog("HDCP22 format error!\r\n" + keyInfo.HDCP22);
  2596. MessageBox.Show(LResource.HDCP22FormatError + "\r\n" + keyInfo.HDCP22);
  2597. goto end;
  2598. }
  2599. byte[] HDCP22Data = SerialInit.HexToByte(keyInfo.HDCP22);
  2600. Log.WriteInfoLog("Write HDCP22...");
  2601. if (SerialCMD.SetHDCPKey22(TVPort, HDCP22Data, out result, out data, out error, SerailDelay))
  2602. {
  2603. SetsuccessStatus(m_writehdcp22);
  2604. keycontent += "hdcpkey2=" + keyInfo.HDCP22 + "&";
  2605. Log.WriteInfoLog("Check HDCP22...");
  2606. if (writeCheckNow.HDCP22Checkcheck ? SerialCMD.CheckHDCP22(TVPort, out result, out data, out error, SerailDelay) : true)
  2607. {
  2608. SetsuccessStatus(m_checkhdcp22);
  2609. Log.WriteInfoLog("Read HDCP22...");
  2610. if (readCheckNow.HDCP22Readcheck ? SerialCMD.GetHDCPKey22(TVPort, out result, out data, out error, SerailDelay) : true)
  2611. {
  2612. if (readCheckNow.HDCP22Readcheck)
  2613. {
  2614. if (SerialInit.BytesCompare_Base64(data, HDCP22Data))
  2615. {
  2616. SetsuccessStatus(m_readhdcp22);
  2617. }
  2618. else
  2619. {
  2620. SetfailStatus(m_readhdcp22);
  2621. Log.WriteErrorLog(SN + " contrast HDCP22 fail");
  2622. MessageBox.Show(LResource.ContrastHDCP22Error);
  2623. goto end;
  2624. }
  2625. }
  2626. }
  2627. else
  2628. {
  2629. SetfailStatus(m_readhdcp22);
  2630. Log.WriteErrorLog(SN + " read HDCP22 fail");
  2631. MessageBox.Show(LResource.ReadHDCP22Error);
  2632. goto end;
  2633. }
  2634. }
  2635. else
  2636. {
  2637. SetfailStatus(m_checkhdcp22);
  2638. Log.WriteErrorLog(SN + " check HDCP22 fail");
  2639. MessageBox.Show(LResource.CheckHDCP22Error);
  2640. goto end;
  2641. }
  2642. }
  2643. else
  2644. {
  2645. SetfailStatus(m_writehdcp22);
  2646. Log.WriteErrorLog(SN + " Write HDCP22 fail");
  2647. MessageBox.Show(LResource.WriteHDCP22Error);
  2648. goto end;
  2649. }
  2650. }
  2651. //ESN KEY抄写
  2652. if (WriteESN.Checked)
  2653. {
  2654. if (!CommonMethod.IsNumberAndWord(keyInfo.ESN))
  2655. {
  2656. Log.WriteErrorLog("ESN format error!\r\n" + keyInfo.ESN);
  2657. MessageBox.Show(LResource.ESNFormatError + "\r\n" + keyInfo.ESN);
  2658. goto end;
  2659. }
  2660. byte[] ESNData = SerialInit.HexToByte(keyInfo.ESN);
  2661. Log.WriteInfoLog("Write ESN...");
  2662. if (SerialCMD.SetNetflixESN(TVPort, ESNData, out result, out data, out error, SerailDelay))
  2663. {
  2664. SetsuccessStatus(m_writeesn);
  2665. keycontent += "netfilxesn=" + keyInfo.ESN + "&";
  2666. Log.WriteInfoLog("Check ESN...");
  2667. if (writeCheckNow.ESNCheckcheck ? SerialCMD.CheckNetflixESN(TVPort, out result, out data, out error, SerailDelay) : true)
  2668. {
  2669. SetsuccessStatus(m_checkesn);
  2670. Log.WriteInfoLog("Read ESN...");
  2671. if (readCheckNow.ESNReadcheck ? SerialCMD.GetNetflixESN(TVPort, out result, out data, out error, SerailDelay) : true)
  2672. {
  2673. if (readCheckNow.ESNReadcheck)
  2674. {
  2675. if (SerialInit.BytesCompare_Base64(data, ESNData))
  2676. {
  2677. SetsuccessStatus(m_readesn);
  2678. }
  2679. else
  2680. {
  2681. SetfailStatus(m_readesn);
  2682. Log.WriteErrorLog(SN + " contrast ESN fail");
  2683. MessageBox.Show(LResource.ContrastESNError);
  2684. goto end;
  2685. }
  2686. }
  2687. }
  2688. else
  2689. {
  2690. SetfailStatus(m_readesn);
  2691. Log.WriteErrorLog(SN + " read ESN fail");
  2692. MessageBox.Show(LResource.ReadESNError);
  2693. goto end;
  2694. }
  2695. }
  2696. else
  2697. {
  2698. SetfailStatus(m_checkesn);
  2699. Log.WriteErrorLog(SN + " check ESN fail");
  2700. MessageBox.Show(LResource.CheckESNError);
  2701. goto end;
  2702. }
  2703. }
  2704. else
  2705. {
  2706. SetfailStatus(m_writeesn);
  2707. Log.WriteErrorLog(SN + " Write ESN fail");
  2708. MessageBox.Show(LResource.WriteESNError);
  2709. goto end;
  2710. }
  2711. }
  2712. //WiDi KEY抄写
  2713. if (WriteWiDi.Checked)
  2714. {
  2715. if (!CommonMethod.IsNumberAndWord(keyInfo.WiDi))
  2716. {
  2717. Log.WriteErrorLog("WiDi format error!\r\n" + keyInfo.WiDi);
  2718. MessageBox.Show(LResource.WiDiFormatError + "\r\n" + keyInfo.WiDi);
  2719. goto end;
  2720. }
  2721. byte[] WiDiData = SerialInit.HexToByte(keyInfo.WiDi);
  2722. Log.WriteInfoLog("Write WiDi...");
  2723. if (SerialCMD.SetWidi(TVPort, WiDiData, out result, out data, out error, SerailDelay))
  2724. {
  2725. SetsuccessStatus(m_writewidi);
  2726. keycontent += "widi=" + keyInfo.WiDi + "&";
  2727. Log.WriteInfoLog("Check WiDi...");
  2728. if (writeCheckNow.WiDiCheckcheck ? SerialCMD.CheckWidi(TVPort, out result, out data, out error, SerailDelay) : true)
  2729. {
  2730. SetsuccessStatus(m_checkwidi);
  2731. Log.WriteInfoLog("Read WiDi...");
  2732. if (readCheckNow.WiDiReadcheck ? SerialCMD.GetWidi(TVPort, out result, out data, out error, SerailDelay) : true)
  2733. {
  2734. if (readCheckNow.WiDiReadcheck)
  2735. {
  2736. if (SerialInit.BytesCompare_Base64(data, WiDiData))
  2737. {
  2738. SetsuccessStatus(m_readwidi);
  2739. }
  2740. else
  2741. {
  2742. SetfailStatus(m_readwidi);
  2743. Log.WriteErrorLog(SN + " contrast WiDi fail");
  2744. MessageBox.Show(LResource.ContrastWiDiError);
  2745. goto end;
  2746. }
  2747. }
  2748. }
  2749. else
  2750. {
  2751. SetfailStatus(m_readwidi);
  2752. Log.WriteErrorLog(SN + " read WiDi fail");
  2753. MessageBox.Show(LResource.ReadWiDiError);
  2754. goto end;
  2755. }
  2756. }
  2757. else
  2758. {
  2759. SetfailStatus(m_checkwidi);
  2760. Log.WriteErrorLog(SN + " check WiDi fail");
  2761. MessageBox.Show(LResource.CheckWiDiError);
  2762. goto end;
  2763. }
  2764. }
  2765. else
  2766. {
  2767. SetfailStatus(m_writewidi);
  2768. Log.WriteErrorLog(SN + " Write WiDi fail");
  2769. MessageBox.Show(LResource.WriteWiDiError);
  2770. goto end;
  2771. }
  2772. }
  2773. //PEK抄写
  2774. if (WritePEK.Checked)
  2775. {
  2776. if (!CommonMethod.IsNumberAndWord(keyInfo.PEK))
  2777. {
  2778. Log.WriteErrorLog("PEK format error!\r\n" + keyInfo.PEK);
  2779. MessageBox.Show(LResource.PEKFormatError + "\r\n" + keyInfo.PEK);
  2780. goto end;
  2781. }
  2782. byte[] PEKData = SerialInit.HexToByte(keyInfo.PEK);
  2783. Log.WriteInfoLog("Write PEK...");
  2784. if (SerialCMD.SetFireTVPEK(TVPort, PEKData, out result, out data, out error, SerailDelay))
  2785. {
  2786. SetsuccessStatus(m_writePEK);
  2787. keycontent += "pek=" + keyInfo.PEK + "&";
  2788. Log.WriteInfoLog("Check PEK...");
  2789. if (writeCheckNow.PEKCheckcheck ? SerialCMD.CheckFireTVPEK(TVPort, out result, out data, out error, SerailDelay) : true)
  2790. {
  2791. SetsuccessStatus(m_checkPEK);
  2792. Log.WriteInfoLog("Read PEK...");
  2793. if (readCheckNow.PEKReadcheck ? SerialCMD.ReadFireTVPEK(TVPort, out result, out data, out error, SerailDelay) : true)
  2794. {
  2795. if (readCheckNow.PEKReadcheck)
  2796. {
  2797. if (SerialInit.BytesCompare_Base64(data, PEKData))
  2798. {
  2799. SetsuccessStatus(m_readPEK);
  2800. }
  2801. else
  2802. {
  2803. SetfailStatus(m_readPEK);
  2804. Log.WriteErrorLog(SN + " contrast PEK fail");
  2805. MessageBox.Show(LResource.ContrastPEKError);
  2806. goto end;
  2807. }
  2808. }
  2809. }
  2810. else
  2811. {
  2812. SetfailStatus(m_readPEK);
  2813. Log.WriteErrorLog(SN + " read PEK fail");
  2814. MessageBox.Show(LResource.ReadPEKError);
  2815. goto end;
  2816. }
  2817. }
  2818. else
  2819. {
  2820. SetfailStatus(m_checkPEK);
  2821. Log.WriteErrorLog(SN + " check PEK fail");
  2822. MessageBox.Show(LResource.CheckPEKError);
  2823. goto end;
  2824. }
  2825. }
  2826. else
  2827. {
  2828. SetfailStatus(m_writePEK);
  2829. Log.WriteErrorLog(SN + " Write PEK fail");
  2830. MessageBox.Show(LResource.WritePEKError);
  2831. goto end;
  2832. }
  2833. }
  2834. //Youtube key抄写
  2835. if (WriteYouTube.Checked)
  2836. {
  2837. if (!CommonMethod.IsNumberAndWord(keyInfo.YouTube_KEY))
  2838. {
  2839. Log.WriteErrorLog("YouTube format error!\r\n" + keyInfo.YouTube_KEY);
  2840. MessageBox.Show(LResource.YouTubeFormatError + "\r\n" + keyInfo.YouTube_KEY);
  2841. goto end;
  2842. }
  2843. byte[] YouTubeData = SerialInit.HexToByte(keyInfo.YouTube_KEY);
  2844. Log.WriteInfoLog("Write YouTube key...");
  2845. if (SerialCMD.SetFireTVYoutube(TVPort, YouTubeData, out result, out data, out error, SerailDelay))
  2846. {
  2847. SetsuccessStatus(m_writeYouTube);
  2848. keycontent += "youtubekey=" + keyInfo.YouTube_KEY + "&";
  2849. Log.WriteInfoLog("Check YouTube_KEY...");
  2850. if (writeCheckNow.YouTubeCheckcheck ? SerialCMD.CheckFireTVYoutube(TVPort, out result, out data, out error, SerailDelay) : true)
  2851. {
  2852. SetsuccessStatus(m_checkYouTube);
  2853. Log.WriteInfoLog("Read YouTube_KEY...");
  2854. if (readCheckNow.YouTubeReadcheck ? SerialCMD.ReadFireTVYoutube(TVPort, out result, out data, out error, SerailDelay) : true)
  2855. {
  2856. if (readCheckNow.YouTubeReadcheck)
  2857. {
  2858. if (SerialInit.BytesCompare_Base64(data, YouTubeData))
  2859. {
  2860. SetsuccessStatus(m_readYouTube);
  2861. }
  2862. else
  2863. {
  2864. SetfailStatus(m_readYouTube);
  2865. Log.WriteErrorLog(SN + " contrast YouTube_KEY fail");
  2866. MessageBox.Show(LResource.ContrastYouTubeError);
  2867. goto end;
  2868. }
  2869. }
  2870. }
  2871. else
  2872. {
  2873. SetfailStatus(m_readYouTube);
  2874. Log.WriteErrorLog(SN + " read YouTube_KEY fail");
  2875. MessageBox.Show(LResource.ReadYouTubeError);
  2876. goto end;
  2877. }
  2878. }
  2879. else
  2880. {
  2881. SetfailStatus(m_checkYouTube);
  2882. Log.WriteErrorLog(SN + " check YouTube_KEY fail");
  2883. MessageBox.Show(LResource.CheckYouTubeError);
  2884. goto end;
  2885. }
  2886. }
  2887. else
  2888. {
  2889. SetfailStatus(m_writeYouTube);
  2890. Log.WriteErrorLog(SN + " Write YouTube_KEY fail");
  2891. MessageBox.Show(LResource.WriteYouTubeError);
  2892. goto end;
  2893. }
  2894. }
  2895. //Widevine KEY抄写
  2896. if (WriteWidevine.Checked)
  2897. {
  2898. if (!CommonMethod.IsNumberAndWord(keyInfo.Widevine))
  2899. {
  2900. Log.WriteErrorLog("Widevine format error!\r\n" + keyInfo.Widevine);
  2901. MessageBox.Show(LResource.WidevineFormatError + "\r\n" + keyInfo.Widevine);
  2902. goto end;
  2903. }
  2904. byte[] WidevineData = SerialInit.HexToByte(keyInfo.Widevine);
  2905. Log.WriteInfoLog("Write Widevine...");
  2906. if (SerialCMD.SetWidevine(TVPort, WidevineData, out result, out data, out error, SerailDelay))
  2907. {
  2908. SetsuccessStatus(m_writewidevine);
  2909. keycontent += "widevine=" + keyInfo.Widevine + "&";
  2910. Log.WriteInfoLog("Check Widevine...");
  2911. if (writeCheckNow.WidevineCheckcheck ? SerialCMD.CheckWidevine(TVPort, out result, out data, out error, SerailDelay) : true)
  2912. {
  2913. SetsuccessStatus(m_checkwidevine);
  2914. Log.WriteInfoLog("Read Widevine...");
  2915. if (readCheckNow.WidevineReadcheck ? SerialCMD.GetWidevine(TVPort, out result, out data, out error, SerailDelay) : true)
  2916. {
  2917. if (readCheckNow.WidevineReadcheck)
  2918. {
  2919. if (CommonMethod.CompareMD5(WidevineData, data))
  2920. {
  2921. SetsuccessStatus(m_readwidevine);
  2922. }
  2923. else
  2924. {
  2925. if (SerialInit.BytesCompare_Base64(data, WidevineData))
  2926. {
  2927. SetsuccessStatus(m_readwidevine);
  2928. }
  2929. else
  2930. {
  2931. SetfailStatus(m_readwidevine);
  2932. Log.WriteErrorLog(SN + " contrast Widevine fail");
  2933. MessageBox.Show(LResource.ContrastWidevineError);
  2934. goto end;
  2935. }
  2936. }
  2937. }
  2938. }
  2939. else
  2940. {
  2941. SetfailStatus(m_readwidevine);
  2942. Log.WriteErrorLog(SN + " read Widevine fail");
  2943. MessageBox.Show(LResource.ReadWidevineError);
  2944. goto end;
  2945. }
  2946. }
  2947. else
  2948. {
  2949. SetfailStatus(m_checkwidevine);
  2950. Log.WriteErrorLog(SN + " check Widevine fail");
  2951. MessageBox.Show(LResource.CheckWidevineError);
  2952. goto end;
  2953. }
  2954. }
  2955. else
  2956. {
  2957. SetfailStatus(m_writewidevine);
  2958. Log.WriteErrorLog(SN + " Write Widevine fail");
  2959. MessageBox.Show(LResource.WriteWidevineError);
  2960. goto end;
  2961. }
  2962. }
  2963. //CI plus KEY抄写
  2964. if (WriteCiplus.Checked)
  2965. {
  2966. if (!CommonMethod.IsNumberAndWord(keyInfo.CI_plus))
  2967. {
  2968. Log.WriteErrorLog("CI_plus format error!\r\n" + keyInfo.CI_plus);
  2969. MessageBox.Show(LResource.CI_plusFormatError + "\r\n" + keyInfo.CI_plus);
  2970. goto end;
  2971. }
  2972. byte[] CiplusData = SerialInit.HexToByte(keyInfo.CI_plus);
  2973. Log.WriteInfoLog("Write CI plus...");
  2974. if (SerialCMD.SetCiKey(TVPort, CiplusData, out result, out data, out error, SerailDelay))
  2975. {
  2976. SetsuccessStatus(m_writeci);
  2977. keycontent += "cikey=" + keyInfo.CI_plus + "&";
  2978. Log.WriteInfoLog("Check CI plus...");
  2979. if (writeCheckNow.CI_plusCheckcheck ? SerialCMD.CheckCikey(TVPort, out result, out data, out error, SerailDelay) : true)
  2980. {
  2981. SetsuccessStatus(m_checkci);
  2982. Log.WriteInfoLog("Read CI plus...");
  2983. if (readCheckNow.CI_plusReadcheck ? SerialCMD.GetCiKey(TVPort, out result, out data, out error, SerailDelay) : true)
  2984. {
  2985. if (readCheckNow.CI_plusReadcheck)
  2986. {
  2987. if (CommonMethod.CompareMD5(CiplusData, data))
  2988. {
  2989. SetsuccessStatus(m_readci);
  2990. }
  2991. else
  2992. {
  2993. if (SerialInit.BytesCompare_Base64(data, CiplusData))
  2994. {
  2995. SetsuccessStatus(m_readci);
  2996. }
  2997. else
  2998. {
  2999. SetfailStatus(m_readci);
  3000. Log.WriteErrorLog(SN + " contrast CI plus fail");
  3001. MessageBox.Show(LResource.ContrastCIError);
  3002. goto end;
  3003. }
  3004. }
  3005. }
  3006. }
  3007. else
  3008. {
  3009. SetfailStatus(m_readci);
  3010. Log.WriteErrorLog(SN + " read CI plus fail");
  3011. MessageBox.Show(LResource.ReadCIError);
  3012. goto end;
  3013. }
  3014. }
  3015. else
  3016. {
  3017. SetfailStatus(m_checkci);
  3018. Log.WriteErrorLog(SN + " check CI plus fail");
  3019. MessageBox.Show(LResource.CheckCIError);
  3020. goto end;
  3021. }
  3022. }
  3023. else
  3024. {
  3025. SetfailStatus(m_writeci);
  3026. Log.WriteErrorLog(SN + " Write CI plus fail");
  3027. MessageBox.Show(LResource.WriteCIError);
  3028. goto end;
  3029. }
  3030. }
  3031. //Attestation KEY抄写
  3032. if (WriteAttestation.Checked)
  3033. {
  3034. if (!CommonMethod.IsNumberAndWord(keyInfo.Attestation))
  3035. {
  3036. Log.WriteErrorLog("Attestation key format error!\r\n" + keyInfo.Attestation);
  3037. MessageBox.Show(LResource.AttestationFormatError + "\r\n" + keyInfo.Attestation);
  3038. goto end;
  3039. }
  3040. byte[] AttestationData = SerialInit.HexToByte(keyInfo.Attestation);
  3041. Log.WriteInfoLog("Write Attestation key...");
  3042. if (SerialCMD.SetAttestationKey(TVPort, AttestationData, out result, out data, out error, SerailDelay))
  3043. {
  3044. SetsuccessStatus(m_writeattestation);
  3045. keycontent += "attestationmd5=" + keyInfo.AttestationMD5 + "&";
  3046. Log.WriteInfoLog("Check Attestation key...");
  3047. if (writeCheckNow.AttestationCheckcheck ? SerialCMD.CheckAttestationKey(TVPort, out result, out data, out error, SerailDelay) : true)
  3048. {
  3049. SetsuccessStatus(m_checkattestation);
  3050. Log.WriteInfoLog("Read Attestation key...");
  3051. if (readCheckNow.AttestationReadcheck ? SerialCMD.GetAttestationKey(TVPort, out result, out data, out error, SerailDelay) : true)
  3052. {
  3053. if (readCheckNow.AttestationReadcheck)
  3054. {
  3055. if (CommonMethod.CompareMD5(AttestationData, data))
  3056. {
  3057. SetsuccessStatus(m_readattestation);
  3058. }
  3059. else
  3060. {
  3061. if (SerialInit.BytesCompare_Base64(data, AttestationData))
  3062. {
  3063. SetsuccessStatus(m_readattestation);
  3064. }
  3065. else
  3066. {
  3067. SetfailStatus(m_readattestation);
  3068. Log.WriteErrorLog(SN + " contrast Attestation key fail");
  3069. MessageBox.Show(LResource.ContrastAttestationError);
  3070. goto end;
  3071. }
  3072. }
  3073. }
  3074. }
  3075. else
  3076. {
  3077. SetfailStatus(m_readattestation);
  3078. Log.WriteErrorLog(SN + " read Attestation key fail");
  3079. MessageBox.Show(LResource.ReadAttestationError);
  3080. goto end;
  3081. }
  3082. }
  3083. else
  3084. {
  3085. SetfailStatus(m_checkattestation);
  3086. Log.WriteErrorLog(SN + " check Attestation key fail");
  3087. MessageBox.Show(LResource.CheckAttestationError);
  3088. goto end;
  3089. }
  3090. }
  3091. else
  3092. {
  3093. SetfailStatus(m_writeattestation);
  3094. Log.WriteErrorLog(SN + " Write Attestation key fail");
  3095. MessageBox.Show(LResource.WriteAttestationError);
  3096. goto end;
  3097. }
  3098. }
  3099. //MGK KEY抄写
  3100. if (WriteMGK.Checked)
  3101. {
  3102. if (!CommonMethod.IsNumberAndWord(keyInfo.MGK))
  3103. {
  3104. Log.WriteErrorLog("MGK format error!\r\n" + keyInfo.MGK);
  3105. MessageBox.Show(LResource.MGKFormatError + "\r\n" + keyInfo.MGK);
  3106. goto end;
  3107. }
  3108. byte[] MGKData = SerialInit.HexToByte(keyInfo.MGK);
  3109. Log.WriteInfoLog("Write MGK...");
  3110. if (SerialCMD.SetMGKKey(TVPort, MGKData, out result, out data, out error, SerailDelay))
  3111. {
  3112. SetsuccessStatus(m_writeMGK);
  3113. keycontent += "mgk=" + keyInfo.MGK + "&";
  3114. Log.WriteInfoLog("Check MGK...");
  3115. if (writeCheckNow.MGKCheckcheck ? SerialCMD.CheckMGKkey(TVPort, out result, out data, out error, SerailDelay) : true)
  3116. {
  3117. SetsuccessStatus(m_checkMGK);
  3118. Log.WriteInfoLog("Read MGK...");
  3119. if (readCheckNow.MGKReadcheck ? SerialCMD.GetMGKKey(TVPort, out result, out data, out error, SerailDelay) : true)
  3120. {
  3121. if (readCheckNow.MGKReadcheck)
  3122. {
  3123. if (CommonMethod.CompareMD5(MGKData, data))
  3124. {
  3125. SetsuccessStatus(m_readMGK);
  3126. }
  3127. else
  3128. {
  3129. if (SerialInit.BytesCompare_Base64(data, MGKData))
  3130. {
  3131. SetsuccessStatus(m_readMGK);
  3132. }
  3133. else
  3134. {
  3135. SetfailStatus(m_readMGK);
  3136. Log.WriteErrorLog(SN + " contrast MGK fail");
  3137. MessageBox.Show(LResource.ContrastMGKError);
  3138. goto end;
  3139. }
  3140. }
  3141. }
  3142. }
  3143. else
  3144. {
  3145. SetfailStatus(m_readMGK);
  3146. Log.WriteErrorLog(SN + " read MGK fail");
  3147. MessageBox.Show(LResource.ReadMGKError);
  3148. goto end;
  3149. }
  3150. }
  3151. else
  3152. {
  3153. SetfailStatus(m_checkMGK);
  3154. Log.WriteErrorLog(SN + " check MGK fail");
  3155. MessageBox.Show(LResource.CheckMGKError);
  3156. goto end;
  3157. }
  3158. }
  3159. else
  3160. {
  3161. SetfailStatus(m_writeMGK);
  3162. Log.WriteErrorLog(SN + " Write MGK fail");
  3163. MessageBox.Show(LResource.WriteMGKError);
  3164. goto end;
  3165. }
  3166. }
  3167. //Fairplay KEY抄写
  3168. if (WriteFairplay.Checked)
  3169. {
  3170. if (!CommonMethod.IsNumberAndWord(keyInfo.Fairplay))
  3171. {
  3172. Log.WriteErrorLog("Fairplay format error!\r\n" + keyInfo.Fairplay);
  3173. MessageBox.Show(LResource.FairplayFormatError + "\r\n" + keyInfo.Fairplay);
  3174. goto end;
  3175. }
  3176. byte[] FairplayData = SerialInit.HexToByte(keyInfo.Fairplay);
  3177. Log.WriteInfoLog("Write Fairplay...");
  3178. if (SerialCMD.SetFireTVFairplay(TVPort, FairplayData, out result, out data, out error, SerailDelay))
  3179. {
  3180. SetsuccessStatus(m_writeFairplay);
  3181. keycontent += "fairplay=" + keyInfo.Fairplay + "&";
  3182. Log.WriteInfoLog("Check Fairplay...");
  3183. if (writeCheckNow.FairplayCheckcheck ? SerialCMD.CheckFireTVFairplay(TVPort, out result, out data, out error, SerailDelay) : true)
  3184. {
  3185. SetsuccessStatus(m_checkFairplay);
  3186. Log.WriteInfoLog("Read Fairplay...");
  3187. if (readCheckNow.FairplayReadcheck ? SerialCMD.ReadFireTVFairplay(TVPort, out result, out data, out error, SerailDelay) : true)
  3188. {
  3189. if (readCheckNow.FairplayReadcheck)
  3190. {
  3191. if (SerialInit.BytesCompare_Base64(data, FairplayData))
  3192. {
  3193. SetsuccessStatus(m_readFairplay);
  3194. }
  3195. else
  3196. {
  3197. SetfailStatus(m_readFairplay);
  3198. Log.WriteErrorLog(SN + " contrast Fairplay fail");
  3199. MessageBox.Show(LResource.ContrastFairplayError);
  3200. goto end;
  3201. }
  3202. }
  3203. }
  3204. else
  3205. {
  3206. SetfailStatus(m_readFairplay);
  3207. Log.WriteErrorLog(SN + " read Fairplay fail");
  3208. MessageBox.Show(LResource.ReadFairplayError);
  3209. goto end;
  3210. }
  3211. }
  3212. else
  3213. {
  3214. SetfailStatus(m_checkFairplay);
  3215. Log.WriteErrorLog(SN + " check Fairplay fail");
  3216. MessageBox.Show(LResource.CheckFairplayError);
  3217. goto end;
  3218. }
  3219. }
  3220. else
  3221. {
  3222. SetfailStatus(m_writeFairplay);
  3223. Log.WriteErrorLog(SN + " Write Fairplay fail");
  3224. MessageBox.Show(LResource.WriteFairplayError);
  3225. goto end;
  3226. }
  3227. }
  3228. //ECP KEY抄写
  3229. if (WriteECP.Checked)
  3230. {
  3231. if (!CommonMethod.IsNumberAndWord(keyInfo.ECP))
  3232. {
  3233. Log.WriteErrorLog("ECP format error!\r\n" + keyInfo.ECP);
  3234. MessageBox.Show(LResource.ECPFormatError + "\r\n" + keyInfo.ECP);
  3235. goto end;
  3236. }
  3237. byte[] ECPData = SerialInit.HexToByte(keyInfo.ECP);
  3238. Log.WriteInfoLog("Write ECP...");
  3239. if (SerialCMD.SetECP(TVPort, ECPData, out result, out data, out error, SerailDelay))
  3240. {
  3241. SetsuccessStatus(m_writeECP);
  3242. keycontent += "ecp=" + keyInfo.ECP + "&";
  3243. Log.WriteInfoLog("Check ECP...");
  3244. if (writeCheckNow.ECPCheckcheck ? SerialCMD.CheckECP(TVPort, out result, out data, out error, SerailDelay) : true)
  3245. {
  3246. SetsuccessStatus(m_checkECP);
  3247. Log.WriteInfoLog("Read ECP...");
  3248. if (readCheckNow.ECPReadcheck ? SerialCMD.GetECP(TVPort, out result, out data, out error, SerailDelay) : true)
  3249. {
  3250. if (readCheckNow.ECPReadcheck)
  3251. {
  3252. if (SerialInit.BytesCompare_Base64(data, ECPData))
  3253. {
  3254. SetsuccessStatus(m_readECP);
  3255. }
  3256. else
  3257. {
  3258. SetfailStatus(m_readECP);
  3259. Log.WriteErrorLog(SN + " contrast ECP fail");
  3260. MessageBox.Show(LResource.ContrastECPError);
  3261. goto end;
  3262. }
  3263. }
  3264. }
  3265. else
  3266. {
  3267. SetfailStatus(m_readECP);
  3268. Log.WriteErrorLog(SN + " read ECP fail");
  3269. MessageBox.Show(LResource.ReadECPError);
  3270. goto end;
  3271. }
  3272. }
  3273. else
  3274. {
  3275. SetfailStatus(m_checkECP);
  3276. Log.WriteErrorLog(SN + " check ECP fail");
  3277. MessageBox.Show(LResource.CheckECPError);
  3278. goto end;
  3279. }
  3280. }
  3281. else
  3282. {
  3283. SetfailStatus(m_writeECP);
  3284. Log.WriteErrorLog(SN + " Write ECP fail");
  3285. MessageBox.Show(LResource.WriteECPError);
  3286. goto end;
  3287. }
  3288. }
  3289. //LEK抄写
  3290. if (WriteLEK.Checked)
  3291. {
  3292. if (!CommonMethod.IsNumberAndWord(keyInfo.LEK))
  3293. {
  3294. Log.WriteErrorLog("LEK format error!\r\n" + keyInfo.LEK);
  3295. MessageBox.Show(LResource.LEKFormatError + "\r\n" + keyInfo.LEK);
  3296. goto end;
  3297. }
  3298. byte[] LEKData = SerialInit.HexToByte(keyInfo.LEK);
  3299. Log.WriteInfoLog("Write LEK...");
  3300. if (SerialCMD.SetFireTVLEK(TVPort, LEKData, out result, out data, out error, SerailDelay))
  3301. {
  3302. SetsuccessStatus(m_writeLEK);
  3303. keycontent += "lek=" + keyInfo.LEK + "&";
  3304. Log.WriteInfoLog("Check LEK...");
  3305. if (writeCheckNow.LEKCheckcheck ? SerialCMD.CheckFireTVLEK(TVPort, out result, out data, out error, SerailDelay) : true)
  3306. {
  3307. SetsuccessStatus(m_checkLEK);
  3308. Log.WriteInfoLog("Read LEK...");
  3309. if (readCheckNow.LEKReadcheck ? SerialCMD.ReadFireTVLEK(TVPort, out result, out data, out error, SerailDelay) : true)
  3310. {
  3311. if (readCheckNow.LEKReadcheck)
  3312. {
  3313. if (SerialInit.BytesCompare_Base64(data, LEKData))
  3314. {
  3315. SetsuccessStatus(m_readLEK);
  3316. }
  3317. else
  3318. {
  3319. SetfailStatus(m_readLEK);
  3320. Log.WriteErrorLog(SN + " contrast LEK fail");
  3321. MessageBox.Show(LResource.ContrastLEKError);
  3322. goto end;
  3323. }
  3324. }
  3325. }
  3326. else
  3327. {
  3328. SetfailStatus(m_readLEK);
  3329. Log.WriteErrorLog(SN + " read LEK fail");
  3330. MessageBox.Show(LResource.ReadLEKError);
  3331. goto end;
  3332. }
  3333. }
  3334. else
  3335. {
  3336. SetfailStatus(m_checkLEK);
  3337. Log.WriteErrorLog(SN + " check LEK fail");
  3338. MessageBox.Show(LResource.CheckLEKError);
  3339. goto end;
  3340. }
  3341. }
  3342. else
  3343. {
  3344. SetfailStatus(m_writeLEK);
  3345. Log.WriteErrorLog(SN + " Write LEK fail");
  3346. MessageBox.Show(LResource.WriteLEKError);
  3347. goto end;
  3348. }
  3349. }
  3350. //Playready抄写
  3351. if (WritePlayready.Checked)
  3352. {
  3353. if (!CommonMethod.IsNumberAndWord(keyInfo.Playready))
  3354. {
  3355. Log.WriteErrorLog("Playready format error!\r\n" + keyInfo.Playready);
  3356. MessageBox.Show(LResource.PlayreadyFormatError + "\r\n" + keyInfo.Playready);
  3357. goto end;
  3358. }
  3359. byte[] PlayreadyData = SerialInit.HexToByte(keyInfo.Playready);
  3360. Log.WriteInfoLog("Write Playready...");
  3361. if (SerialCMD.SetFireTVPlayready(TVPort, PlayreadyData, out result, out data, out error, SerailDelay))
  3362. {
  3363. SetsuccessStatus(m_writePlayready);
  3364. keycontent += "playready=" + keyInfo.Playready + "&";
  3365. Log.WriteInfoLog("Check Playready...");
  3366. if (writeCheckNow.PlayreadyCheckcheck ? SerialCMD.CheckFireTVPlayready(TVPort, out result, out data, out error, SerailDelay) : true)
  3367. {
  3368. SetsuccessStatus(m_checkPlayready);
  3369. Log.WriteInfoLog("Read Playready...");
  3370. if (readCheckNow.PlayreadyReadcheck ? SerialCMD.ReadFireTVPlayready(TVPort, out result, out data, out error, SerailDelay) : true)
  3371. {
  3372. if (readCheckNow.PlayreadyReadcheck)
  3373. {
  3374. if (CommonMethod.CompareMD5(PlayreadyData, data))
  3375. {
  3376. SetsuccessStatus(m_readPlayready);
  3377. }
  3378. else
  3379. {
  3380. if (SerialInit.BytesCompare_Base64(data, PlayreadyData))
  3381. {
  3382. SetsuccessStatus(m_readPlayready);
  3383. }
  3384. else
  3385. {
  3386. SetfailStatus(m_readPlayready);
  3387. Log.WriteErrorLog(SN + " contrast Playready fail");
  3388. MessageBox.Show(LResource.ContrastPlayreadyError);
  3389. goto end;
  3390. }
  3391. }
  3392. }
  3393. }
  3394. else
  3395. {
  3396. SetfailStatus(m_readPlayready);
  3397. Log.WriteErrorLog(SN + " read Playready fail");
  3398. MessageBox.Show(LResource.ReadPlayreadyError);
  3399. goto end;
  3400. }
  3401. }
  3402. else
  3403. {
  3404. SetfailStatus(m_checkPlayready);
  3405. Log.WriteErrorLog(SN + " check Playready fail");
  3406. MessageBox.Show(LResource.CheckPlayreadyError);
  3407. goto end;
  3408. }
  3409. }
  3410. else
  3411. {
  3412. SetfailStatus(m_writePlayready);
  3413. Log.WriteErrorLog(SN + " Write Playready fail");
  3414. MessageBox.Show(LResource.WritePlayreadyError);
  3415. goto end;
  3416. }
  3417. }
  3418. //Hash抄写
  3419. if (WriteHash.Checked)
  3420. {
  3421. if (!CommonMethod.IsNumberAndWord(keyInfo.Hashkey))
  3422. {
  3423. Log.WriteErrorLog("Hash format error!\r\n" + keyInfo.Hashkey);
  3424. MessageBox.Show(LResource.HashFormatError + "\r\n" + keyInfo.Hashkey);
  3425. goto end;
  3426. }
  3427. byte[] HashData = SerialInit.HexToByte(keyInfo.Hashkey);
  3428. Log.WriteInfoLog("Write Hash...");
  3429. if (SerialCMD.SetFireTVHashkey(TVPort, HashData, out result, out data, out error, SerailDelay))
  3430. {
  3431. SetsuccessStatus(m_writeHash);
  3432. keycontent += "hash=" + keyInfo.Hashkey + "&";
  3433. Log.WriteInfoLog("Check Hash...");
  3434. if (writeCheckNow.HashCheckcheck ? SerialCMD.CheckFireTVHashkey(TVPort, out result, out data, out error, SerailDelay) : true)
  3435. {
  3436. SetsuccessStatus(m_checkHash);
  3437. Log.WriteInfoLog("Read Hash...");
  3438. if (readCheckNow.HashReadcheck ? SerialCMD.ReadFireTVHashkey(TVPort, out result, out data, out error, SerailDelay) : true)
  3439. {
  3440. if (readCheckNow.HashReadcheck)
  3441. {
  3442. if (SerialInit.BytesCompare_Base64(data, HashData))
  3443. {
  3444. SetsuccessStatus(m_readHash);
  3445. }
  3446. else
  3447. {
  3448. SetfailStatus(m_readHash);
  3449. Log.WriteErrorLog(SN + " contrast Hash fail");
  3450. MessageBox.Show(LResource.ContrastHashError);
  3451. goto end;
  3452. }
  3453. }
  3454. }
  3455. else
  3456. {
  3457. SetfailStatus(m_readHash);
  3458. Log.WriteErrorLog(SN + " read Hash fail");
  3459. MessageBox.Show(LResource.ReadHashError);
  3460. goto end;
  3461. }
  3462. }
  3463. else
  3464. {
  3465. SetfailStatus(m_checkHash);
  3466. Log.WriteErrorLog(SN + " check Hash fail");
  3467. MessageBox.Show(LResource.CheckHashError);
  3468. goto end;
  3469. }
  3470. }
  3471. else
  3472. {
  3473. SetfailStatus(m_writeHash);
  3474. Log.WriteErrorLog(SN + " Write Hash fail");
  3475. MessageBox.Show(LResource.WriteHashError);
  3476. goto end;
  3477. }
  3478. }
  3479. //频道预置
  3480. if (FunctionSettingNow.WriteChannel)
  3481. {
  3482. Log.WriteInfoLog("setting channel...");
  3483. if (SerialCMD.SetChannel(TVPort, FunctionSettingNow.ChannelCode, out result, out data, out error, SerailDelay))
  3484. {
  3485. /*
  3486. Log.WriteInfoLog("getting channel...");
  3487. if (SerialCMD.GetChannel(TVPort, out result, out data, out error))
  3488. {
  3489. if(SerialInit.BytesCompare_Base64(data, FunctionSettingNow.ChannelCode))
  3490. {
  3491. }
  3492. else
  3493. {
  3494. Log.WriteErrorLog(SN + " get different channel");
  3495. goto end;
  3496. }
  3497. }
  3498. else
  3499. {
  3500. Log.WriteErrorLog(SN + " fail to get channel");
  3501. goto end;
  3502. }*/
  3503. Log.WriteInfoLog(SN + " set channel success");
  3504. SetcolorStatus(ChannelText, Color.FromArgb(128, 255, 128));
  3505. }
  3506. else
  3507. {
  3508. Log.WriteErrorLog(SN + " fail to set channel");
  3509. MessageBox.Show(LResource.SetChannelError);
  3510. goto end;
  3511. }
  3512. }
  3513. //OSD语言设置
  3514. if (FunctionSettingNow.WriteOSD)
  3515. {
  3516. Log.WriteInfoLog("setting OSD language...");
  3517. if (SerialCMD.SetOSDLanguage(TVPort, FunctionSettingNow.OSDLCode, out result, out data, out error, SerailDelay))
  3518. {
  3519. if (readCheckNow.OSDReadcheck)
  3520. {
  3521. Log.WriteInfoLog("getting OSD language...");
  3522. if (SerialCMD.GetOSDLanguage(TVPort, out result, out data, out error, SerailDelay))
  3523. {
  3524. if (SerialInit.BytesCompare_Base64(data, FunctionSettingNow.OSDLCode))
  3525. {
  3526. SetcolorStatus(OSDText, Color.FromArgb(128, 255, 128));
  3527. }
  3528. else
  3529. {
  3530. Log.WriteErrorLog(SN + " get different OSD language");
  3531. MessageBox.Show(LResource.ContrastOSDLError);
  3532. goto end;
  3533. }
  3534. }
  3535. else
  3536. {
  3537. Log.WriteErrorLog(SN + " fail to get OSD language");
  3538. MessageBox.Show(LResource.GetOSDLError);
  3539. goto end;
  3540. }
  3541. }
  3542. else
  3543. Log.WriteInfoLog("skip read OSD language...");
  3544. }
  3545. else
  3546. {
  3547. Log.WriteErrorLog(SN + " fail to set OSD language");
  3548. MessageBox.Show(LResource.SetOSDLError);
  3549. goto end;
  3550. }
  3551. }
  3552. //Shop语言设置
  3553. if (FunctionSettingNow.WriteSHOP)
  3554. {
  3555. Log.WriteInfoLog("setting SHOP language...");
  3556. if (SerialCMD.SetShopLanguage(TVPort, FunctionSettingNow.ShopLCode, out result, out data, out error, SerailDelay))
  3557. {
  3558. if (readCheckNow.SHOPReadcheck)
  3559. {
  3560. Log.WriteInfoLog("getting SHOP language...");
  3561. if (SerialCMD.GetShopLanguage(TVPort, out result, out data, out error, SerailDelay))
  3562. {
  3563. if (SerialInit.BytesCompare_Base64(data, FunctionSettingNow.ShopLCode))
  3564. {
  3565. SetcolorStatus(SHOPText, Color.FromArgb(128, 255, 128));
  3566. }
  3567. else
  3568. {
  3569. Log.WriteErrorLog(SN + " get different SHOP language");
  3570. MessageBox.Show(LResource.ContrastSHOPLError);
  3571. goto end;
  3572. }
  3573. }
  3574. else
  3575. {
  3576. Log.WriteErrorLog(SN + " fail to get SHOP language");
  3577. MessageBox.Show(LResource.GetSHOPLError);
  3578. goto end;
  3579. }
  3580. }
  3581. else
  3582. Log.WriteInfoLog("skip read SHOP language...");
  3583. }
  3584. else
  3585. {
  3586. Log.WriteErrorLog(SN + " fail to set SHOP language");
  3587. MessageBox.Show(LResource.SetSHOPLError);
  3588. goto end;
  3589. }
  3590. }
  3591. // EDID Pid抄写;
  3592. if (WriteEDIDPID.Checked)
  3593. {
  3594. // 4字节转成整数:0~65535,0x0000~0xffff;
  3595. if (Regex.IsMatch(keyInfo.EDIDPid, "^[A-Za-z0-9]{4}$"))
  3596. {
  3597. byte[] EDIDPidData = SerialInit.strToToHexByte(keyInfo.EDIDPid);
  3598. Log.WriteInfoLog("Write EDID Pid...");
  3599. if (SerialCMD.SetEDIDPid(TVPort, EDIDPidData, out result, out data, out error, SerailDelay))
  3600. {
  3601. SetsuccessStatus(m_writeEDIDPID);
  3602. keycontent += "EDIDPid=" + keyInfo.EDIDPid + "&";
  3603. Log.WriteInfoLog("Read EDID Pid...");
  3604. if (readCheckNow.EDIDPIDReadcheck ? SerialCMD.ReadEDIDPid(TVPort, out result, out data, out error, SerailDelay) : true)
  3605. {
  3606. if (readCheckNow.EDIDPIDReadcheck)
  3607. {
  3608. if (SerialInit.BytesCompare_Base64(data, EDIDPidData))
  3609. {
  3610. SetsuccessStatus(m_readEDIDPID);
  3611. }
  3612. else
  3613. {
  3614. SetfailStatus(m_readEDIDPID);
  3615. Log.WriteErrorLog(SN + " contrast EDID PID fail");
  3616. MessageBox.Show(LResource.ContrastEDIDPIDError);
  3617. goto end;
  3618. }
  3619. }
  3620. }
  3621. else
  3622. {
  3623. SetfailStatus(m_readEDIDPID);
  3624. Log.WriteErrorLog(SN + " read EDID PID fail");
  3625. MessageBox.Show(LResource.ReadEDIDPIDError);
  3626. goto end;
  3627. }
  3628. }
  3629. else
  3630. {
  3631. SetfailStatus(m_writeEDIDPID);
  3632. Log.WriteErrorLog(SN + " Write EDID PID fail");
  3633. MessageBox.Show(LResource.WriteEDIDPidError);
  3634. goto end;
  3635. }
  3636. }
  3637. else
  3638. {
  3639. SetfailStatus(m_writeEDIDPID);
  3640. Log.WriteErrorLog(SN + " The EDID PID Format Error!");
  3641. MessageBox.Show(LResource.EDIDPIDFormatError);
  3642. goto end;
  3643. }
  3644. }
  3645. // EDID Mode Name抄写;
  3646. if (WriteEDIDName.Checked)
  3647. {
  3648. if (Regex.IsMatch(keyInfo.EDIDModelName, @"^[A-Za-z0-9][A-Za-z0-9_ -]{0,12}$"))
  3649. {
  3650. // 长度为13字节;
  3651. byte[] EDIDNameData = Encoding.ASCII.GetBytes(keyInfo.EDIDModelName);
  3652. Log.WriteInfoLog("Write EDID Mode Name...");
  3653. if (SerialCMD.SetEDIDModelName(TVPort, EDIDNameData, out result, out data, out error, SerailDelay))
  3654. {
  3655. SetsuccessStatus(m_writeEDIDName);
  3656. keycontent += "EDIDModeName=" + keyInfo.EDIDModelName + "&";
  3657. Log.WriteInfoLog("Read EDID Mode Name...");
  3658. if (readCheckNow.EDIDModeNameReadcheck ? SerialCMD.ReadEDIDModelName(TVPort, out result, out data, out error, SerailDelay) : true)
  3659. {
  3660. if (readCheckNow.EDIDModeNameReadcheck)
  3661. {
  3662. if (SerialInit.BytesCompare_Base64(data, EDIDNameData))
  3663. {
  3664. SetsuccessStatus(m_readEDIDName);
  3665. }
  3666. else
  3667. {
  3668. SetfailStatus(m_readEDIDName);
  3669. Log.WriteErrorLog(SN + " contrast EDID Mode Name fail");
  3670. MessageBox.Show(LResource.ContrastEDIDModelNameError);
  3671. goto end;
  3672. }
  3673. }
  3674. }
  3675. else
  3676. {
  3677. SetfailStatus(m_readEDIDName);
  3678. Log.WriteErrorLog(SN + " read EDID Mode Name fail");
  3679. MessageBox.Show(LResource.ReadEDIDModelNameError);
  3680. goto end;
  3681. }
  3682. }
  3683. else
  3684. {
  3685. SetfailStatus(m_writeEDIDName);
  3686. Log.WriteErrorLog(SN + " Write EDID Mode Name fail");
  3687. MessageBox.Show(LResource.WriteEDIDModelNameError);
  3688. goto end;
  3689. }
  3690. }
  3691. else
  3692. {
  3693. SetfailStatus(m_writeEDIDName);
  3694. Log.WriteErrorLog(SN + " The EDID Model Name Format Error!");
  3695. MessageBox.Show(LResource.EDIDModelNameFormatError);
  3696. goto end;
  3697. }
  3698. }
  3699. // ACAS Key抄写;
  3700. if (WriteACASKey.Checked)
  3701. {
  3702. byte[] ACASKeyData = SerialInit.HexToByte(keyInfo.ACASKey);
  3703. Log.WriteInfoLog("Write ACAC Key...");
  3704. if (SerialCMD.SetACASKey(TVPort, ACASKeyData, out result, out data, out error, SerailDelay))
  3705. {
  3706. SetsuccessStatus(m_writeACASKey);
  3707. keycontent += "ACACKeyMd5=" + keyInfo.ACASKeyMd5 + "&";
  3708. Log.WriteInfoLog("Check ACAS Key...");
  3709. if (writeCheckNow.ACASKeyCheckcheck ? SerialCMD.CheckACASKey(TVPort, out result, out data, out error, SerailDelay) : true)
  3710. {
  3711. SetsuccessStatus(m_checkACASKey);
  3712. Log.WriteInfoLog("Read ACAS Key...");
  3713. if (readCheckNow.ACASIDReadcheck ? SerialCMD.ReadACASKey(TVPort, out result, out data, out error, SerailDelay) : true)
  3714. {
  3715. if (readCheckNow.ACASIDReadcheck)
  3716. {
  3717. if (CommonMethod.CompareMD5(ACASKeyData, data))
  3718. {
  3719. SetsuccessStatus(m_readACASKey);
  3720. }
  3721. else
  3722. {
  3723. SetfailStatus(m_readACASKey);
  3724. Log.WriteErrorLog(SN + " contrast ACAS Key fail");
  3725. MessageBox.Show(LResource.ContrastACASKeyError);
  3726. goto end;
  3727. }
  3728. }
  3729. }
  3730. else
  3731. {
  3732. SetfailStatus(m_readACASKey);
  3733. Log.WriteErrorLog(SN + " read ACAS Key fail");
  3734. MessageBox.Show(LResource.ReadACASKeyError);
  3735. goto end;
  3736. }
  3737. }
  3738. else
  3739. {
  3740. SetfailStatus(m_checkACASKey);
  3741. Log.WriteErrorLog(SN + " Check ACAS Key fail");
  3742. MessageBox.Show(LResource.WriteACASKeyError);
  3743. goto end;
  3744. }
  3745. }
  3746. else
  3747. {
  3748. SetfailStatus(m_writeACASKey);
  3749. Log.WriteErrorLog(SN + " Write ACAS Key fail");
  3750. MessageBox.Show(LResource.WriteACASKeyError);
  3751. goto end;
  3752. }
  3753. }
  3754. //Project ID 抄写检查
  3755. if (ProjectIDNote.Text != LResource.SkipCovering)
  3756. {
  3757. Log.WriteInfoLog("Write projectID...");
  3758. keycontent += "projectid=" + ProjectIDText.Text + "&";
  3759. if (ProjectIDNote.Text == LResource.Covering || ProjectIDNote.Text == LResource.SkipReadCheck)
  3760. {
  3761. SetspecificText(ProjectIDNote, ProjectIDNote.Text, Color.FromArgb(128, 255, 128));
  3762. byte[] param = CommonMethod.InttoBytelist(Convert.ToInt32(ProjectIDText.Text));
  3763. Log.WriteInfoLog("Set projectID...");
  3764. if (SerialCMD.SetProjectId(TVPort, param, out result, out data, out error, SerailDelay))
  3765. {
  3766. if (ProjectIDNote.Text != LResource.SkipReadCheck)
  3767. {
  3768. Log.WriteInfoLog("Check projectID...");
  3769. if (writeDoneNow.PIDWriteDelay > 0)
  3770. {
  3771. Thread.Sleep(writeDoneNow.PIDWriteDelay);//MS6586切完PID需要强制等待3s
  3772. }
  3773. if (SerialCMD.GetProjectID(TVPort, out result, out data, out error, SerailDelay))
  3774. {
  3775. int readpid2 = CommonMethod.BytelisttoInt(data);
  3776. if (readpid2.ToString() != ProjectIDText.Text)
  3777. {
  3778. SetcolorStatus(ProjectIDText, Color.Red);
  3779. Log.WriteErrorLog(SN + " read project id:" + readpid2.ToString() + "different from written: " + ProjectIDText.Text + " error");
  3780. MessageBox.Show(LResource.ContrastPIDError);
  3781. goto end;
  3782. }
  3783. else
  3784. {
  3785. SetcolorStatus(ProjectIDText, Color.Green);
  3786. }
  3787. }
  3788. else
  3789. {
  3790. SetcolorStatus(ProjectIDText, Color.Red);
  3791. Log.WriteErrorLog(SN + " get project id error");
  3792. MessageBox.Show(LResource.GetPIDError);
  3793. goto end;
  3794. }
  3795. }
  3796. else
  3797. {
  3798. Log.WriteInfoLog("Skip check projectID...");
  3799. }
  3800. }
  3801. else
  3802. {
  3803. SetcolorStatus(ProjectIDText, Color.Red);
  3804. Log.WriteErrorLog(SN + " set project id error");
  3805. MessageBox.Show(LResource.SetPIDError);
  3806. goto end;
  3807. }
  3808. }
  3809. else
  3810. {
  3811. if (SerialCMD.GetProjectID(TVPort, out result, out data, out error, SerailDelay))
  3812. {
  3813. int readpid = CommonMethod.BytelisttoInt(data);
  3814. if (readpid.ToString() != ProjectIDText.Text)
  3815. {
  3816. MessageBoxButtons messButton = MessageBoxButtons.YesNoCancel;
  3817. DialogResult dr = MessageBox.Show(LResource.MainboardPID + readpid.ToString() + LResource.DifferentFromSetting + "\r\n" + LResource.CoveringPID, LResource.Error, messButton);
  3818. if (dr == DialogResult.Yes)
  3819. {
  3820. SetspecificText(ProjectIDNote, LResource.Covering, Color.FromArgb(128, 255, 128));
  3821. byte[] param = CommonMethod.InttoBytelist(Convert.ToInt32(ProjectIDText.Text));
  3822. if (SerialCMD.SetProjectId(TVPort, param, out result, out data, out error, SerailDelay))
  3823. {
  3824. if (writeDoneNow.PIDWriteDelay > 0)
  3825. {
  3826. Thread.Sleep(writeDoneNow.PIDWriteDelay);//MS6586切完PID需要强制等待3s
  3827. }
  3828. Log.WriteInfoLog("Check projectID...");
  3829. if (SerialCMD.GetProjectID(TVPort, out result, out data, out error, SerailDelay))
  3830. {
  3831. int readpid2 = CommonMethod.BytelisttoInt(data);
  3832. if (readpid2.ToString() != ProjectIDText.Text)
  3833. {
  3834. SetcolorStatus(ProjectIDText, Color.Red);
  3835. Log.WriteErrorLog(SN + " read project id:" + readpid2.ToString() + "different from written: " + ProjectIDText.Text + " error");
  3836. MessageBox.Show(LResource.ContrastPIDError);
  3837. goto end;
  3838. }
  3839. else
  3840. {
  3841. SetcolorStatus(ProjectIDText, Color.Green);
  3842. }
  3843. }
  3844. else
  3845. {
  3846. SetcolorStatus(ProjectIDText, Color.Red);
  3847. Log.WriteErrorLog(SN + " get project id error");
  3848. MessageBox.Show(LResource.GetPIDError);
  3849. goto end;
  3850. }
  3851. }
  3852. else
  3853. {
  3854. SetcolorStatus(ProjectIDText, Color.Red);
  3855. Log.WriteErrorLog(SN + " set project id error");
  3856. MessageBox.Show(LResource.SetPIDError);
  3857. goto end;
  3858. }
  3859. }
  3860. else if (dr == DialogResult.No)
  3861. {
  3862. SetspecificText(ProjectIDNote, LResource.SkipCovering, Color.Yellow);
  3863. SetcolorStatus(ProjectIDText, Color.Yellow);
  3864. }
  3865. else
  3866. {
  3867. SetspecificText(ProjectIDNote, readpid.ToString(), Color.Red);
  3868. SetcolorStatus(ProjectIDText, Color.Red);
  3869. goto end;
  3870. }
  3871. }
  3872. else
  3873. {
  3874. SetcolorStatus(ProjectIDText, Color.FromArgb(128, 255, 128));
  3875. }
  3876. }
  3877. else
  3878. {
  3879. Log.WriteErrorLog(SN + " Read ProjectID fail");
  3880. MessageBox.Show(LResource.GetPIDError);
  3881. goto end;
  3882. }
  3883. }
  3884. }
  3885. //检查ClientType
  3886. if (ClientTypeNote.Text != LResource.SkipChecking)
  3887. {
  3888. Log.WriteInfoLog("Read ClientType...");
  3889. if (SerialCMD.GetClientType(TVPort, out result, out data, out error, SerailDelay))
  3890. {
  3891. string ctype = Encoding.ASCII.GetString(data);
  3892. if (ctype != ClientTypeText.Text)
  3893. {
  3894. MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
  3895. DialogResult dr = MessageBox.Show(LResource.MainboardCType + ctype + LResource.differentfromserver + ClientTypeText.Text + "\r\n" + LResource.SkipCTypeChecking, LResource.Error, messButton);
  3896. if (dr == DialogResult.OK)
  3897. {
  3898. SetspecificText(ClientTypeNote, LResource.SkipChecking, Color.Yellow);
  3899. SetcolorStatus(ClientTypeText, Color.Yellow);
  3900. }
  3901. else
  3902. {
  3903. SetspecificText(ClientTypeNote, ctype, Color.Red);
  3904. SetcolorStatus(ClientTypeText, Color.Red);
  3905. goto end;
  3906. }
  3907. }
  3908. else
  3909. {
  3910. SetcolorStatus(ClientTypeText, Color.FromArgb(128, 255, 128));
  3911. }
  3912. }
  3913. else
  3914. {
  3915. Log.WriteErrorLog(SN + " Read ClientType fail");
  3916. MessageBox.Show(LResource.ReadCTypeError);
  3917. goto end;
  3918. }
  3919. }
  3920. //白平衡初始化
  3921. if (FunctionSettingNow.WBInit)
  3922. {
  3923. Log.WriteInfoLog("WhiteBalance init...");
  3924. if (SerialCMD.WBInit(TVPort, out result, out data, out error, SerailDelay))
  3925. {
  3926. }
  3927. else
  3928. {
  3929. Log.WriteErrorLog(SN + " WhiteBalance ini fail");
  3930. MessageBox.Show(LResource.WBInitError);
  3931. goto end;
  3932. }
  3933. }
  3934. //白平衡赋值
  3935. if (FunctionSettingNow.WriteWB)
  3936. {
  3937. Log.WriteInfoLog("Set normal RGB...");
  3938. if (SerialCMD.SetWBNormal(TVPort, FunctionSettingNow.NormalRGB, out result, out data, out error, SerailDelay))
  3939. {
  3940. Log.WriteInfoLog("Set cool RGB...");
  3941. if (SerialCMD.SetWBCool(TVPort, FunctionSettingNow.CoolRGB, out result, out data, out error, SerailDelay))
  3942. {
  3943. Log.WriteInfoLog("Set warm RGB...");
  3944. if (SerialCMD.SetWBWarm(TVPort, FunctionSettingNow.WarmRGB, out result, out data, out error, SerailDelay))
  3945. {
  3946. SetcolorStatus(WBPathText, Color.FromArgb(128, 255, 128));
  3947. }
  3948. else
  3949. {
  3950. Log.WriteErrorLog(SN + " Set warm RGB fail");
  3951. MessageBox.Show(LResource.SetWarmError);
  3952. goto end;
  3953. }
  3954. keycontent += "wbNormal=" + FunctionSettingNow.NormalRGB[0].ToString() + ":" + FunctionSettingNow.NormalRGB[1].ToString() + ":" + FunctionSettingNow.NormalRGB[2].ToString() + "&" + "wbCool=" + FunctionSettingNow.CoolRGB[0].ToString() + ":" + FunctionSettingNow.CoolRGB[1].ToString() + ":" + FunctionSettingNow.CoolRGB[2].ToString() + "&" + "wbWarm=" + FunctionSettingNow.WarmRGB[0].ToString() + ":" + FunctionSettingNow.WarmRGB[1].ToString() + ":" + FunctionSettingNow.WarmRGB[2].ToString() + "&";
  3955. }
  3956. else
  3957. {
  3958. Log.WriteErrorLog(SN + " Set cool RGB fail");
  3959. MessageBox.Show(LResource.SetCoolError);
  3960. goto end;
  3961. }
  3962. }
  3963. else
  3964. {
  3965. Log.WriteErrorLog(SN + " Set normal RGB fail");
  3966. MessageBox.Show(LResource.SetNormalError);
  3967. goto end;
  3968. }
  3969. }
  3970. //Roku客户服务信息抄写
  3971. if (midListNow.rokuCustomer != null)
  3972. {
  3973. string brand = midListNow.rokuCustomer.brand;
  3974. Log.WriteInfoLog("Write Roku brand...");
  3975. if (SerialCMD.SetROKUBrand(TVPort, Encoding.ASCII.GetBytes(brand), out result, out data, out error, SerailDelay))
  3976. {
  3977. Log.WriteInfoLog("Check Roku brand...");
  3978. if (SerialCMD.CheckROKUBrand(TVPort, out result, out data, out error, SerailDelay))
  3979. {
  3980. Log.WriteInfoLog("Read Roku brand...");
  3981. if (SerialCMD.GetROKUBrand(TVPort, out result, out data, out error, SerailDelay))
  3982. {
  3983. if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(brand)))
  3984. {
  3985. Log.WriteInfoLog("ROKU brand 写入成功:" + Encoding.ASCII.GetString(data));
  3986. }
  3987. else
  3988. {
  3989. MessageBox.Show(LResource.CompareRokuBrandFail);
  3990. goto end;
  3991. }
  3992. }
  3993. else
  3994. {
  3995. MessageBox.Show(LResource.ReadRokuBrandFail);
  3996. goto end;
  3997. }
  3998. }
  3999. else
  4000. {
  4001. MessageBox.Show(LResource.CheckRokuBrandFail);
  4002. goto end;
  4003. }
  4004. }
  4005. else
  4006. {
  4007. MessageBox.Show(LResource.WriteRokuBrandFail);
  4008. goto end;
  4009. }
  4010. string model = midListNow.rokuCustomer.oemmodel;
  4011. Log.WriteInfoLog("Write Roku model...");
  4012. if (SerialCMD.SetModelName(TVPort, Encoding.ASCII.GetBytes(model), out result, out data, out error, SerailDelay))
  4013. {
  4014. Log.WriteInfoLog("Check Roku model...");
  4015. if (SerialCMD.CheckModelName(TVPort, out result, out data, out error, SerailDelay))
  4016. {
  4017. Log.WriteInfoLog("Read Roku model...");
  4018. if (SerialCMD.GetModelName(TVPort, out result, out data, out error, SerailDelay))
  4019. {
  4020. if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(model)))
  4021. {
  4022. Log.WriteInfoLog("ROKU model 写入成功:" + Encoding.ASCII.GetString(data));
  4023. }
  4024. else
  4025. {
  4026. MessageBox.Show(LResource.CompareRokuModelFail);
  4027. goto end;
  4028. }
  4029. }
  4030. else
  4031. {
  4032. MessageBox.Show(LResource.ReadRokuModelFail);
  4033. goto end;
  4034. }
  4035. }
  4036. else
  4037. {
  4038. MessageBox.Show(LResource.CheckRokuModelFail);
  4039. goto end;
  4040. }
  4041. }
  4042. else
  4043. {
  4044. MessageBox.Show(LResource.WriteRokuModelFail);
  4045. goto end;
  4046. }
  4047. string[] dateInit = midListNow.rokuCustomer.productiondate.Split('-');
  4048. byte[] productdate = new byte[3] { Convert.ToByte(dateInit[0]), Convert.ToByte(dateInit[1]), Convert.ToByte(dateInit[2]) };
  4049. Log.WriteInfoLog("Write Roku production date...");
  4050. if (SerialCMD.SetROKUProductionDate(TVPort, productdate, out result, out data, out error, SerailDelay))
  4051. {
  4052. Log.WriteInfoLog("Check Roku production date...");
  4053. if (SerialCMD.CheckROKUProductionDate(TVPort, out result, out data, out error, SerailDelay))
  4054. {
  4055. Log.WriteInfoLog("Read Roku production date...");
  4056. if (SerialCMD.GetROKUProductionDate(TVPort, out result, out data, out error, SerailDelay))
  4057. {
  4058. string date = "20" + productdate[0].ToString() + "." + productdate[1].ToString() + ".WW" + productdate[2].ToString();
  4059. if (Encoding.ASCII.GetString(data) == date)
  4060. {
  4061. Log.WriteInfoLog("ROKU production date 写入成功:" + Encoding.ASCII.GetString(data));
  4062. }
  4063. else
  4064. {
  4065. MessageBox.Show(LResource.CompareRokuDateFail);
  4066. goto end;
  4067. }
  4068. }
  4069. else
  4070. {
  4071. MessageBox.Show(LResource.ReadRokuDateFail);
  4072. goto end;
  4073. }
  4074. }
  4075. else
  4076. {
  4077. MessageBox.Show(LResource.CheckRokuDateFail);
  4078. goto end;
  4079. }
  4080. }
  4081. else
  4082. {
  4083. MessageBox.Show(LResource.WriteRokuDateFail);
  4084. goto end;
  4085. }
  4086. string region = midListNow.rokuCustomer.region;
  4087. Log.WriteInfoLog("Write Roku region...");
  4088. if (SerialCMD.SetROKURegion(TVPort, Encoding.ASCII.GetBytes(region), out result, out data, out error, SerailDelay))
  4089. {
  4090. Log.WriteInfoLog("Check Roku region...");
  4091. if (SerialCMD.CheckROKURegion(TVPort, out result, out data, out error, SerailDelay))
  4092. {
  4093. Log.WriteInfoLog("Read Roku region...");
  4094. if (SerialCMD.GetROKURegion(TVPort, out result, out data, out error, SerailDelay))
  4095. {
  4096. if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(region)))
  4097. {
  4098. Log.WriteInfoLog("ROKU region 写入成功:" + Encoding.ASCII.GetString(data));
  4099. }
  4100. else
  4101. {
  4102. MessageBox.Show(LResource.CompareRokuRegionFail);
  4103. goto end;
  4104. }
  4105. }
  4106. else
  4107. {
  4108. MessageBox.Show(LResource.ReadRokuRegionFail);
  4109. goto end;
  4110. }
  4111. }
  4112. else
  4113. {
  4114. MessageBox.Show(LResource.CheckRokuRegionFail);
  4115. goto end;
  4116. }
  4117. }
  4118. else
  4119. {
  4120. MessageBox.Show(LResource.WriteRokuRegionFail);
  4121. goto end;
  4122. }
  4123. string phone = midListNow.rokuCustomer.supportphone;
  4124. Log.WriteInfoLog("Write Roku phone...");
  4125. if (SerialCMD.SetROKUSupportPhone(TVPort, Encoding.ASCII.GetBytes(phone), out result, out data, out error, SerailDelay))
  4126. {
  4127. Log.WriteInfoLog("Check Roku phone...");
  4128. if (SerialCMD.CheckROKUSupportPhone(TVPort, out result, out data, out error, SerailDelay))
  4129. {
  4130. Log.WriteInfoLog("Read Roku phone...");
  4131. if (SerialCMD.GetROKUSupportPhone(TVPort, out result, out data, out error, SerailDelay))
  4132. {
  4133. if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(phone)))
  4134. {
  4135. Log.WriteInfoLog("ROKU phone 写入成功:" + Encoding.ASCII.GetString(data));
  4136. }
  4137. else
  4138. {
  4139. MessageBox.Show(LResource.CompareRokuPhoneFail);
  4140. goto end;
  4141. }
  4142. }
  4143. else
  4144. {
  4145. MessageBox.Show(LResource.ReadRokuPhoneFail);
  4146. goto end;
  4147. }
  4148. }
  4149. else
  4150. {
  4151. MessageBox.Show(LResource.CheckRokuPhoneFail);
  4152. goto end;
  4153. }
  4154. }
  4155. else
  4156. {
  4157. MessageBox.Show(LResource.WriteRokuPhoneFail);
  4158. goto end;
  4159. }
  4160. string url = midListNow.rokuCustomer.supporturl;
  4161. Log.WriteInfoLog("Write Roku url...");
  4162. if (SerialCMD.SetROKUSupportURL(TVPort, Encoding.ASCII.GetBytes(url), out result, out data, out error, SerailDelay))
  4163. {
  4164. Log.WriteInfoLog("Check Roku url...");
  4165. if (SerialCMD.CheckROKUSupportURL(TVPort, out result, out data, out error, SerailDelay))
  4166. {
  4167. Log.WriteInfoLog("Read Roku url...");
  4168. if (SerialCMD.GetROKUSupportURL(TVPort, out result, out data, out error, SerailDelay))
  4169. {
  4170. if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(url)))
  4171. {
  4172. Log.WriteInfoLog("ROKU url 写入成功:" + Encoding.ASCII.GetString(data));
  4173. }
  4174. else
  4175. {
  4176. MessageBox.Show(LResource.CompareRokuUrlFail);
  4177. goto end;
  4178. }
  4179. }
  4180. else
  4181. {
  4182. MessageBox.Show(LResource.ReadRokuUrlFail);
  4183. goto end;
  4184. }
  4185. }
  4186. else
  4187. {
  4188. MessageBox.Show(LResource.CheckRokuUrlFail);
  4189. goto end;
  4190. }
  4191. }
  4192. else
  4193. {
  4194. MessageBox.Show(LResource.WriteRokuUrlFail);
  4195. goto end;
  4196. }
  4197. if (midListNow.rokuCustomer.remotetype.Length > 0 && midListNow.rokuCustomer.remotetype != "null")
  4198. {
  4199. byte[] remotetype = new byte[1] { Convert.ToByte(midListNow.rokuCustomer.remotetype) };
  4200. Log.WriteInfoLog("Write Roku remotetype...");
  4201. if (SerialCMD.SetROKURemoteType(TVPort, remotetype, out result, out data, out error, SerailDelay))
  4202. {
  4203. Log.WriteInfoLog("Check Roku remotetype...");
  4204. if (SerialCMD.CheckROKURemoteType(TVPort, out result, out data, out error, SerailDelay))
  4205. {
  4206. Log.WriteInfoLog("Read Roku remotetype...");
  4207. if (SerialCMD.GetROKURemoteType(TVPort, out result, out data, out error, SerailDelay))
  4208. {
  4209. if (SerialInit.BytesCompare_Base64(data, remotetype))
  4210. {
  4211. Log.WriteInfoLog("ROKU remotetype 写入成功:" + Encoding.ASCII.GetString(data));
  4212. }
  4213. else
  4214. {
  4215. MessageBox.Show(LResource.CompareRokuRemoteTypeFail);
  4216. goto end;
  4217. }
  4218. }
  4219. else
  4220. {
  4221. MessageBox.Show(LResource.ReadRokuRemoteTypeFail);
  4222. goto end;
  4223. }
  4224. }
  4225. else
  4226. {
  4227. MessageBox.Show(LResource.CheckRokuRemoteTypeFail);
  4228. goto end;
  4229. }
  4230. }
  4231. else
  4232. {
  4233. MessageBox.Show(LResource.WriteRokuRemoteTypeFail);
  4234. goto end;
  4235. }
  4236. }
  4237. SetcolorStatus(ProductMsg_Text, Color.FromArgb(128, 255, 128));
  4238. }
  4239. keycontent += "toolVersion=" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "&";
  4240. //自定义指令发送
  4241. if (FunctionSettingNow.CustomCMD != null)
  4242. {
  4243. if (FunctionSettingNow.CustomCMD.Count > 0)
  4244. {
  4245. foreach (string cmd in FunctionSettingNow.CustomCMD.Values)
  4246. {
  4247. byte[] Cmddata = SerialInit.HexToByte(cmd);
  4248. TVPort.Write(Cmddata, 0, Cmddata.Count());
  4249. Thread.Sleep(500);
  4250. }
  4251. }
  4252. }
  4253. //数据上传
  4254. if (midListNow.host == "LocalPC" && !preloadNow)
  4255. {
  4256. if (GetLocalKeyCount.DeleteLocalKeys(keypath, keyStream, keyReader))
  4257. {
  4258. TestResult = true;
  4259. UploadCopyCount();
  4260. LocalTxtRecord.LocalRecord(keycontent + "sversionid=" + localmidList.version + "&clienttype=" + localmidList.clienttype + "&ordernum=" + orderNow + "\r\n", orderNow);
  4261. }
  4262. else
  4263. {
  4264. MessageBox.Show("Fail to delete local keys!");
  4265. goto end;
  4266. }
  4267. }
  4268. else if (preloadNow)
  4269. {
  4270. //更新DB抄写状态
  4271. if (SQLiteHelper.UpdateCopyStatus(localDBNow, SN, out string copydate))
  4272. {
  4273. UploadCopyCount();
  4274. TestResult = true;
  4275. }
  4276. else
  4277. {
  4278. Log.WriteErrorLog(SN + " update copy record fail");
  4279. goto end;
  4280. }
  4281. //上传抄写状态
  4282. if (midListNow.host != "LocalPC")
  4283. CommonMethod.UploadPreloadCopyResult(MidAddressNow.host, copydate, SN, localDBNow, errorDBNow, false, "", FunctionSettingNow.ReportTimeOut);
  4284. }
  4285. else if (!CommonMethod.HTTPChecker(midListNow.host))
  4286. {
  4287. Log.WriteGetKeyLog("Order:" + orderNow + " host is null,scanning sn:" + SN);
  4288. TestResult = true;
  4289. UploadCopyCount();
  4290. UpdateKeys(midListNow.keytype, false);
  4291. }
  4292. else
  4293. {
  4294. if (WriteDID.Checked)
  4295. {
  4296. if (CommonMethod.UploadCopyResult(keycontent + "sversionid=" + midListNow.version + "&clienttype=" + midListNow.clienttype + "&ordernum=" + orderNow, midListNow.host + "/report.do?", errorDBNow, orderNow, false, "", FunctionSettingNow.ReportTimeOut))
  4297. TestResult = true;
  4298. else
  4299. {
  4300. TestResult = false;
  4301. UploadCopyCount();
  4302. UpdateKeys(midListNow.keytype, false);
  4303. goto end;
  4304. }
  4305. }
  4306. else
  4307. {
  4308. if (SN.Trim().Length > 0)
  4309. {
  4310. keycontent += "nodid=true&";
  4311. if (CommonMethod.UploadCopyResult(keycontent + "sversionid=" + midListNow.version + "&clienttype=" + midListNow.clienttype + "&ordernum=" + orderNow, midListNow.host + "/report.do?", errorDBNow, orderNow, false, "", FunctionSettingNow.ReportTimeOut))
  4312. TestResult = true;
  4313. else
  4314. {
  4315. TestResult = false;
  4316. UploadCopyCount();
  4317. UpdateKeys(midListNow.keytype, false);
  4318. goto end;
  4319. }
  4320. }
  4321. else
  4322. {
  4323. LocalTxtRecord.LocalRecord(midListNow.host + "/report.do?\r\n" + keycontent + "sversionid=" + midListNow.version + "&clienttype=" + midListNow.clienttype + "&ordernum=" + orderNow + "\r\n\r\n", orderNow);
  4324. if (FunctionSettingNow.AllowNoScanning)
  4325. {
  4326. TestResult = true;
  4327. }
  4328. else
  4329. {
  4330. MessageBox.Show("You must scan to start the burning!");
  4331. TestResult = false;
  4332. }
  4333. }
  4334. }
  4335. UploadCopyCount();
  4336. UpdateKeys(midListNow.keytype, false);
  4337. }
  4338. if (FunctionSettingNow.ExportSNACASID)
  4339. {
  4340. SerialCMD.ReadJapaneseACASID(TVPort, out result, out data, out error, SerailDelay);
  4341. CommonMethod.ExportSNACASID(orderNow, SN, Encoding.ASCII.GetString(data));
  4342. }
  4343. SetsuccessStatus(ResultStatus);
  4344. Thread.Sleep(FunctionSettingNow.Wait_after_completion);
  4345. end:
  4346. if (!TestResult)
  4347. {
  4348. SetfailStatus(ResultStatus);
  4349. if (midListNow.host == "LocalPC" && !preloadNow)
  4350. {
  4351. GetLocalKeyCount.UnlockLocalKeys(keypath, keyStream, keyReader);
  4352. }
  4353. // 是否启用G客户防呆措施;
  4354. if (FunctionSettingNow.UsingGFoolProofing)
  4355. {
  4356. StringBuilder strValue = new StringBuilder(256);
  4357. // 获取上一次的SN号;
  4358. CommonMethod.GetProfileString("MOKAFactoryTools", "LastGSN", "", strValue, 256);
  4359. if (strValue.ToString().Equals(SN, StringComparison.OrdinalIgnoreCase))
  4360. {
  4361. int lastCount = 0;
  4362. CommonMethod.GetProfileString("MOKAFactoryTools", "GFailCount", "0", strValue, 256);
  4363. int.TryParse(strValue.ToString(), out lastCount);
  4364. CommonMethod.WriteProfileString("MOKAFactoryTools", "GFailCount", (++lastCount).ToString());
  4365. }
  4366. }
  4367. }
  4368. if (midListNow.host == "LocalPC" && !preloadNow)
  4369. {
  4370. GetLocalKeysCount();
  4371. }
  4372. timer1.Stop();
  4373. usingTime = 0;
  4374. EnableText(SNText);
  4375. EnableButton(BtnClickstart);
  4376. SN = "";
  4377. }
  4378. /// <summary>
  4379. /// 显示白平衡配置
  4380. /// </summary>
  4381. /// <param name="sender"></param>
  4382. /// <param name="e"></param>
  4383. private void OnBtnWBView(object sender, EventArgs e)
  4384. {
  4385. SNText.Focus();
  4386. if (FunctionSettingNow.WriteWB)
  4387. {
  4388. MessageBox.Show("NormalR:" + FunctionSettingNow.NormalRGB[0] + "\r\nNormalG:" + FunctionSettingNow.NormalRGB[1] + "\r\nNormalB:" + FunctionSettingNow.NormalRGB[2] + "\r\nCoolR:" + FunctionSettingNow.CoolRGB[0] + "\r\nCoolG:" + FunctionSettingNow.CoolRGB[1] + "\r\nCoolB:" + FunctionSettingNow.CoolRGB[2] + "\r\nWarmR:" + FunctionSettingNow.WarmRGB[0] + "\r\nWarmG:" + FunctionSettingNow.WarmRGB[1] + "\r\nWarmB:" + FunctionSettingNow.WarmRGB[2]);
  4389. }
  4390. else
  4391. {
  4392. MessageBox.Show(LResource.WBNoSet);
  4393. }
  4394. }
  4395. /// <summary>
  4396. /// 更新key的状态
  4397. /// </summary>
  4398. /// <param name="keys">GetMIDInfo的keytype字典</param>
  4399. /// <returns></returns>
  4400. public bool UpdateKeys(Dictionary<string, string> keys, bool autokey)
  4401. {
  4402. GetOrderRemainKeyCount(orderNow);
  4403. if (keys.ContainsKey("DeviceID"))
  4404. {
  4405. if (writeDoneNow.DIDWrite_YesNo)
  4406. SetCheckboxStatus(WriteDID, true);
  4407. UpdateKeyCount("DeviceID", midListNow.clienttype, autokey);
  4408. }
  4409. if (keys.ContainsKey("MAC"))
  4410. {
  4411. if (writeDoneNow.MacWrite_YesNo)
  4412. SetCheckboxStatus(WriteMac, true);
  4413. UpdateKeyCount("MAC", keys["MAC"], autokey);
  4414. }
  4415. if (keys.ContainsKey("HDCP_KEY"))
  4416. {
  4417. if (writeDoneNow.HDCPWrite_YesNo)
  4418. SetCheckboxStatus(WriteHDCP, true);
  4419. UpdateKeyCount("HDCP_KEY", keys["HDCP_KEY"], autokey);
  4420. }
  4421. if (keys.ContainsKey("CI_PLUS_KEY"))
  4422. {
  4423. if (writeDoneNow.CI_plusWrite_YesNo)
  4424. SetCheckboxStatus(WriteCiplus, true);
  4425. UpdateKeyCount("CI_PLUS_KEY", keys["CI_PLUS_KEY"], autokey);
  4426. }
  4427. if (keys.ContainsKey("WiDi"))
  4428. {
  4429. if (writeDoneNow.WiDiWrite_YesNo)
  4430. SetCheckboxStatus(WriteWiDi, true);
  4431. UpdateKeyCount("WiDi", keys["WiDi"], autokey);
  4432. }
  4433. if (keys.ContainsKey("Widevine_KEY"))
  4434. {
  4435. if (writeDoneNow.WidevineWrite_YesNo)
  4436. SetCheckboxStatus(WriteWidevine, true);
  4437. UpdateKeyCount("Widevine_KEY", keys["Widevine_KEY"], autokey);
  4438. }
  4439. if (keys.ContainsKey("HDCP2.2_KEY"))
  4440. {
  4441. if (writeDoneNow.HDCP22Write_YesNo)
  4442. SetCheckboxStatus(WriteHDCP22, true);
  4443. UpdateKeyCount("HDCP2.2_KEY", keys["HDCP2.2_KEY"], autokey);
  4444. }
  4445. if (keys.ContainsKey("NETFILX_ESN"))
  4446. {
  4447. if (writeDoneNow.ESNWrite_YesNo)
  4448. SetCheckboxStatus(WriteESN, true);
  4449. UpdateKeyCount("NETFILX_ESN", keys["NETFILX_ESN"], autokey);
  4450. }
  4451. if (keys.ContainsKey("Attestation_key"))
  4452. {
  4453. if (writeDoneNow.AttestationWrite_YesNo)
  4454. SetCheckboxStatus(WriteAttestation, true);
  4455. UpdateKeyCount("Attestation_key", keys["Attestation_key"], autokey);
  4456. }
  4457. if (keys.ContainsKey("MGK_KEY"))
  4458. {
  4459. if (writeDoneNow.MGKWrite_YesNo)
  4460. SetCheckboxStatus(WriteMGK, true);
  4461. UpdateKeyCount("MGK_KEY", keys["MGK_KEY"], autokey);
  4462. }
  4463. if (keys.ContainsKey("Fairplay_KEY"))
  4464. {
  4465. if (writeDoneNow.FairplayWrite_YesNo)
  4466. SetCheckboxStatus(WriteFairplay, true);
  4467. UpdateKeyCount("Fairplay_KEY", keys["Fairplay_KEY"], autokey);
  4468. }
  4469. if (keys.ContainsKey("ECP_KEY"))
  4470. {
  4471. if (writeDoneNow.ECPWrite_YesNo)
  4472. SetCheckboxStatus(WriteECP, true);
  4473. UpdateKeyCount("ECP_KEY", keys["ECP_KEY"], autokey);
  4474. }
  4475. if (keys.ContainsKey("WiFi_MAC"))
  4476. {
  4477. if (writeDoneNow.WifiMacWrite_YesNo)
  4478. SetCheckboxStatus(WriteWifiMac, true);
  4479. UpdateKeyCount("WiFi_MAC", keys["WiFi_MAC"], autokey);
  4480. }
  4481. if (keys.ContainsKey("BT_MAC"))
  4482. {
  4483. if (writeDoneNow.BTMacWrite_YesNo)
  4484. SetCheckboxStatus(WriteBTMac, true);
  4485. UpdateKeyCount("BT_MAC", keys["BT_MAC"], autokey);
  4486. }
  4487. if (keys.ContainsKey("LEK"))
  4488. {
  4489. if (writeDoneNow.LEKWrite_YesNo)
  4490. SetCheckboxStatus(WriteLEK, true);
  4491. UpdateKeyCount("LEK", keys["LEK"], false);
  4492. }
  4493. if (keys.ContainsKey("PEK"))
  4494. {
  4495. if (writeDoneNow.PEKWrite_YesNo)
  4496. SetCheckboxStatus(WritePEK, true);
  4497. UpdateKeyCount("PEK", keys["PEK"], false);
  4498. }
  4499. if (keys.ContainsKey("PlayReady_key"))
  4500. {
  4501. if (writeDoneNow.PlayreadyWrite_YesNo)
  4502. SetCheckboxStatus(WritePlayready, true);
  4503. UpdateKeyCount("PlayReady_key", keys["PlayReady_key"], false);
  4504. }
  4505. if (keys.ContainsKey("Hashkey"))
  4506. {
  4507. if (writeDoneNow.HashWrite_YesNo)
  4508. SetCheckboxStatus(WriteHash, true);
  4509. UpdateKeyCount("Hashkey", keys["Hashkey"], false);
  4510. }
  4511. if (keys.ContainsKey("YouTube_KEY"))
  4512. {
  4513. if (writeDoneNow.YouTubeWrite_YesNo)
  4514. SetCheckboxStatus(WriteYouTube, true);
  4515. UpdateKeyCount("YouTube_KEY", keys["YouTube_KEY"], false);
  4516. }
  4517. if (keys.ContainsKey("DSN"))
  4518. {
  4519. if (writeDoneNow.DSNWrite_YesNo)
  4520. SetCheckboxStatus(WriteDSN, true);
  4521. }
  4522. if (keys.ContainsKey("edid_pid"))
  4523. {
  4524. if (writeDoneNow.EDIDPIDWrite_YesNo)
  4525. SetCheckboxStatus(WriteEDIDPID, true);
  4526. }
  4527. if (keys.ContainsKey("edid_model_name"))
  4528. {
  4529. if (writeDoneNow.EDIDModeNameWrite_YesNo)
  4530. SetCheckboxStatus(WriteEDIDName, true);
  4531. }
  4532. if (keys.ContainsKey("ACAS_KEY"))
  4533. {
  4534. if (writeDoneNow.ACASKeyWrite_YesNo)
  4535. SetCheckboxStatus(WriteACASKey, true);
  4536. UpdateKeyCount("ACAS_KEY", keys["ACAS_KEY"], false);
  4537. }
  4538. return true;
  4539. }
  4540. /// <summary>
  4541. /// 获取key数量,更新Keycount
  4542. /// </summary>
  4543. /// <param name="key">key种类</param>
  4544. /// <param name="keytype">key的具体类型</param>
  4545. /// <returns></returns>
  4546. public bool UpdateKeyCount(string key, string keytype, bool autokey)
  4547. {
  4548. string url = midListNow.host;
  4549. string url1;
  4550. string count;
  4551. string code;
  4552. string desc;
  4553. HttpHelper http = new HttpHelper();
  4554. HttpItem item = new HttpItem()
  4555. {
  4556. Encoding = Encoding.Default,
  4557. Method = "post",
  4558. ContentType = "application/x-www-form-urlencoded"
  4559. };
  4560. switch (key)
  4561. {
  4562. case "DeviceID":
  4563. {
  4564. url1 = url + "/statdeviceid.do?";
  4565. item.URL = url1;
  4566. item.Postdata = "devicetype=tcl_unknown_model";
  4567. HttpResult result = http.GetHtml(item);
  4568. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4569. {
  4570. Log.WriteGetKeyLog("\r\nGetDeviceID count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4571. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4572. {
  4573. if (count == "0")
  4574. SetKeyCountStatus(DIDCount, count, 2);
  4575. else
  4576. SetKeyCountStatus(DIDCount, count, 0);
  4577. if (autokey && WriteDID.Checked)
  4578. {
  4579. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4580. if (availableCount != "unknow")
  4581. {
  4582. if (Convert.ToInt32(availableCount) > keycount)
  4583. AutoKeyRequire(this.Handle, key, "tcl_unknown_model");
  4584. else if (keycount < 500)
  4585. AutoKeyRequire(this.Handle, key, keytype);
  4586. }
  4587. else if (keycount < 500)
  4588. AutoKeyRequire(this.Handle, key, "tcl_unknown_model");
  4589. }
  4590. }
  4591. else
  4592. {
  4593. CommonMethod.ReportErrormsg("Fail to parse DID count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4594. SetKeyCountStatus(DIDCount, code + "Error", 1);
  4595. }
  4596. }
  4597. else
  4598. {
  4599. CommonMethod.ReportErrormsg("Fail to get DID count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4600. SetKeyCountStatus(DIDCount, result.StatusDescription, 1);
  4601. return false;
  4602. }
  4603. break;
  4604. }
  4605. case "MAC":
  4606. {
  4607. url1 = url + "/statmac.do?";
  4608. item.URL = url1;
  4609. item.Postdata = "typeString=" + keytype;
  4610. HttpResult result = http.GetHtml(item);
  4611. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4612. {
  4613. Log.WriteGetKeyLog("\r\nGetMac count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4614. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4615. {
  4616. if (count == "0")
  4617. SetKeyCountStatus(MacCount, count, 2);
  4618. else
  4619. SetKeyCountStatus(MacCount, count, 0);
  4620. if (autokey && WriteMac.Checked)
  4621. {
  4622. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4623. if (availableCount != "unknow")
  4624. {
  4625. if (Convert.ToInt32(availableCount) > keycount)
  4626. AutoKeyRequire(this.Handle, key, keytype);
  4627. else if (keycount < 500)
  4628. AutoKeyRequire(this.Handle, key, keytype);
  4629. }
  4630. else if (keycount < 500)
  4631. AutoKeyRequire(this.Handle, key, keytype);
  4632. }
  4633. }
  4634. else
  4635. {
  4636. CommonMethod.ReportErrormsg("Fail to parse Mac count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4637. SetKeyCountStatus(MacCount, code + "Error", 1);
  4638. }
  4639. }
  4640. else
  4641. {
  4642. CommonMethod.ReportErrormsg("Fail to get Mac count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4643. SetKeyCountStatus(MacCount, result.StatusDescription, 1);
  4644. return false;
  4645. }
  4646. break;
  4647. }
  4648. case "HDCP_KEY":
  4649. {
  4650. url1 = url + "/stathdcpkey.do?";
  4651. item.URL = url1;
  4652. item.Postdata = "type=" + keytype;
  4653. HttpResult result = http.GetHtml(item);
  4654. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4655. {
  4656. Log.WriteGetKeyLog("\r\nGetHDCP_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4657. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4658. {
  4659. if (count == "0")
  4660. SetKeyCountStatus(HDCPCount, count, 2);
  4661. else
  4662. SetKeyCountStatus(HDCPCount, count, 0);
  4663. if (autokey && WriteHDCP.Checked)
  4664. {
  4665. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4666. if (availableCount != "unknow")
  4667. {
  4668. if (Convert.ToInt32(availableCount) > keycount)
  4669. AutoKeyRequire(this.Handle, key, keytype);
  4670. else if (keycount < 500)
  4671. AutoKeyRequire(this.Handle, key, keytype);
  4672. }
  4673. else if (keycount < 500)
  4674. AutoKeyRequire(this.Handle, key, keytype);
  4675. }
  4676. }
  4677. else
  4678. {
  4679. CommonMethod.ReportErrormsg("Fail to parse hdcp count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4680. SetKeyCountStatus(HDCPCount, code + "Error", 1);
  4681. }
  4682. }
  4683. else
  4684. {
  4685. CommonMethod.ReportErrormsg("Fail to get hdcp count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4686. SetKeyCountStatus(HDCPCount, result.StatusDescription, 1);
  4687. return false;
  4688. }
  4689. break;
  4690. }
  4691. case "CI_PLUS_KEY":
  4692. {
  4693. url1 = url + "/statcikey.do?";
  4694. item.URL = url1;
  4695. item.Postdata = "type=" + keytype;
  4696. HttpResult result = http.GetHtml(item);
  4697. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4698. {
  4699. Log.WriteGetKeyLog("\r\nGetCI_PLUS_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4700. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4701. {
  4702. if (count == "0")
  4703. SetKeyCountStatus(CICount, count, 2);
  4704. else
  4705. SetKeyCountStatus(CICount, count, 0);
  4706. if (autokey && WriteCiplus.Checked)
  4707. {
  4708. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4709. if (availableCount != "unknow")
  4710. {
  4711. if (Convert.ToInt32(availableCount) > keycount)
  4712. AutoKeyRequire(this.Handle, key, keytype);
  4713. else if (keycount < 500)
  4714. AutoKeyRequire(this.Handle, key, keytype);
  4715. }
  4716. else if (keycount < 500)
  4717. AutoKeyRequire(this.Handle, key, keytype);
  4718. }
  4719. }
  4720. else
  4721. {
  4722. CommonMethod.ReportErrormsg("Fail to parses ciplus count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4723. SetKeyCountStatus(CICount, code + "Error", 1);
  4724. }
  4725. }
  4726. else
  4727. {
  4728. CommonMethod.ReportErrormsg("Fail to get ciplus count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4729. SetKeyCountStatus(CICount, result.StatusDescription, 1);
  4730. return false;
  4731. }
  4732. break;
  4733. }
  4734. case "WiDi":
  4735. {
  4736. url1 = url + "/statwidi.do?";
  4737. item.URL = url1;
  4738. item.Postdata = "type=" + keytype;
  4739. HttpResult result = http.GetHtml(item);
  4740. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4741. {
  4742. Log.WriteGetKeyLog("\r\nGetWiDi count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4743. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4744. {
  4745. if (count == "0")
  4746. SetKeyCountStatus(WidiCount, count, 2);
  4747. else
  4748. SetKeyCountStatus(WidiCount, count, 0);
  4749. if (autokey && WriteWiDi.Checked)
  4750. {
  4751. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4752. if (availableCount != "unknow")
  4753. {
  4754. if (Convert.ToInt32(availableCount) > keycount)
  4755. AutoKeyRequire(this.Handle, key, keytype);
  4756. else if (keycount < 500)
  4757. AutoKeyRequire(this.Handle, key, keytype);
  4758. }
  4759. else if (keycount < 500)
  4760. AutoKeyRequire(this.Handle, key, keytype);
  4761. }
  4762. }
  4763. else
  4764. {
  4765. CommonMethod.ReportErrormsg("Fail to parse widi count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4766. SetKeyCountStatus(WidiCount, code + "Error", 1);
  4767. }
  4768. }
  4769. else
  4770. {
  4771. CommonMethod.ReportErrormsg("Fail to get widi count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4772. SetKeyCountStatus(WidiCount, result.StatusDescription, 1);
  4773. return false;
  4774. }
  4775. break;
  4776. }
  4777. case "Widevine_KEY":
  4778. {
  4779. url1 = url + "/statWidevineAndAttestation.do?";
  4780. item.URL = url1;
  4781. item.Postdata = "type=" + keytype;
  4782. HttpResult result = http.GetHtml(item);
  4783. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4784. {
  4785. Log.WriteGetKeyLog("\r\nGetWidevine_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4786. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4787. {
  4788. if (count == "0")
  4789. SetKeyCountStatus(WideVineCount, count, 2);
  4790. else
  4791. SetKeyCountStatus(WideVineCount, count, 0);
  4792. if (autokey && WriteWidevine.Checked)
  4793. {
  4794. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4795. if (availableCount != "unknow")
  4796. {
  4797. if (Convert.ToInt32(availableCount) > keycount)
  4798. AutoKeyRequire(this.Handle, key, keytype);
  4799. else if (keycount < 500)
  4800. AutoKeyRequire(this.Handle, key, keytype);
  4801. }
  4802. else if (keycount < 500)
  4803. AutoKeyRequire(this.Handle, key, keytype);
  4804. }
  4805. }
  4806. else
  4807. {
  4808. CommonMethod.ReportErrormsg("Fail to parse widevine count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4809. SetKeyCountStatus(WideVineCount, code + "Error", 1);
  4810. }
  4811. }
  4812. else
  4813. {
  4814. CommonMethod.ReportErrormsg("Fail to get widevine count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4815. SetKeyCountStatus(WideVineCount, result.StatusDescription, 1);
  4816. return false;
  4817. }
  4818. break;
  4819. }
  4820. case "HDCP2.2_KEY":
  4821. {
  4822. url1 = url + "/stathdcpkey2.do?";
  4823. item.URL = url1;
  4824. item.Postdata = "type=" + keytype;
  4825. HttpResult result = http.GetHtml(item);
  4826. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4827. {
  4828. Log.WriteGetKeyLog("\r\nGetHDCP2.2_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4829. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4830. {
  4831. if (count == "0")
  4832. SetKeyCountStatus(HDCP22Count, count, 2);
  4833. else
  4834. SetKeyCountStatus(HDCP22Count, count, 0);
  4835. if (autokey && WriteHDCP22.Checked)
  4836. {
  4837. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4838. if (availableCount != "unknow")
  4839. {
  4840. if (Convert.ToInt32(availableCount) > keycount)
  4841. AutoKeyRequire(this.Handle, key, keytype);
  4842. else if (keycount < 500)
  4843. AutoKeyRequire(this.Handle, key, keytype);
  4844. }
  4845. else if (keycount < 500)
  4846. AutoKeyRequire(this.Handle, key, keytype);
  4847. }
  4848. }
  4849. else
  4850. {
  4851. CommonMethod.ReportErrormsg("Fail to parse hdcp22 count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4852. SetKeyCountStatus(HDCP22Count, code + "Error", 1);
  4853. }
  4854. }
  4855. else
  4856. {
  4857. CommonMethod.ReportErrormsg("Fail to get hdcp22 count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4858. SetKeyCountStatus(HDCP22Count, result.StatusDescription, 1);
  4859. return false;
  4860. }
  4861. break;
  4862. }
  4863. case "NETFILX_ESN":
  4864. {
  4865. url1 = url + "/statnetfilxesn.do?";
  4866. item.URL = url1;
  4867. item.Postdata = "type=" + keytype;
  4868. HttpResult result = http.GetHtml(item);
  4869. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4870. {
  4871. Log.WriteGetKeyLog("\r\nGetNETFILX_ESN count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4872. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4873. {
  4874. if (count == "0")
  4875. SetKeyCountStatus(ESNCount, count, 2);
  4876. else
  4877. SetKeyCountStatus(ESNCount, count, 0);
  4878. if (autokey && WriteESN.Checked)
  4879. {
  4880. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4881. if (availableCount != "unknow")
  4882. {
  4883. if (Convert.ToInt32(availableCount) > keycount)
  4884. AutoKeyRequire(this.Handle, key, keytype);
  4885. else if (keycount < 500)
  4886. AutoKeyRequire(this.Handle, key, keytype);
  4887. }
  4888. else if (keycount < 500)
  4889. AutoKeyRequire(this.Handle, key, keytype);
  4890. }
  4891. }
  4892. else
  4893. {
  4894. CommonMethod.ReportErrormsg("Fail to parse esn count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4895. SetKeyCountStatus(ESNCount, code + "Error", 1);
  4896. }
  4897. }
  4898. else
  4899. {
  4900. CommonMethod.ReportErrormsg("Fail to get esn count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4901. SetKeyCountStatus(ESNCount, result.StatusDescription, 1);
  4902. return false;
  4903. }
  4904. break;
  4905. }
  4906. case "Attestation_key":
  4907. {
  4908. url1 = url + "/statWidevineAndAttestation.do?";
  4909. item.URL = url1;
  4910. item.Postdata = "type=" + keytype;
  4911. HttpResult result = http.GetHtml(item);
  4912. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4913. {
  4914. Log.WriteGetKeyLog("\r\nGetAttestation_key count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4915. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4916. {
  4917. if (count == "0")
  4918. SetKeyCountStatus(AttestationCount, count, 2);
  4919. else
  4920. SetKeyCountStatus(AttestationCount, count, 0);
  4921. if (autokey && WriteAttestation.Checked)
  4922. {
  4923. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4924. if (availableCount != "unknow")
  4925. {
  4926. if (Convert.ToInt32(availableCount) > keycount)
  4927. AutoKeyRequire(this.Handle, key, keytype);
  4928. else if (keycount < 500)
  4929. AutoKeyRequire(this.Handle, key, keytype);
  4930. }
  4931. else if (keycount < 500)
  4932. AutoKeyRequire(this.Handle, key, keytype);
  4933. }
  4934. }
  4935. else
  4936. {
  4937. CommonMethod.ReportErrormsg("Fail to parses attestation count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4938. SetKeyCountStatus(AttestationCount, code + "Error", 1);
  4939. }
  4940. }
  4941. else
  4942. {
  4943. CommonMethod.ReportErrormsg("Fail to get ciplus count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4944. SetKeyCountStatus(AttestationCount, result.StatusDescription, 1);
  4945. return false;
  4946. }
  4947. break;
  4948. }
  4949. case "MGK_KEY":
  4950. {
  4951. url1 = url + "/statmgk.do?";
  4952. item.URL = url1;
  4953. item.Postdata = "type=" + keytype;
  4954. HttpResult result = http.GetHtml(item);
  4955. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4956. {
  4957. Log.WriteGetKeyLog("\r\nGetMGK count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  4958. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  4959. {
  4960. if (count == "0")
  4961. SetKeyCountStatus(MGKCount, count, 2);
  4962. else
  4963. SetKeyCountStatus(MGKCount, count, 0);
  4964. if (autokey && WriteMGK.Checked)
  4965. {
  4966. int keycount = Convert.ToInt32(count.Replace(",", ""));
  4967. if (availableCount != "unknow")
  4968. {
  4969. if (Convert.ToInt32(availableCount) > keycount)
  4970. AutoKeyRequire(this.Handle, key, keytype);
  4971. else if (keycount < 500)
  4972. AutoKeyRequire(this.Handle, key, keytype);
  4973. }
  4974. else if (keycount < 500)
  4975. AutoKeyRequire(this.Handle, key, keytype);
  4976. }
  4977. }
  4978. else
  4979. {
  4980. CommonMethod.ReportErrormsg("Fail to parse MGK count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4981. SetKeyCountStatus(MGKCount, code + "Error", 1);
  4982. }
  4983. }
  4984. else
  4985. {
  4986. CommonMethod.ReportErrormsg("Fail to get MGK count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  4987. SetKeyCountStatus(MGKCount, result.StatusDescription, 1);
  4988. return false;
  4989. }
  4990. break;
  4991. }
  4992. case "Fairplay_KEY":
  4993. {
  4994. url1 = url + "/statfairplay.do?";
  4995. item.URL = url1;
  4996. item.Postdata = "type=" + keytype;
  4997. HttpResult result = http.GetHtml(item);
  4998. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  4999. {
  5000. Log.WriteGetKeyLog("\r\nGetFairplay_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5001. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5002. {
  5003. if (count == "0")
  5004. SetKeyCountStatus(FairplayCount, count, 2);
  5005. else
  5006. SetKeyCountStatus(FairplayCount, count, 0);
  5007. if (autokey && WriteFairplay.Checked)
  5008. {
  5009. int keycount = Convert.ToInt32(count.Replace(",", ""));
  5010. if (availableCount != "unknow")
  5011. {
  5012. if (Convert.ToInt32(availableCount) > keycount)
  5013. AutoKeyRequire(this.Handle, key, keytype);
  5014. else if (keycount < 500)
  5015. AutoKeyRequire(this.Handle, key, keytype);
  5016. }
  5017. else if (keycount < 500)
  5018. AutoKeyRequire(this.Handle, key, keytype);
  5019. }
  5020. }
  5021. else
  5022. {
  5023. CommonMethod.ReportErrormsg("Fail to parse Fairplay count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5024. SetKeyCountStatus(FairplayCount, code + "Error", 1);
  5025. }
  5026. }
  5027. else
  5028. {
  5029. CommonMethod.ReportErrormsg("Fail to get Fairplay count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5030. SetKeyCountStatus(FairplayCount, result.StatusDescription, 1);
  5031. return false;
  5032. }
  5033. break;
  5034. }
  5035. case "ECP_KEY":
  5036. {
  5037. url1 = url + "/statecp.do?";
  5038. item.URL = url1;
  5039. item.Postdata = "type=" + keytype;
  5040. HttpResult result = http.GetHtml(item);
  5041. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5042. {
  5043. Log.WriteGetKeyLog("\r\nGetECP_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5044. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5045. {
  5046. if (count == "0")
  5047. SetKeyCountStatus(ECPCount, count, 2);
  5048. else
  5049. SetKeyCountStatus(ECPCount, count, 0);
  5050. if (autokey && WriteECP.Checked)
  5051. {
  5052. int keycount = Convert.ToInt32(count.Replace(",", ""));
  5053. if (availableCount != "unknow")
  5054. {
  5055. if (Convert.ToInt32(availableCount) > keycount)
  5056. AutoKeyRequire(this.Handle, key, keytype);
  5057. else if (keycount < 500)
  5058. AutoKeyRequire(this.Handle, key, keytype);
  5059. }
  5060. else if (keycount < 500)
  5061. AutoKeyRequire(this.Handle, key, keytype);
  5062. }
  5063. }
  5064. else
  5065. {
  5066. CommonMethod.ReportErrormsg("Fail to parse ECP count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5067. SetKeyCountStatus(ECPCount, code + "Error", 1);
  5068. }
  5069. }
  5070. else
  5071. {
  5072. CommonMethod.ReportErrormsg("Fail to get ECP count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5073. SetKeyCountStatus(ECPCount, result.StatusDescription, 1);
  5074. return false;
  5075. }
  5076. break;
  5077. }
  5078. case "WiFi_MAC":
  5079. {
  5080. url1 = url + "/statmac.do?";
  5081. item.URL = url1;
  5082. item.Postdata = "typeString=" + keytype;
  5083. HttpResult result = http.GetHtml(item);
  5084. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5085. {
  5086. Log.WriteGetKeyLog("\r\nGetWifiMac count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5087. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5088. {
  5089. if (count == "0")
  5090. SetKeyCountStatus(WifiMacCount, count, 2);
  5091. else
  5092. SetKeyCountStatus(WifiMacCount, count, 0);
  5093. if (autokey && WriteWifiMac.Checked)
  5094. {
  5095. int keycount = Convert.ToInt32(count.Replace(",", ""));
  5096. if (availableCount != "unknow")
  5097. {
  5098. if (Convert.ToInt32(availableCount) > keycount)
  5099. AutoKeyRequire(this.Handle, key, keytype);
  5100. else if (keycount < 500)
  5101. AutoKeyRequire(this.Handle, key, keytype);
  5102. }
  5103. else if (keycount < 500)
  5104. AutoKeyRequire(this.Handle, key, keytype);
  5105. }
  5106. }
  5107. else
  5108. {
  5109. CommonMethod.ReportErrormsg("Fail to parse WifiMac count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5110. SetKeyCountStatus(WifiMacCount, code + "Error", 1);
  5111. }
  5112. }
  5113. else
  5114. {
  5115. CommonMethod.ReportErrormsg("Fail to get WifiMac count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5116. SetKeyCountStatus(WifiMacCount, result.StatusDescription, 1);
  5117. return false;
  5118. }
  5119. break;
  5120. }
  5121. case "BT_MAC":
  5122. {
  5123. url1 = url + "/statmac.do?";
  5124. item.URL = url1;
  5125. item.Postdata = "typeString=" + keytype;
  5126. HttpResult result = http.GetHtml(item);
  5127. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5128. {
  5129. Log.WriteGetKeyLog("\r\nGetBTMac count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5130. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5131. {
  5132. if (count == "0")
  5133. SetKeyCountStatus(BTMacCount, count, 2);
  5134. else
  5135. SetKeyCountStatus(BTMacCount, count, 0);
  5136. if (autokey && WriteBTMac.Checked)
  5137. {
  5138. int keycount = Convert.ToInt32(count.Replace(",", ""));
  5139. if (availableCount != "unknow")
  5140. {
  5141. if (Convert.ToInt32(availableCount) > keycount)
  5142. AutoKeyRequire(this.Handle, key, keytype);
  5143. else if (keycount < 500)
  5144. AutoKeyRequire(this.Handle, key, keytype);
  5145. }
  5146. else if (keycount < 500)
  5147. AutoKeyRequire(this.Handle, key, keytype);
  5148. }
  5149. }
  5150. else
  5151. {
  5152. CommonMethod.ReportErrormsg("Fail to parse BTMac count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5153. SetKeyCountStatus(BTMacCount, code + "Error", 1);
  5154. }
  5155. }
  5156. else
  5157. {
  5158. CommonMethod.ReportErrormsg("Fail to get BTMac count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5159. SetKeyCountStatus(BTMacCount, result.StatusDescription, 1);
  5160. return false;
  5161. }
  5162. break;
  5163. }
  5164. case "LEK":
  5165. {
  5166. url1 = url + "/statlek.do?";
  5167. item.URL = url1;
  5168. item.Postdata = "type=" + keytype;
  5169. HttpResult result = http.GetHtml(item);
  5170. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5171. {
  5172. Log.WriteGetKeyLog("\r\nGetLEK count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5173. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5174. {
  5175. if (count == "0")
  5176. SetKeyCountStatus(LEKCount, count, 2);
  5177. else
  5178. SetKeyCountStatus(LEKCount, count, 0);
  5179. }
  5180. else
  5181. {
  5182. CommonMethod.ReportErrormsg("Fail to parse LEK count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5183. SetKeyCountStatus(LEKCount, code + "Error", 1);
  5184. }
  5185. }
  5186. else
  5187. {
  5188. CommonMethod.ReportErrormsg("Fail to get LEK count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5189. SetKeyCountStatus(LEKCount, result.StatusDescription, 1);
  5190. return false;
  5191. }
  5192. break;
  5193. }
  5194. case "PEK":
  5195. {
  5196. url1 = url + "/statpek.do?";
  5197. item.URL = url1;
  5198. item.Postdata = "type=" + keytype;
  5199. HttpResult result = http.GetHtml(item);
  5200. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5201. {
  5202. Log.WriteGetKeyLog("\r\nGetPEK count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5203. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5204. {
  5205. if (count == "0")
  5206. SetKeyCountStatus(PEKCount, count, 2);
  5207. else
  5208. SetKeyCountStatus(PEKCount, count, 0);
  5209. }
  5210. else
  5211. {
  5212. CommonMethod.ReportErrormsg("Fail to parse PEK count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5213. SetKeyCountStatus(PEKCount, code + "Error", 1);
  5214. }
  5215. }
  5216. else
  5217. {
  5218. CommonMethod.ReportErrormsg("Fail to get PEK count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5219. SetKeyCountStatus(PEKCount, result.StatusDescription, 1);
  5220. return false;
  5221. }
  5222. break;
  5223. }
  5224. case "PlayReady_key":
  5225. {
  5226. url1 = url + "/statplayready.do?";
  5227. item.URL = url1;
  5228. item.Postdata = "type=" + keytype;
  5229. HttpResult result = http.GetHtml(item);
  5230. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5231. {
  5232. Log.WriteGetKeyLog("\r\nGetPlayReady_key count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5233. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5234. {
  5235. if (count == "0")
  5236. SetKeyCountStatus(PlayreadyCount, count, 2);
  5237. else
  5238. SetKeyCountStatus(PlayreadyCount, count, 0);
  5239. }
  5240. else
  5241. {
  5242. CommonMethod.ReportErrormsg("Fail to parse PlayReady_key count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5243. SetKeyCountStatus(PlayreadyCount, code + "Error", 1);
  5244. }
  5245. }
  5246. else
  5247. {
  5248. CommonMethod.ReportErrormsg("Fail to get PlayReady_key count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5249. SetKeyCountStatus(PlayreadyCount, result.StatusDescription, 1);
  5250. return false;
  5251. }
  5252. break;
  5253. }
  5254. case "Hashkey":
  5255. {
  5256. url1 = url + "/stathash.do?";
  5257. item.URL = url1;
  5258. item.Postdata = "type=" + keytype;
  5259. HttpResult result = http.GetHtml(item);
  5260. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5261. {
  5262. Log.WriteGetKeyLog("\r\nGetHashkey count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5263. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5264. {
  5265. if (count == "0")
  5266. SetKeyCountStatus(HashCount, count, 2);
  5267. else
  5268. SetKeyCountStatus(HashCount, count, 0);
  5269. }
  5270. else
  5271. {
  5272. CommonMethod.ReportErrormsg("Fail to parse Hashkey count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5273. SetKeyCountStatus(HashCount, code + "Error", 1);
  5274. }
  5275. }
  5276. else
  5277. {
  5278. CommonMethod.ReportErrormsg("Fail to get Hashkey count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5279. SetKeyCountStatus(HashCount, result.StatusDescription, 1);
  5280. return false;
  5281. }
  5282. break;
  5283. }
  5284. case "YouTube_KEY":
  5285. {
  5286. url1 = url + "/statYoutubeKey.do?";
  5287. item.URL = url1;
  5288. item.Postdata = "type=" + keytype;
  5289. HttpResult result = http.GetHtml(item);
  5290. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5291. {
  5292. Log.WriteGetKeyLog("\r\nGetYoutubehkey count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5293. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5294. {
  5295. if (count == "0")
  5296. SetKeyCountStatus(YouTubeCount, count, 2);
  5297. else
  5298. SetKeyCountStatus(YouTubeCount, count, 0);
  5299. }
  5300. else
  5301. {
  5302. CommonMethod.ReportErrormsg("Fail to parse Youtube key count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5303. SetKeyCountStatus(YouTubeCount, code + "Error", 1);
  5304. }
  5305. }
  5306. else
  5307. {
  5308. CommonMethod.ReportErrormsg("Fail to get Youtube key count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5309. SetKeyCountStatus(YouTubeCount, result.StatusDescription, 1);
  5310. return false;
  5311. }
  5312. break;
  5313. }
  5314. case "ACAS_KEY": // 获取ACAS KEY数量;
  5315. {
  5316. url1 = url + "/statAcasKey.do?";
  5317. item.URL = url1;
  5318. item.Postdata = "type=" + keytype;
  5319. HttpResult result = http.GetHtml(item);
  5320. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5321. {
  5322. Log.WriteGetKeyLog("\r\nGetACASkey count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5323. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5324. {
  5325. if (count == "0")
  5326. SetKeyCountStatus(ACASKeyCount, count, 2);
  5327. else
  5328. SetKeyCountStatus(ACASKeyCount, count, 0);
  5329. }
  5330. else
  5331. {
  5332. CommonMethod.ReportErrormsg("Fail to parse ACAS key count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5333. SetKeyCountStatus(ACASKeyCount, code + "Error", 1);
  5334. }
  5335. }
  5336. else
  5337. {
  5338. CommonMethod.ReportErrormsg("Fail to get ACAS key count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5339. SetKeyCountStatus(ACASKeyCount, result.StatusDescription, 1);
  5340. return false;
  5341. }
  5342. break;
  5343. }
  5344. default:
  5345. {
  5346. break;
  5347. }
  5348. }
  5349. return true;
  5350. }
  5351. /// <summary>
  5352. /// 获取订单可用key余量
  5353. /// </summary>
  5354. /// <param name="order">订单号</param>
  5355. /// <returns></returns>
  5356. public bool GetOrderRemainKeyCount(string order)
  5357. {
  5358. string url = midListNow.host;
  5359. string url1;
  5360. string count;
  5361. string code;
  5362. string desc;
  5363. if (!CommonMethod.HTTPChecker(url))
  5364. return false;
  5365. HttpHelper http = new HttpHelper();
  5366. HttpItem item = new HttpItem()
  5367. {
  5368. Encoding = Encoding.Default,
  5369. Method = "post",
  5370. ContentType = "application/x-www-form-urlencoded",
  5371. Timeout = 3000
  5372. };
  5373. url1 = url + "/getAvailableKeyCount.do?";
  5374. item.URL = url1;
  5375. item.Postdata = "ordernum=" + order;
  5376. HttpResult result = http.GetHtml(item);
  5377. if (result.StatusCode == System.Net.HttpStatusCode.OK)
  5378. {
  5379. Log.WriteGetKeyLog("\r\nGetOrderRemainKeyCount count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
  5380. if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
  5381. {
  5382. availableCount = count.Replace(",", "");
  5383. }
  5384. else
  5385. {
  5386. availableCount = "unknow";
  5387. CommonMethod.ReportErrormsg("Fail to parse GetOrderRemainKeyCount", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5388. }
  5389. }
  5390. else
  5391. {
  5392. availableCount = "unknow";
  5393. CommonMethod.ReportErrormsg("Fail to get GetOrderRemainKeyCount", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
  5394. return false;
  5395. }
  5396. return true;
  5397. }
  5398. /// <summary>
  5399. /// 按键触发在线抄写
  5400. /// 注意:此按键的作用是给不需要输入SN号的工厂使用;
  5401. /// </summary>
  5402. /// <param name="sender"></param>
  5403. /// <param name="e"></param>
  5404. private void OnBtnClickStart(object sender, EventArgs e)
  5405. {
  5406. SN = ""; // SN置为空,用于不需要扫码SN的某些工厂;
  5407. keyInfo = new KeyInfo();
  5408. if (preloadNow)
  5409. {
  5410. MessageBox.Show(LResource.PreloadError, LResource.Error);
  5411. return;
  5412. }
  5413. SetInitialStatus();
  5414. BtnClickstart.Enabled = false;
  5415. SNText.Enabled = false;
  5416. Onlinemode();
  5417. }
  5418. /// <summary>
  5419. /// 在线获取key的方式抄写
  5420. /// </summary>
  5421. public void Onlinemode()
  5422. {
  5423. WriteDID.Checked = (WriteDID.Checked && m_writedid.Text != LResource.Skip);
  5424. WriteMac.Checked = (WriteMac.Checked && m_writemac.Text != LResource.Skip);
  5425. WriteHDCP.Checked = (WriteHDCP.Checked && m_writehdcp.Text != LResource.Skip);
  5426. WriteHDCP22.Checked = (WriteHDCP22.Checked && m_writehdcp22.Text != LResource.Skip);
  5427. WriteWiDi.Checked = (WriteWiDi.Checked && m_writewidi.Text != LResource.Skip);
  5428. WriteWidevine.Checked = (WriteWidevine.Checked && m_writewidevine.Text != LResource.Skip);
  5429. WriteESN.Checked = (WriteESN.Checked && m_writeesn.Text != LResource.Skip);
  5430. WriteCiplus.Checked = (WriteCiplus.Checked && m_writeci.Text != LResource.Skip);
  5431. WriteAttestation.Checked = (WriteAttestation.Checked && m_writeattestation.Text != LResource.Skip);
  5432. WriteMGK.Checked = (WriteMGK.Checked && m_writeMGK.Text != LResource.Skip);
  5433. WriteWifiMac.Checked = (WriteWifiMac.Checked && m_writeWifiMac.Text != LResource.Skip);
  5434. WriteBTMac.Checked = (WriteBTMac.Checked && m_writeBTMac.Text != LResource.Skip);
  5435. WriteECP.Checked = (WriteECP.Checked && m_writeECP.Text != LResource.Skip);
  5436. WriteLEK.Checked = (WriteLEK.Checked && m_writeLEK.Text != LResource.Skip);
  5437. WritePEK.Checked = (WritePEK.Checked && m_writePEK.Text != LResource.Skip);
  5438. WritePlayready.Checked = (WritePlayready.Checked && m_writePlayready.Text != LResource.Skip);
  5439. WriteHash.Checked = (WriteHash.Checked && m_writeHash.Text != LResource.Skip);
  5440. WriteYouTube.Checked = (WriteYouTube.Checked && m_writeYouTube.Text != LResource.Skip);
  5441. WriteEDIDPID.Checked = (WriteEDIDPID.Checked && m_writeEDIDPID.Text != LResource.Skip);
  5442. WriteEDIDName.Checked = (WriteEDIDName.Checked && m_writeEDIDName.Text != LResource.Skip);
  5443. WriteACASKey.Checked = (WriteACASKey.Checked && m_writeACASKey.Text != LResource.Skip);
  5444. bool preloadresult = false;
  5445. preloadresult = true;
  5446. timer1.Start();
  5447. UpdateKeys(midListNow.keytype, true);
  5448. WritekeyThread = new Thread(Writekey);
  5449. WritekeyThread.Start();
  5450. if (!preloadresult)
  5451. {
  5452. SNText.Enabled = true;
  5453. }
  5454. }
  5455. /// <summary>
  5456. /// 更新订单抄写数量
  5457. /// </summary>
  5458. /// <returns></returns>
  5459. public bool UploadCopyCount()
  5460. {
  5461. return (SQLiteHelper.UpdateProductionNum(errorDBNow, orderNow));
  5462. }
  5463. /// <summary>
  5464. /// 获取定制化抄写信息
  5465. /// </summary>
  5466. /// <param name="sender"></param>
  5467. /// <param name="e"></param>
  5468. private void OnBtnOtherView(object sender, EventArgs e)
  5469. {
  5470. if (midListNow.rokuCustomer != null)
  5471. MessageBox.Show("Roku TV\r\n" + "Brand:" + midListNow.rokuCustomer.brand + "\r\nOEM Model:" + midListNow.rokuCustomer.oemmodel + "\r\nDate:" + midListNow.rokuCustomer.productiondate + "\r\nRegion:" + midListNow.rokuCustomer.region + "\r\nPhone:" + midListNow.rokuCustomer.supportphone + "\r\nUrl:" + midListNow.rokuCustomer.supporturl + "\r\nRemote Type:" + midListNow.rokuCustomer.remotetype, LResource.ProductMsg);
  5472. else
  5473. MessageBox.Show("null");
  5474. }
  5475. /// <summary>
  5476. /// 获取本地key数量
  5477. /// </summary>
  5478. public void GetLocalKeysCount()
  5479. {
  5480. int didnum;
  5481. if (GetLocalKeyCount.GetLocalDidCount(orderNow, out didnum, ref localmidList, errorDBNow))
  5482. {
  5483. SetCheckboxStatus(WriteDID, true);
  5484. if (didnum != -1)
  5485. SetKeyCountStatus(DIDCount, didnum.ToString(), 0);
  5486. else
  5487. SetKeyCountStatus(DIDCount, "Read error", 1);
  5488. }
  5489. int macnum;
  5490. if (GetLocalKeyCount.GetLocalMacCount(orderNow, out macnum, ref localmidList, errorDBNow))
  5491. {
  5492. SetCheckboxStatus(WriteMac, true);
  5493. if (macnum != -1)
  5494. SetKeyCountStatus(MacCount, macnum.ToString(), 0);
  5495. else
  5496. SetKeyCountStatus(MacCount, "Read error", 1);
  5497. }
  5498. int hdcpnum;
  5499. if (GetLocalKeyCount.GetLocalHDCPKEYCount(orderNow, out hdcpnum))
  5500. {
  5501. SetCheckboxStatus(WriteHDCP, true);
  5502. if (hdcpnum != -1)
  5503. SetKeyCountStatus(HDCPCount, hdcpnum.ToString(), 0);
  5504. else
  5505. SetKeyCountStatus(HDCPCount, "Read error", 1);
  5506. }
  5507. int widinum;
  5508. if (GetLocalKeyCount.GetLocalWiDiCount(orderNow, out widinum))
  5509. {
  5510. SetCheckboxStatus(WriteWiDi, true);
  5511. if (widinum != -1)
  5512. SetKeyCountStatus(WidiCount, widinum.ToString(), 0);
  5513. else
  5514. SetKeyCountStatus(WidiCount, "Read error", 1);
  5515. }
  5516. int hdcp22num;
  5517. if (GetLocalKeyCount.GetLocalHDCPKEY22Count(orderNow, out hdcp22num))
  5518. {
  5519. SetCheckboxStatus(WriteHDCP22, true);
  5520. if (hdcp22num != -1)
  5521. SetKeyCountStatus(HDCP22Count, hdcp22num.ToString(), 0);
  5522. else
  5523. SetKeyCountStatus(HDCP22Count, "Read error", 1);
  5524. }
  5525. int esnnum;
  5526. if (GetLocalKeyCount.GetLocalESNCount(orderNow, out esnnum))
  5527. {
  5528. SetCheckboxStatus(WriteESN, true);
  5529. if (esnnum != -1)
  5530. SetKeyCountStatus(ESNCount, esnnum.ToString(), 0);
  5531. else
  5532. SetKeyCountStatus(ESNCount, "Read error", 1);
  5533. }
  5534. int widevinenum;
  5535. if (GetLocalKeyCount.GetLocalWidevineCount(orderNow, out widevinenum))
  5536. {
  5537. SetCheckboxStatus(WriteWidevine, true);
  5538. if (widevinenum != -1)
  5539. SetKeyCountStatus(WideVineCount, widevinenum.ToString(), 0);
  5540. else
  5541. SetKeyCountStatus(WideVineCount, "Read error", 1);
  5542. }
  5543. int cinum;
  5544. if (GetLocalKeyCount.GetLocalCIKEYCount(orderNow, out cinum))
  5545. {
  5546. SetCheckboxStatus(WriteCiplus, true);
  5547. if (cinum != -1)
  5548. SetKeyCountStatus(CICount, cinum.ToString(), 0);
  5549. else
  5550. SetKeyCountStatus(CICount, "Read error", 1);
  5551. }
  5552. int mgknum;
  5553. if (GetLocalKeyCount.GetLocalMGKCount(orderNow, out mgknum))
  5554. {
  5555. SetCheckboxStatus(WriteMGK, true);
  5556. if (mgknum != -1)
  5557. SetKeyCountStatus(MGKCount, mgknum.ToString(), 0);
  5558. else
  5559. SetKeyCountStatus(MGKCount, "Read error", 1);
  5560. }
  5561. int attestationnum;
  5562. if (GetLocalKeyCount.GetLocalAttestationCount(orderNow, out attestationnum))
  5563. {
  5564. SetCheckboxStatus(WriteAttestation, true);
  5565. if (attestationnum != -1)
  5566. SetKeyCountStatus(AttestationCount, attestationnum.ToString(), 0);
  5567. else
  5568. SetKeyCountStatus(AttestationCount, "Read error", 1);
  5569. }
  5570. int fairplaynum;
  5571. if (GetLocalKeyCount.GetLocalFairplayCount(orderNow, out fairplaynum))
  5572. {
  5573. SetCheckboxStatus(WriteFairplay, true);
  5574. if (fairplaynum != -1)
  5575. SetKeyCountStatus(FairplayCount, fairplaynum.ToString(), 0);
  5576. else
  5577. SetKeyCountStatus(FairplayCount, "Read error", 1);
  5578. }
  5579. int leknum;
  5580. fireTVKey.LEK = GetLocalKeyCount.GetLocalFolderKeyCount(orderNow, "LEK", out leknum);
  5581. int peknum;
  5582. fireTVKey.PEK = GetLocalKeyCount.GetLocalFolderKeyCount(orderNow, "PEK", out peknum);
  5583. int palyreadynum;
  5584. fireTVKey.Playready = GetLocalKeyCount.GetLocalFolderKeyCount(orderNow, "Playready", out palyreadynum);
  5585. int hashkeynum;
  5586. fireTVKey.Hashkey = GetLocalKeyCount.GetLocalFolderKeyCount(orderNow, "Hashkey", out hashkeynum);
  5587. }
  5588. /// <summary>
  5589. /// 抄写用时计数
  5590. /// </summary>
  5591. /// <param name="sender"></param>
  5592. /// <param name="e"></param>
  5593. private void timer1_Tick(object sender, EventArgs e)
  5594. {
  5595. usingTime += 1;
  5596. UsingTime_Text.Text = usingTime.ToString();
  5597. }
  5598. /// <summary>
  5599. /// 取消SN扫描框聚焦
  5600. /// </summary>
  5601. /// <param name="sender"></param>
  5602. /// <param name="e"></param>
  5603. private void SNText_DoubleClick(object sender, EventArgs e)
  5604. {
  5605. FocusMark = false;
  5606. this.CaptionBackColorTop = Color.RoyalBlue;
  5607. this.CaptionBackColorBottom = Color.Cyan;
  5608. this.Refresh();
  5609. }
  5610. /// <summary>
  5611. /// 强制刷新抄写线程
  5612. /// </summary>
  5613. private void OnBtnRefresh(object sender, EventArgs e)
  5614. {
  5615. usingTime = 0;
  5616. EnableText(SNText);
  5617. EnableButton(BtnClickstart);
  5618. SN = "";
  5619. keyInfo = new KeyInfo();
  5620. SetInitialStatus();
  5621. if (WritekeyThread != null)
  5622. {
  5623. if (WritekeyThread.IsAlive)
  5624. {
  5625. WritekeyThread.Abort();
  5626. if (timer1.Enabled)
  5627. {
  5628. timer1.Stop();
  5629. }
  5630. while (WritekeyThread.ThreadState != ThreadState.Aborted)
  5631. {
  5632. Thread.Sleep(100);
  5633. }
  5634. }
  5635. }
  5636. UsingTime_Text.Text = "0";
  5637. GC.Collect();
  5638. MessageBox.Show(LResource.RefreshPanel);
  5639. }
  5640. /// <summary>
  5641. /// 显示订单key可用余量
  5642. /// </summary>
  5643. /// <param name="sender"></param>
  5644. /// <param name="e"></param>
  5645. private void OrderText_MouseEnter(object sender, EventArgs e)
  5646. {
  5647. toolTip1.SetToolTip(OrderText, LResource.AvailableKey + availableCount);
  5648. }
  5649. }
  5650. }