123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003 |
- using CCWin;
- using Newtonsoft.Json.Linq;
- using SufeiUtil;
- using SXLibrary;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data.SQLite;
- using System.Drawing;
- using System.IO;
- using System.IO.Ports;
- using System.Text;
- using System.Threading;
- using System.Windows.Forms;
- using System.Net;
- using System.Net.Sockets;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Diagnostics;
- namespace MOKA_Factory_Tools
- {
- public partial class OperationPanel : Skin_Color
- {
- //白平衡URL
- MidList midListNow = new MidList();
- MidList localmidList = new MidList();
- MidAddress MidAddressNow = new MidAddress();
- FunctionSetting FunctionSettingNow = new FunctionSetting();
- WhiteBalanceList WhiteBalanceListNow = new WhiteBalanceList();
- WriteCheck writeCheckNow = new WriteCheck();
- ReadCheck readCheckNow = new ReadCheck();
- WriteDone writeDoneNow = new WriteDone();
- SerialPort TVPort = new SerialPort();
- SQLiteConnection localDBNow;
- SQLiteConnection errorDBNow;
- KeyInfo keyInfo = new KeyInfo();
- FireTVKey fireTVKey = new FireTVKey();
- bool preloadNow;
- string SN = "";
- string orderNow;
- Main mainform;
- int usingTime = 0;
- Thread SNTextFocus;
- bool FocusMark = false;
- Thread WritekeyThread;
- string availableCount = "unknow";
- public string PSN = "";
- //删除界面指针委托
- public delegate void DisplayUpdateDelegate(IntPtr intPtr);
- //删除界面指针事件
- public event DisplayUpdateDelegate DeleteIntptr;
- //扫描回车触发委托
- public delegate void SNKeyDown(IntPtr intPtr);
- //扫描回车触发事件
- public event SNKeyDown SNKeyDownEven;
- //自动key提取委托
- public delegate void AutoKeyRequireDelegate(IntPtr intPtr, string key, string keytype);
- //自动key提取事件
- public event AutoKeyRequireDelegate AutoKeyRequire;
- public OperationPanel(Main form1, SQLiteConnection localDB, SQLiteConnection errorDB, MidAddress midAddress1, FunctionSetting functionSetting, WriteCheck writeCheck1, ReadCheck readCheck1, WriteDone writeDone1, bool preload, MidList midList1, string order)
- {
- InitializeComponent();
- MidAddressNow = midAddress1;
- FunctionSettingNow = functionSetting;
- writeCheckNow = writeCheck1;
- readCheckNow = readCheck1;
- writeDoneNow = writeDone1;
- localDBNow = localDB;
- errorDBNow = errorDB;
- preloadNow = preload;
- midListNow = midList1;
- orderNow = order;
- InitPanel();
- mainform = form1;
- this.mainform.MoveEvent += new MoveHandler(SetFormLocation);
- this.mainform.KeyDownEvent += new KeyDownHandler(SetFocus);
- if (midListNow.rokuCustomer != null)
- ProductMsg_Text.Text = "Roku:";
- }
- /// <summary>
- /// 控制界面跟随主界面移动
- /// </summary>
- /// <param name="XY"></param>
- /// <param name="formlocationmsg"></param>
- /// <param name="num"></param>
- void SetFormLocation(Point XY, ArrayList formlocationmsg, int num)
- {
- foreach (Dictionary<IntPtr, Point> pairs in formlocationmsg)
- {
- if (!this.IsDisposed)
- {
- if (pairs.ContainsKey(this.Handle))
- {
- if (formlocationmsg.IndexOf(pairs) >= num && num > 0)
- {
- this.Left = XY.X + this.Size.Width * (formlocationmsg.IndexOf(pairs) - num);
- this.Top = XY.Y + this.Size.Height;
- }
- else
- {
- this.Left = XY.X + this.Size.Width * formlocationmsg.IndexOf(pairs);
- this.Top = XY.Y;
- }
- break;
- }
- }
- }
- }
- /// <summary>
- /// 按指针设置是否聚焦
- /// </summary>
- /// <param name="formlocationmsg"></param>
- /// <param name="intPtr"></param>
- void SetFocus(ArrayList formlocationmsg, IntPtr intPtr)
- {
- bool mark = false;
- bool mark2 = false;
- foreach (Dictionary<IntPtr, Point> pairs in formlocationmsg)
- {
- if (!this.IsDisposed)
- {
- if (pairs.ContainsKey(this.Handle) && formlocationmsg.IndexOf(pairs) == 0)
- {
- mark2 = true;
- }
- if (mark)
- {
- if (pairs.ContainsKey(this.Handle))
- FocusMark = true;
- else
- mark = false;
- }
- if (pairs.ContainsKey(intPtr))
- {
- if (formlocationmsg.IndexOf(pairs) == (formlocationmsg.Count - 1))
- {
- if (mark2)
- FocusMark = true;
- }
- mark = true;
- }
- }
- }
- }
- /// <summary>
- /// 界面控件初始化
- /// </summary>
- public void InitPanel()
- {
- COMText.Text = FunctionSettingNow.TVCOM;
- COMText.BackColor = Color.FromArgb(128, 255, 128);
- BaudText.Text = FunctionSettingNow.TVBaud;
- BaudText.BackColor = Color.FromArgb(128, 255, 128);
- WritePSN.Checked = FunctionSettingNow.BarcodeWrite;
- if (!writeCheckNow.DIDCheckcheck)
- SetspecificText(m_checkdid, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.MacCheckcheck)
- SetspecificText(m_checkmac, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.HDCPCheckcheck)
- SetspecificText(m_checkhdcp, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.HDCP22Checkcheck)
- SetspecificText(m_checkhdcp22, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.WiDiCheckcheck)
- SetspecificText(m_checkwidi, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.WidevineCheckcheck)
- SetspecificText(m_checkwidevine, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.ESNCheckcheck)
- SetspecificText(m_checkesn, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.CI_plusCheckcheck)
- SetspecificText(m_checkci, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.AttestationCheckcheck)
- SetspecificText(m_checkattestation, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.MGKCheckcheck)
- SetspecificText(m_checkMGK, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.FairplayCheckcheck)
- SetspecificText(m_checkFairplay, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.ECPCheckcheck)
- SetspecificText(m_checkECP, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.WifiMacCheckcheck)
- SetspecificText(m_checkWifiMac, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.BTMacCheckcheck)
- SetspecificText(m_checkBTMac, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.LEKCheckcheck)
- SetspecificText(m_checkLEK, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.PEKCheckcheck)
- SetspecificText(m_checkPEK, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.PlayreadyCheckcheck)
- SetspecificText(m_checkPlayready, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.HashCheckcheck)
- SetspecificText(m_checkHash, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.DSNCheckcheck)
- SetspecificText(m_checkDSN, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.YouTubeCheckcheck)
- SetspecificText(m_checkYouTube, LResource.Skip, Color.Yellow);
- if (!writeCheckNow.ACASKeyCheckcheck)
- SetspecificText(m_checkACASKey, LResource.Skip, Color.Yellow);
- /////////////////////////////////////////////////////////////////
- if (!readCheckNow.PIDReadcheck)
- SetspecificText(ProjectIDNote, LResource.SkipReadCheck, Color.Yellow);
- if (!readCheckNow.DIDReadcheck)
- SetspecificText(m_readdid, LResource.Skip, Color.Yellow);
- if (!readCheckNow.MacReadcheck)
- SetspecificText(m_readmac, LResource.Skip, Color.Yellow);
- if (!readCheckNow.HDCPReadcheck)
- SetspecificText(m_readhdcp, LResource.Skip, Color.Yellow);
- if (!readCheckNow.HDCP22Readcheck)
- SetspecificText(m_readhdcp22, LResource.Skip, Color.Yellow);
- if (!readCheckNow.WiDiReadcheck)
- SetspecificText(m_readwidi, LResource.Skip, Color.Yellow);
- if (!readCheckNow.WidevineReadcheck)
- SetspecificText(m_readwidevine, LResource.Skip, Color.Yellow);
- if (!readCheckNow.ESNReadcheck)
- SetspecificText(m_readesn, LResource.Skip, Color.Yellow);
- if (!readCheckNow.CI_plusReadcheck)
- SetspecificText(m_readci, LResource.Skip, Color.Yellow);
- if (!readCheckNow.AttestationReadcheck)
- SetspecificText(m_readattestation, LResource.Skip, Color.Yellow);
- if (!readCheckNow.MGKReadcheck)
- SetspecificText(m_readMGK, LResource.Skip, Color.Yellow);
- if (!readCheckNow.FairplayReadcheck)
- SetspecificText(m_readFairplay, LResource.Skip, Color.Yellow);
- if (!readCheckNow.ECPReadcheck)
- SetspecificText(m_readECP, LResource.Skip, Color.Yellow);
- if (!readCheckNow.WifiMacReadcheck)
- SetspecificText(m_readWifiMac, LResource.Skip, Color.Yellow);
- if (!readCheckNow.BTMacReadcheck)
- SetspecificText(m_readBTMac, LResource.Skip, Color.Yellow);
- if (!readCheckNow.LEKReadcheck)
- SetspecificText(m_readLEK, LResource.Skip, Color.Yellow);
- if (!readCheckNow.PEKReadcheck)
- SetspecificText(m_readPEK, LResource.Skip, Color.Yellow);
- if (!readCheckNow.PlayreadyReadcheck)
- SetspecificText(m_readPlayready, LResource.Skip, Color.Yellow);
- if (!readCheckNow.HashReadcheck)
- SetspecificText(m_readHash, LResource.Skip, Color.Yellow);
- if (!readCheckNow.DSNReadcheck)
- SetspecificText(m_readDSN, LResource.Skip, Color.Yellow);
- if (!readCheckNow.SHOPReadcheck)
- SetspecificText(SHOPNote, LResource.SkipChecking, Color.Yellow);
- if (!readCheckNow.OSDReadcheck)
- SetspecificText(OSDNote, LResource.SkipChecking, Color.Yellow);
- if (!readCheckNow.YouTubeReadcheck)
- SetspecificText(m_readYouTube, LResource.SkipChecking, Color.Yellow);
- if (!readCheckNow.EDIDPIDReadcheck)
- SetspecificText(m_readEDIDPID, LResource.SkipChecking, Color.Yellow);
- if (!readCheckNow.EDIDModeNameReadcheck)
- SetspecificText(m_readEDIDName, LResource.SkipChecking, Color.Yellow);
- if (!readCheckNow.ACASKeyReadcheck)
- SetspecificText(m_readACASKey, LResource.SkipChecking, Color.Yellow);
- if (FunctionSettingNow.ExportSNACASID)
- SetspecificText(m_readACASID, LResource.SkipChecking, Color.Yellow);
- /////////////////////////////////////////////////////////////////
- if (!writeDoneNow.PIDWrite_YesNo)
- SetspecificText(ProjectIDNote, LResource.SkipCovering, Color.Yellow);
- if (!writeDoneNow.ClientTypeCheck_YesNo)
- SetspecificText(ClientTypeNote, LResource.SkipChecking, Color.Yellow);
- if (!writeDoneNow.SoftwareVersionCheck_YesNo)
- SetspecificText(SoftwareVersionNote, LResource.SkipChecking, Color.Yellow);
- if (!writeDoneNow.DIDWrite_YesNo)
- SetspecificText(m_writedid, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.MacWrite_YesNo)
- SetspecificText(m_writemac, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.HDCPWrite_YesNo)
- SetspecificText(m_writehdcp, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.HDCP22Write_YesNo)
- SetspecificText(m_writehdcp22, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.WiDiWrite_YesNo)
- SetspecificText(m_writewidi, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.WidevineWrite_YesNo)
- SetspecificText(m_writewidevine, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.ESNWrite_YesNo)
- SetspecificText(m_writeesn, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.CI_plusWrite_YesNo)
- SetspecificText(m_writeci, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.AttestationWrite_YesNo)
- SetspecificText(m_writeattestation, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.MGKWrite_YesNo)
- SetspecificText(m_writeMGK, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.FairplayWrite_YesNo)
- SetspecificText(m_writeFairplay, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.ECPWrite_YesNo)
- SetspecificText(m_writeECP, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.WifiMacWrite_YesNo)
- SetspecificText(m_writeWifiMac, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.BTMacWrite_YesNo)
- SetspecificText(m_writeBTMac, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.LEKWrite_YesNo)
- SetspecificText(m_writeLEK, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.PEKWrite_YesNo)
- SetspecificText(m_writePEK, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.PlayreadyWrite_YesNo)
- SetspecificText(m_writePlayready, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.HashWrite_YesNo)
- SetspecificText(m_writeHash, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.DSNWrite_YesNo)
- SetspecificText(m_writeDSN, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.YouTubeWrite_YesNo)
- SetspecificText(m_writeYouTube, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.EDIDPIDWrite_YesNo)
- SetspecificText(m_writeEDIDPID, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.EDIDModeNameWrite_YesNo)
- SetspecificText(m_writeEDIDName, LResource.Skip, Color.Yellow);
- if (!writeDoneNow.ACASKeyWrite_YesNo)
- SetspecificText(m_writeACASKey, LResource.Skip, Color.Yellow);
- if (FunctionSettingNow.WriteChannel)
- ChannelText.Text = FunctionSettingNow.ChannelList;
- else
- {
- ChannelText.Text = LResource.Default;
- ChannelText.BackColor = Color.Yellow;
- }
- if (FunctionSettingNow.WriteOSD)
- OSDText.Text = FunctionSettingNow.OSDList;
- else
- {
- OSDText.Text = LResource.Default;
- OSDText.BackColor = Color.Yellow;
- }
- if (FunctionSettingNow.WriteSHOP)
- SHOPText.Text = FunctionSettingNow.SHOPList;
- else
- {
- SHOPText.Text = LResource.Default;
- SHOPText.BackColor = Color.Yellow;
- }
- if (midListNow.host != "LocalPC")
- {
- if ((!FunctionSettingNow.WriteWB) && (!writeDoneNow.AutoWhiteBalance))
- {
- WBPathText.Text = LResource.SkipAutoWB;
- WBPathText.BackColor = Color.Yellow;
- }
- else
- {
- // 如果是抄写EDID,则不获取白平衡数据;
- if (CommonMethod.IsEDIDCopy(midListNow))
- midListNow.whiteType = "-1";
- switch (midListNow.whiteType)//订单白平衡预置状态
- {
- case "0"://旧订单,默认值
- {
- if (CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, orderNow, TestMode.MAC, errorDBNow, out WhiteBalanceListNow))
- {
- if (WhiteBalanceListNow.whiteBalanceInfo != null)
- {
- if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "0")
- {
- if (FunctionSettingNow.WriteWB)
- {
- MessageBoxButtons messButton = MessageBoxButtons.YesNo;
- DialogResult dr = MessageBox.Show(LResource.HaveWBfromServer, LResource.Error, messButton);
- if (dr == DialogResult.Yes)
- {
- 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) };
- 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) };
- 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) };
- WBPathText.Text = LResource.LoadFromServer;
- }
- else
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- }
- else
- {
- MessageBox.Show(LResource.FindWBfromServer, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- FunctionSettingNow.WriteWB = true;
- 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) };
- 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) };
- 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) };
- WBPathText.Text = LResource.LoadFromServer;
- }
- }
- else if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "1")
- {
- WBPathText.Text = LResource.WBExemptOrder;
- WBPathText.BackColor = Color.Yellow;
- }
- }
- else
- {
- if (FunctionSettingNow.WriteWB)
- {
- MessageBoxButtons messButton = MessageBoxButtons.YesNo;
- DialogResult dr = MessageBox.Show(LResource.HaveNoWBfromServer, LResource.Error, messButton);
- if (dr == DialogResult.OK)
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- }
- else
- {
- WBPathText.Text = LResource.WBNull;
- WBPathText.BackColor = Color.Yellow;
- FunctionSettingNow.WriteWB = false;
- }
- }
- }
- else
- {
- MessageBox.Show(LResource.GetWBInfoFail);
- if (FunctionSettingNow.WriteWB)
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- else
- {
- WBPathText.Text = LResource.WBNull;
- WBPathText.BackColor = Color.Yellow;
- }
- }
- break;
- }
- case "1"://未预置或预置LR数据
- {
- if (CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, orderNow, TestMode.MAC, errorDBNow, out WhiteBalanceListNow))
- {
- if (WhiteBalanceListNow.whiteBalanceInfo != null)
- {
- if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "0")//0是正常白平衡绑定订单,1是白平衡豁免订单
- {
- if (FunctionSettingNow.WriteWB)
- {
- MessageBoxButtons messButton = MessageBoxButtons.YesNo;
- DialogResult dr = MessageBox.Show(LResource.HaveWBfromServer, LResource.Error, messButton);
- if (dr == DialogResult.Yes)
- {
- 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) };
- 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) };
- 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) };
- WBPathText.Text = LResource.LoadFromServer;
- }
- else
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- }
- else
- {
- MessageBox.Show(LResource.FindWBfromServer, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- FunctionSettingNow.WriteWB = true;
- 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) };
- 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) };
- 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) };
- WBPathText.Text = LResource.LoadFromServer;
- }
- }
- else if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "1")
- {
- WBPathText.Text = LResource.WBExemptOrder;
- WBPathText.BackColor = Color.Yellow;
- }
- }
- else
- {
- if (FunctionSettingNow.WriteWB)
- {
- MessageBoxButtons messButton = MessageBoxButtons.YesNo;
- DialogResult dr = MessageBox.Show(LResource.HaveNoWBfromServer, LResource.Error, messButton);
- if (dr == DialogResult.OK)
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- }
- else
- {
- WBPathText.Text = LResource.WBNull;
- WBPathText.BackColor = Color.Yellow;
- FunctionSettingNow.WriteWB = false;
- }
- }
- }
- else
- {
- if (FunctionSettingNow.WriteWB)
- {
- MessageBox.Show(LResource.GetWBInfoFail);
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- else
- {
- MessageBox.Show(LResource.GetWBInfoFail2);
- this.Close();
- return;
- }
- }
- break;
- }
- case "2"://已预置PR数据
- {
- if (CommonMethod.GetWhiteBalanceInfo(TestMode.getWhiteBalanceInfoUrl, orderNow, TestMode.MAC, errorDBNow, out WhiteBalanceListNow))
- {
- if (WhiteBalanceListNow.whiteBalanceInfo != null)
- {
- if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "0")
- {
- if (FunctionSettingNow.WriteWB)
- {
- MessageBoxButtons messButton = MessageBoxButtons.YesNo;
- DialogResult dr = MessageBox.Show(LResource.HaveWBfromServer, LResource.Error, messButton);
- if (dr == DialogResult.Yes)
- {
- 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) };
- 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) };
- 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) };
- WBPathText.Text = LResource.LoadFromServer;
- }
- else
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- }
- else
- {
- MessageBox.Show(LResource.FindWBfromServer, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- FunctionSettingNow.WriteWB = true;
- 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) };
- 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) };
- 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) };
- WBPathText.Text = LResource.LoadFromServer;
- }
- }
- else if (WhiteBalanceListNow.whiteBalanceInfo.isExemption == "1")
- {
- WBPathText.Text = LResource.WBExemptOrder;
- WBPathText.BackColor = Color.Yellow;
- }
- }
- else
- {
- if (FunctionSettingNow.WriteWB)
- {
- MessageBoxButtons messButton = MessageBoxButtons.YesNo;
- DialogResult dr = MessageBox.Show(LResource.HaveNoWBfromServer, LResource.Error, messButton);
- if (dr == DialogResult.OK)
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- }
- else
- {
- WBPathText.Text = LResource.WBNull;
- WBPathText.BackColor = Color.Yellow;
- FunctionSettingNow.WriteWB = false;
- }
- }
- }
- else
- {
- MessageBox.Show(LResource.GetWBInfoFail);
- if (FunctionSettingNow.WriteWB)
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- else
- {
- WBPathText.Text = LResource.WBNull;
- WBPathText.BackColor = Color.Yellow;
- }
- }
- break;
- }
- case "3"://已预置客户指定数据
- {
- if (FunctionSettingNow.WriteWB)
- {
- MessageBox.Show(LResource.PreloadCustomerWB);
- this.Close();
- return;
- }
- break;
- }
- }
- }
- }
- else
- {
- if (FunctionSettingNow.WriteWB)
- {
- WBPathText.Text = Path.GetFileName(FunctionSettingNow.WBPath);
- }
- else
- {
- WBPathText.Text = LResource.WBNull;
- WBPathText.BackColor = Color.Yellow;
- }
- }
- try
- {
- TVPort.PortName = FunctionSettingNow.TVCOM;
- TVPort.BaudRate = Convert.ToInt32(FunctionSettingNow.TVBaud);
- TVPort.WriteBufferSize = 20480;
- TVPort.ReadBufferSize = 20480;
- TVPort.Open();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- this.Close();
- }
- this.Text = FunctionSettingNow.TVCOM;
- }
- private void OperationPanel_Load(object sender, EventArgs e)
- {
- if (midListNow.host == "LocalPC")
- {
- OrderText.Text = orderNow;
- ClientTypeText.Text = midListNow.clienttype;
- SVText.Text = midListNow.version;
- ProjectIDText.Text = midListNow.projectid;
- GetLocalKeysCount();
- }
- else if (!preloadNow)
- {
- OrderText.Text = orderNow;
- ClientTypeText.Text = midListNow.clienttype;
- SVText.Text = midListNow.version;
- ProjectIDText.Text = midListNow.projectid;
- UpdateKeys(midListNow.keytype, false);
- }
- else
- {
- OrderText.Text = MidAddressNow.order;
- ClientTypeText.Text = MidAddressNow.ctype;
- SVText.Text = MidAddressNow.version;
- ProjectIDText.Text = MidAddressNow.pid;
- }
- SNText.Text = "";
- SNTextFocus = new Thread(TextBoxFocus);
- SNTextFocus.Start();
- SNText.Focus();
- }
- /// <summary>
- /// 强制聚焦扫描框
- /// </summary>
- public void TextBoxFocus()
- {
- while (true)
- {
- if (FocusMark)
- {
- if (this.CaptionBackColorTop != Color.Yellow || this.CaptionBackColorBottom != Color.Orange)
- {
- if (this.InvokeRequired)
- {
- this.BeginInvoke(new Action(() =>
- {
- this.CaptionBackColorTop = Color.Yellow;
- this.CaptionBackColorBottom = Color.Orange;
- this.Refresh();
- }));
- }
- }
- if (SNText.InvokeRequired)
- {
- SNText.BeginInvoke(new Action(() =>
- {
- if (!SNText.Focus())
- {
- SNText.Focus();
- }
- }));
- }
- }
- Thread.Sleep(500);
- }
- }
- private void OperationPanel_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (TVPort.IsOpen)
- TVPort.Close();
- DeleteIntptr(this.Handle);
- GC.Collect();
- }
- /// <summary>
- /// 扫描触发抄写,以回车终结触发
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void SNText_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- #if true
- #region 波兰工厂临时解决方案
- // 获取条码前缀;
- string strSN = SNText.Text;
- SNText.Text = "";
- SNText.Enabled = false;
- if (strSN.StartsWith(orderNow))
- {
- if (SN.Length == 17)
- {
- MessageBox.Show("FSN already has, please scan PSN", "Error", MessageBoxButtons.OK);
- SNText.Enabled = true;
- return;
- }
- if (strSN.Length != 17)
- {
- MessageBox.Show("The length of FSN is wrong!", "Error", MessageBoxButtons.OK);
- SNText.Enabled = true;
- return;
- }
- SN = strSN;
- if (PSN.Length != 17)
- {
- SNText.Enabled = true;
- return;
- }
- SNText.Enabled = true;
- }
- else if (strSN.StartsWith("B"))
- {
- if (PSN.Length == 17)
- {
- MessageBox.Show("PSN already has, please scan FSN", "Error", MessageBoxButtons.OK);
- SNText.Enabled = true;
- return;
- }
- if (strSN.Length != 17)
- {
- MessageBox.Show("The length of PSN is wrong", "Error", MessageBoxButtons.OK);
- SNText.Enabled = true;
- return;
- }
- PSN = strSN;
- if (SN.Length != 17)
- {
- SNText.Enabled = true;
- return;
- }
- SNText.Enabled = true;
- }
- else
- {
- MessageBox.Show("Unknown barcode type=" + strSN, "Error", MessageBoxButtons.OK);
- SNText.Enabled = true;
- return;
- }
- if (PSN.Length == 0 || SN.Length == 0)
- {
- SNText.Enabled = true;
- return;
- }
- keyInfo = new KeyInfo();
- FocusMark = false;
- SNKeyDownEven(this.Handle);
- SetInitialStatus();
- SNText.Enabled = false;
- #endregion 波兰工厂临时解决方案
- #else
- keyInfo = new KeyInfo();
- FocusMark = false;
- SNKeyDownEven(this.Handle);
- SetInitialStatus();
- SN = SNText.Text;
- SNText.Enabled = false;
- #endif
- if (FunctionSettingNow.BarcodeLimit)
- {
- if (SN.Length != FunctionSettingNow.BarcodeLength || !SN.StartsWith(FunctionSettingNow.BarcodeKeyword))
- {
- MessageBox.Show(LResource.WrongBarcode + "\r\n" + SN);
- SNText.Enabled = true;
- SNText.Text = "";
- return;
- }
- if (!FunctionSettingNow.BarcodeWrite && (midListNow.keytype != null && midListNow.keytype.ContainsKey("DSN")))
- {
- // 如果不是全大写字母+数字,返回;
- Regex r = new Regex(@"^[A-Z0-9]+$");
- if (!r.Match(SN).Success)
- {
- MessageBox.Show(LResource.WrongBarcode + "\r\n" + SN);
- SNText.Enabled = true;
- SNText.Text = "";
- return;
- }
- }
- }
- // 是否启用G客户防呆措施;
- if (FunctionSettingNow.UsingGFoolProofing)
- {
- StringBuilder strValue = new StringBuilder(256);
- // 获取上一次的SN号;
- CommonMethod.GetProfileString("MOKAFactoryTools", "LastGSN", "", strValue, 256);
- if (strValue.ToString().Equals(SN, StringComparison.OrdinalIgnoreCase))
- {
- // 上次失败次数;
- int lastCount = 0;
- CommonMethod.GetProfileString("MOKAFactoryTools", "GFailCount", "0", strValue, 256);
- int.TryParse(strValue.ToString(), out lastCount);
- if (lastCount >= FunctionSettingNow.GFoolProofingCount)
- {
- MessageBox.Show(LResource.DefectiveProducts + "\r\n" + SN);
- SNText.Enabled = true;
- SNText.Text = "";
- return;
- }
- }
- else
- {
- CommonMethod.WriteProfileString("MOKAFactoryTools", "LastGSN", SN);
- // 重置失败次数为0;
- CommonMethod.WriteProfileString("MOKAFactoryTools", "GFailCount", "0");
- }
- }
- if (preloadNow)
- {
- bool copydone = false;
- string keyjson = SQLiteHelper.Getkeys(localDBNow, SNText.Text.Trim(), out copydone);
- if (FunctionSettingNow.NoDoublewrite && copydone)
- {
- MessageBox.Show(LResource.FindcopiedSN + SN);
- SNText.Enabled = true;
- SNText.Focus();
- }
- else if (keyjson.Length > 0)
- {
- JObject jObject = JObject.Parse(keyjson);
- keyInfo.DID = jObject["did"].Value<string>();
- keyInfo.Mac = jObject["mac"].Value<string>();
- keyInfo.HDCP = jObject["hdcp"].Value<string>();
- keyInfo.HDCP22 = jObject["hdcp22"].Value<string>();
- keyInfo.WiDi = jObject["widi"].Value<string>();
- keyInfo.Widevine = jObject["widevine"].Value<string>();
- keyInfo.ESN = jObject["esn"].Value<string>();
- keyInfo.CI_plus = jObject["cikey"].Value<string>();
- keyInfo.MGK = jObject["mgk"].Value<string>();
- keyInfo.Attestation = jObject["attestation"].Value<string>();
- keyInfo.Fairplay = jObject["fairplay"].Value<string>();
- keyInfo.ECP = jObject["ecp"].Value<string>();
- keyInfo.WiFi_MAC = jObject["wifimac"].Value<string>();
- keyInfo.BT_MAC = jObject["btmac"].Value<string>();
- keyInfo.LEK = jObject["lek"].Value<string>();
- keyInfo.PEK = jObject["pek"].Value<string>();
- keyInfo.Playready = jObject["playready"].Value<string>();
- keyInfo.Hashkey = jObject["hash"].Value<string>();
- keyInfo.YouTube_KEY = jObject["youtubekey"].Value<string>();
- keyInfo.ACASKey_Data = jObject["acaskey_data"].Value<string>();
- keyInfo.ACASKey_Tool = jObject["acaskey_tool"].Value<string>();
- WriteDID.Checked = (keyInfo.DID.Length > 0 && m_writedid.Text != LResource.Skip);
- if (WriteDID.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB DeviceID=" + keyInfo.DID);
- WriteMac.Checked = (keyInfo.Mac.Length > 0 && m_writemac.Text != LResource.Skip);
- if (WriteMac.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB Mac=" + keyInfo.Mac);
- WriteHDCP.Checked = (keyInfo.HDCP.Length > 0 && m_writehdcp.Text != LResource.Skip);
- if (WriteHDCP.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB HDCP=" + keyInfo.HDCP);
- WriteHDCP22.Checked = (keyInfo.HDCP22.Length > 0 && m_writehdcp22.Text != LResource.Skip);
- if (WriteHDCP22.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB HDCP22=" + keyInfo.HDCP22);
- WriteWiDi.Checked = (keyInfo.WiDi.Length > 0 && m_writewidi.Text != LResource.Skip);
- if (WriteWiDi.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB WiDi=" + keyInfo.WiDi);
- WriteWidevine.Checked = (keyInfo.Widevine.Length > 0 && m_writewidevine.Text != LResource.Skip);
- if (WriteWidevine.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB Widevine=" + keyInfo.Widevine);
- WriteESN.Checked = (keyInfo.ESN.Length > 0 && m_writeesn.Text != LResource.Skip);
- if (WriteESN.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB ESN=" + keyInfo.ESN);
- WriteCiplus.Checked = (keyInfo.CI_plus.Length > 0 && m_writeci.Text != LResource.Skip);
- if (WriteCiplus.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB Ci=" + keyInfo.CI_plus);
- WriteMGK.Checked = (keyInfo.MGK.Length > 0 && m_writeMGK.Text != LResource.Skip);
- if (WriteMGK.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB MGK=" + keyInfo.MGK);
- WriteAttestation.Checked = (keyInfo.Attestation.Length > 0 && m_writeattestation.Text != LResource.Skip);
- if (WriteAttestation.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB Attestation=" + keyInfo.Attestation);
- WriteFairplay.Checked = (keyInfo.Fairplay.Length > 0 && m_writeFairplay.Text != LResource.Skip);
- if (WriteFairplay.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB Fairplay=" + keyInfo.Fairplay);
- WriteECP.Checked = (keyInfo.ECP.Length > 0 && m_writeECP.Text != LResource.Skip);
- if (WriteECP.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB ECP=" + keyInfo.ECP);
- WriteWifiMac.Checked = (keyInfo.WiFi_MAC.Length > 0 && m_writeWifiMac.Text != LResource.Skip);
- if (WriteWifiMac.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB WifiMac=" + keyInfo.WiFi_MAC);
- WriteBTMac.Checked = (keyInfo.BT_MAC.Length > 0 && m_writeBTMac.Text != LResource.Skip);
- if (WriteBTMac.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB BTMac=" + keyInfo.BT_MAC);
- WriteLEK.Checked = (keyInfo.LEK.Length > 0 && m_writeLEK.Text != LResource.Skip);
- if (WriteLEK.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB LEK=" + keyInfo.LEK);
- WritePEK.Checked = (keyInfo.PEK.Length > 0 && m_writePEK.Text != LResource.Skip);
- if (WritePEK.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB PEK=" + keyInfo.PEK);
- WritePlayready.Checked = (keyInfo.Playready.Length > 0 && m_writePlayready.Text != LResource.Skip);
- if (WritePlayready.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB Playready=" + keyInfo.Playready);
- WriteHash.Checked = (keyInfo.Hashkey.Length > 0 && m_writeHash.Text != LResource.Skip);
- if (WriteHash.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB Hashkey=" + keyInfo.Hashkey);
- WriteYouTube.Checked = (keyInfo.YouTube_KEY.Length > 0 && m_writeYouTube.Text != LResource.Skip);
- if (WriteYouTube.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB YouTube_KEY=" + keyInfo.YouTube_KEY);
- WriteACASKey.Checked = (keyInfo.ACASKey_Data.Length > 0 && m_writeACASKey.Text != LResource.Skip);
- if (WriteACASKey.Checked)
- Log.WriteGetKeyLog("\r\nLocal DB ACAS_KEY=" + keyInfo.ACASKey_Data);
- WriteDSN.Checked = midListNow.keytype == null ? false : midListNow.keytype.ContainsKey("DSN") && m_writeDSN.Text != LResource.Skip;
- WritePSN.Checked = FunctionSettingNow.BarcodeWrite;
- timer1.Start();
- Thread t = new Thread(Writekey);
- t.Start();
- }
- else
- {
- MessageBox.Show(LResource.FindNullSnInDB + SN);
- SNText.Enabled = true;
- SNText.Focus();
- }
- }
- else
- {
- Onlinemode();
- }
- SNText.Text = "";
- }
- }
- /// <summary>
- /// 设置成功状态显示
- /// </summary>
- /// <param name="label"></param>
- public void SetsuccessStatus(Label label)
- {
- if (label.InvokeRequired && label.Text != LResource.Skip)
- {
- //BeginInvoke(new Action<string>(x => { label.Text = x.ToString(); }), 参数);
- label.BeginInvoke(new Action(() => { label.Text = "OK"; label.BackColor = Color.FromArgb(128, 255, 128); }));
- }
- }
- /// <summary>
- /// 设置失败状态显示
- /// </summary>
- /// <param name="label"></param>
- public void SetfailStatus(Label label)
- {
- if (label.InvokeRequired)
- {
- label.BeginInvoke(new Action(() => { label.Text = "NG"; label.BackColor = Color.Red; }));
- }
- }
- /// <summary>
- /// 设置扫描框为输入状态
- /// </summary>
- /// <param name="textBox"></param>
- public void EnableText(TextBox textBox)
- {
- if (textBox.InvokeRequired)
- {
- textBox.BeginInvoke(new Action(() => { textBox.Enabled = true; textBox.Focus(); }));
- }
- else
- {
- textBox.Enabled = true;
- textBox.Focus();
- }
- }
- /// <summary>
- /// 设置按钮为可点击状态
- /// </summary>
- /// <param name="button"></param>
- public void EnableButton(Button button)
- {
- if (button.InvokeRequired)
- {
- button.BeginInvoke(new Action(() => { button.Enabled = true; }));
- }
- else
- button.Enabled = true;
- }
- /// <summary>
- /// 设置特殊的文本和颜色
- /// </summary>
- /// <param name="label">标签控件</param>
- /// <param name="str">需要显示的文本</param>
- /// <param name="color">需要设置的控件背景颜色</param>
- public void SetspecificText(Label label, string str, Color color)
- {
- if (label.InvokeRequired)
- {
- BeginInvoke(new Action<string>(x => { label.Text = x.ToString(); }), str);
- label.BeginInvoke(new Action(() => { label.BackColor = color; }));
- }
- else
- {
- label.Text = str;
- label.BackColor = color;
- }
- }
- /// <summary>
- /// 设置标签控件颜色
- /// </summary>
- /// <param name="label">标签控件对象</param>
- /// <param name="color">需要设置的标签背景颜色</param>
- public void SetcolorStatus(Label label, Color color)
- {
- if (label.InvokeRequired)
- {
- label.BeginInvoke(new Action(() => { label.BackColor = color; }));
- }
- }
- /// <summary>
- /// 跨线程关闭窗口
- /// </summary>
- /// <param name="label"></param>
- /// <param name="color"></param>
- public void Closeform()
- {
- if (this.InvokeRequired)
- {
- this.BeginInvoke(new Action(() => { this.Close(); }));
- }
- }
- /// <summary>
- /// 设置标签控件文本
- /// </summary>
- /// <param name="label">标签控件对象</param>
- /// <param name="color">需要设置的标签文本</param>
- public void SetTextStatus(Label label, string txt)
- {
- if (label.InvokeRequired)
- {
- label.BeginInvoke(new Action(() => { label.Text = txt; }));
- }
- else
- label.Text = txt;
- }
- /// <summary>
- /// 线程内&跨线程设置key数量显示控件
- /// </summary>
- /// <param name="label">数量提示控件</param>
- /// <param name="str">数量值</param>
- /// <param name="status">状态,0为正常,1为获取失败,2为数量不足</param>
- public void SetKeyCountStatus(Label label, string str, int status)
- {
- if (label.InvokeRequired)
- {
- BeginInvoke(new Action<string>(x => { label.Text = x.ToString(); }), str);
- switch (status)
- {
- case 0:
- label.BeginInvoke(new Action(() => { label.ForeColor = Color.Green; }));
- break;
- case 1:
- label.BeginInvoke(new Action(() => { label.BackColor = Color.Red; }));
- break;
- case 2:
- label.BeginInvoke(new Action(() => { label.ForeColor = Color.Red; }));
- break;
- }
- }
- else
- {
- label.Text = str;
- switch (status)
- {
- case 0:
- label.ForeColor = Color.Green; ;
- break;
- case 1:
- label.BackColor = Color.Red;
- break;
- case 2:
- label.ForeColor = Color.Red;
- break;
- }
- }
- }
- /// <summary>
- /// 线程内&跨线程设置checkbox控件的checked值
- /// </summary>
- /// <param name="checkBox">checkbox控件</param>
- /// <param name="status">需要设置的布尔状态</param>
- public void SetCheckboxStatus(CheckBox checkBox, bool status)
- {
- if (checkBox.InvokeRequired)
- {
- BeginInvoke(new Action<bool>(x => { checkBox.Checked = x; }), status);
- }
- else
- {
- checkBox.Checked = status;
- }
- }
- /// <summary>
- /// 重置控件状态,skip除外
- /// </summary>
- public void SetInitialStatus()
- {
- this.CaptionBackColorTop = Color.RoyalBlue;
- this.CaptionBackColorBottom = Color.Cyan;
- this.Refresh();
- /////////////////////////////////////////////////////////////
- /// Set Write;
- if (m_writeci.Text != LResource.Skip)
- {
- m_writeci.Text = "Null";
- m_writeci.BackColor = Color.Transparent;
- }
- if (m_writemac.Text != LResource.Skip)
- {
- m_writemac.Text = "Null";
- m_writemac.BackColor = Color.Transparent;
- }
- if (m_writedid.Text != LResource.Skip)
- {
- m_writedid.Text = "Null";
- m_writedid.BackColor = Color.Transparent;
- }
- if (m_writeesn.Text != LResource.Skip)
- {
- m_writeesn.Text = "Null";
- m_writeesn.BackColor = Color.Transparent;
- }
- if (m_writewidi.Text != LResource.Skip)
- {
- m_writewidi.Text = "Null";
- m_writewidi.BackColor = Color.Transparent;
- }
- if (m_writewidevine.Text != LResource.Skip)
- {
- m_writewidevine.Text = "Null";
- m_writewidevine.BackColor = Color.Transparent;
- }
- if (m_writehdcp.Text != LResource.Skip)
- {
- m_writehdcp.Text = "Null";
- m_writehdcp.BackColor = Color.Transparent;
- }
- if (m_writehdcp22.Text != LResource.Skip)
- {
- m_writehdcp22.Text = "Null";
- m_writehdcp22.BackColor = Color.Transparent;
- }
- if (m_writeattestation.Text != LResource.Skip)
- {
- m_writeattestation.Text = "Null";
- m_writeattestation.BackColor = Color.Transparent;
- }
- if (m_writeMGK.Text != LResource.Skip)
- {
- m_writeMGK.Text = "Null";
- m_writeMGK.BackColor = Color.Transparent;
- }
- if (m_writeFairplay.Text != LResource.Skip)
- {
- m_writeFairplay.Text = "Null";
- m_writeFairplay.BackColor = Color.Transparent;
- }
- if (m_writeECP.Text != LResource.Skip)
- {
- m_writeECP.Text = "Null";
- m_writeECP.BackColor = Color.Transparent;
- }
- if (m_writeLEK.Text != LResource.Skip)
- {
- m_writeLEK.Text = "Null";
- m_writeLEK.BackColor = Color.Transparent;
- }
- if (m_writePEK.Text != LResource.Skip)
- {
- m_writePEK.Text = "Null";
- m_writePEK.BackColor = Color.Transparent;
- }
- if (m_writeHash.Text != LResource.Skip)
- {
- m_writeHash.Text = "Null";
- m_writeHash.BackColor = Color.Transparent;
- }
- if (m_writeDSN.Text != LResource.Skip)
- {
- m_writeDSN.Text = "Null";
- m_writeDSN.BackColor = Color.Transparent;
- }
- if (m_writeWifiMac.Text != LResource.Skip)
- {
- m_writeWifiMac.Text = "Null";
- m_writeWifiMac.BackColor = Color.Transparent;
- }
- if (m_writeBTMac.Text != LResource.Skip)
- {
- m_writeBTMac.Text = "Null";
- m_writeBTMac.BackColor = Color.Transparent;
- }
- if (m_writeDSN.Text != LResource.Skip)
- {
- m_writeDSN.Text = "Null";
- m_writeDSN.BackColor = Color.Transparent;
- }
- if (m_writePlayready.Text != LResource.Skip)
- {
- m_writePlayready.Text = "Null";
- m_writePlayready.BackColor = Color.Transparent;
- }
- if (m_writeYouTube.Text != LResource.Skip)
- {
- m_writeYouTube.Text = "Null";
- m_writeYouTube.BackColor = Color.Transparent;
- }
- if (m_writePSN.Text != LResource.Skip)
- {
- m_writePSN.Text = "Null";
- m_writePSN.BackColor = Color.Transparent;
- }
- if (m_writeACASKey.Text != LResource.Skip)
- {
- m_writeACASKey.Text = "Null";
- m_writeACASKey.BackColor = Color.Transparent;
- }
- if (m_writeEDIDPID.Text != LResource.Skip)
- {
- m_writeEDIDPID.Text = "Null";
- m_writeEDIDPID.BackColor = Color.Transparent;
- }
- if (m_writeEDIDName.Text != LResource.Skip)
- {
- m_writeEDIDName.Text = "Null";
- m_writeEDIDName.BackColor = Color.Transparent;
- }
- /////////////////////////////////////////////////////////////
- /// Write Check;
- if (m_checkci.Text != LResource.Skip)
- {
- m_checkci.Text = "Null";
- m_checkci.BackColor = Color.Transparent;
- }
- if (m_checkmac.Text != LResource.Skip)
- {
- m_checkmac.Text = "Null";
- m_checkmac.BackColor = Color.Transparent;
- }
- if (m_checkdid.Text != LResource.Skip)
- {
- m_checkdid.Text = "Null";
- m_checkdid.BackColor = Color.Transparent;
- }
- if (m_checkesn.Text != LResource.Skip)
- {
- m_checkesn.Text = "Null";
- m_checkesn.BackColor = Color.Transparent;
- }
- if (m_checkwidi.Text != LResource.Skip)
- {
- m_checkwidi.Text = "Null";
- m_checkwidi.BackColor = Color.Transparent;
- }
- if (m_checkwidevine.Text != LResource.Skip)
- {
- m_checkwidevine.Text = "Null";
- m_checkwidevine.BackColor = Color.Transparent;
- }
- if (m_checkhdcp.Text != LResource.Skip)
- {
- m_checkhdcp.Text = "Null";
- m_checkhdcp.BackColor = Color.Transparent;
- }
- if (m_checkhdcp22.Text != LResource.Skip)
- {
- m_checkhdcp22.Text = "Null";
- m_checkhdcp22.BackColor = Color.Transparent;
- }
- if (m_checkattestation.Text != LResource.Skip)
- {
- m_checkattestation.Text = "Null";
- m_checkattestation.BackColor = Color.Transparent;
- }
- if (m_checkMGK.Text != LResource.Skip)
- {
- m_checkMGK.Text = "Null";
- m_checkMGK.BackColor = Color.Transparent;
- }
- if (m_checkFairplay.Text != LResource.Skip)
- {
- m_checkFairplay.Text = "Null";
- m_checkFairplay.BackColor = Color.Transparent;
- }
- if (m_checkECP.Text != LResource.Skip)
- {
- m_checkECP.Text = "Null";
- m_checkECP.BackColor = Color.Transparent;
- }
- if (m_checkLEK.Text != LResource.Skip)
- {
- m_checkLEK.Text = "Null";
- m_checkLEK.BackColor = Color.Transparent;
- }
- if (m_checkPEK.Text != LResource.Skip)
- {
- m_checkPEK.Text = "Null";
- m_checkPEK.BackColor = Color.Transparent;
- }
- if (m_checkHash.Text != LResource.Skip)
- {
- m_checkHash.Text = "Null";
- m_checkHash.BackColor = Color.Transparent;
- }
- if (m_checkDSN.Text != LResource.Skip)
- {
- m_checkDSN.Text = "Null";
- m_checkDSN.BackColor = Color.Transparent;
- }
- if (m_checkWifiMac.Text != LResource.Skip)
- {
- m_checkWifiMac.Text = "Null";
- m_checkWifiMac.BackColor = Color.Transparent;
- }
- if (m_checkBTMac.Text != LResource.Skip)
- {
- m_checkBTMac.Text = "Null";
- m_checkBTMac.BackColor = Color.Transparent;
- }
- if (m_checkDSN.Text != LResource.Skip)
- {
- m_checkDSN.Text = "Null";
- m_checkDSN.BackColor = Color.Transparent;
- }
- if (m_checkPlayready.Text != LResource.Skip)
- {
- m_checkPlayready.Text = "Null";
- m_checkPlayready.BackColor = Color.Transparent;
- }
- if (m_checkYouTube.Text != LResource.Skip)
- {
- m_checkYouTube.Text = "Null";
- m_checkYouTube.BackColor = Color.Transparent;
- }
- if (m_checkACASKey.Text != LResource.Skip)
- {
- m_checkACASKey.Text = "Null";
- m_checkACASKey.BackColor = Color.Transparent;
- }
- /////////////////////////////////////////////////////////////
- /// Read Check;
- if (m_readci.Text != LResource.Skip)
- {
- m_readci.Text = "Null";
- m_readci.BackColor = Color.Transparent;
- }
- if (m_readmac.Text != LResource.Skip)
- {
- m_readmac.Text = "Null";
- m_readmac.BackColor = Color.Transparent;
- }
- if (m_readdid.Text != LResource.Skip)
- {
- m_readdid.Text = "Null";
- m_readdid.BackColor = Color.Transparent;
- }
- if (m_readesn.Text != LResource.Skip)
- {
- m_readesn.Text = "Null";
- m_readesn.BackColor = Color.Transparent;
- }
- if (m_readwidi.Text != LResource.Skip)
- {
- m_readwidi.Text = "Null";
- m_readwidi.BackColor = Color.Transparent;
- }
- if (m_readwidevine.Text != LResource.Skip)
- {
- m_readwidevine.Text = "Null";
- m_readwidevine.BackColor = Color.Transparent;
- }
- if (m_readhdcp.Text != LResource.Skip)
- {
- m_readhdcp.Text = "Null";
- m_readhdcp.BackColor = Color.Transparent;
- }
- if (m_readhdcp22.Text != LResource.Skip)
- {
- m_readhdcp22.Text = "Null";
- m_readhdcp22.BackColor = Color.Transparent;
- }
- if (m_readattestation.Text != LResource.Skip)
- {
- m_readattestation.Text = "Null";
- m_readattestation.BackColor = Color.Transparent;
- }
- if (m_readMGK.Text != LResource.Skip)
- {
- m_readMGK.Text = "Null";
- m_readMGK.BackColor = Color.Transparent;
- }
- if (m_readFairplay.Text != LResource.Skip)
- {
- m_readFairplay.Text = "Null";
- m_readFairplay.BackColor = Color.Transparent;
- }
- if (m_readECP.Text != LResource.Skip)
- {
- m_readECP.Text = "Null";
- m_readECP.BackColor = Color.Transparent;
- }
- if (m_readLEK.Text != LResource.Skip)
- {
- m_readLEK.Text = "Null";
- m_readLEK.BackColor = Color.Transparent;
- }
- if (m_readPEK.Text != LResource.Skip)
- {
- m_readPEK.Text = "Null";
- m_readPEK.BackColor = Color.Transparent;
- }
- if (m_readHash.Text != LResource.Skip)
- {
- m_readHash.Text = "Null";
- m_readHash.BackColor = Color.Transparent;
- }
- if (m_readDSN.Text != LResource.Skip)
- {
- m_readDSN.Text = "Null";
- m_readDSN.BackColor = Color.Transparent;
- }
- if (m_readWifiMac.Text != LResource.Skip)
- {
- m_readWifiMac.Text = "Null";
- m_readWifiMac.BackColor = Color.Transparent;
- }
- if (m_readBTMac.Text != LResource.Skip)
- {
- m_readBTMac.Text = "Null";
- m_readBTMac.BackColor = Color.Transparent;
- }
- if (m_readDSN.Text != LResource.Skip)
- {
- m_readDSN.Text = "Null";
- m_readDSN.BackColor = Color.Transparent;
- }
- if (m_readPlayready.Text != LResource.Skip)
- {
- m_readPlayready.Text = "Null";
- m_readPlayready.BackColor = Color.Transparent;
- }
- if (m_readYouTube.Text != LResource.Skip)
- {
- m_readYouTube.Text = "Null";
- m_readYouTube.BackColor = Color.Transparent;
- }
- if (m_readPSN.Text != LResource.Skip)
- {
- m_readPSN.Text = "Null";
- m_readPSN.BackColor = Color.Transparent;
- }
- if(m_readACASID.Text != LResource.Skip)
- {
- m_readACASID.Text = "Null";
- m_readACASID.BackColor = Color.Transparent;
- }
- if(m_readEDIDPID.Text != LResource.Skip)
- {
- m_readEDIDPID.Text = "Null";
- m_readEDIDPID.BackColor = Color.Transparent;
- }
- if(m_readEDIDName.Text != LResource.Skip)
- {
- m_readEDIDName.Text = "Null";
- m_readEDIDName.BackColor = Color.Transparent;
- }
- if (m_readACASKey.Text != LResource.Skip)
- {
- m_readACASKey.Text = "Null";
- m_readACASKey.BackColor = Color.Transparent;
- }
- ResultStatus.Text = "Wait";
- ResultStatus.BackColor = Color.Transparent;
- SHOPText.BackColor = Color.Transparent;
- OSDText.BackColor = Color.Transparent;
- WBPathText.BackColor = Color.Transparent;
- ProductMsg_Text.BackColor = Color.Transparent;
- }
- /// <summary>
- /// 执行抄key等动作
- /// </summary>
- public void Writekey()
- {
- ArrayList keypath = new ArrayList();
- ArrayList keyStream = new ArrayList();
- ArrayList keyReader = new ArrayList();
- //int SerailDelay = FunctionSettingNow.SerailDelay;
- int SerailDelay = FunctionSettingNow.NextCommandWaitTime;
- Log.WriteInfoLog(SN + " start testing");
- bool TestResult = false;
- string keycontent = "";
- if (SN != null)
- if (SN.Trim().Length > 0)
- keycontent += "sn=" + SN + "&";
- bool EnterFactoryResult = false;
- byte[] result;
- byte[] data;
- string error;
- //进工厂
- if (!TVPort.IsOpen)
- {
- try
- {
- TVPort.Open();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- return;
- }
- }
- for (int i = 0; i <= FunctionSettingNow.EnterFactoryRetry; i++)
- {
- if (i == 0)
- Log.WriteInfoLog("Enter factory...");
- else
- Log.WriteInfoLog("Retry enter factory " + i.ToString() + " ...");
- if (SerialCMD.EnterFactory(TVPort, out result, out data, out error, SerailDelay))
- {
- EnterFactoryResult = true;
- break;
- }
- }
- if (!EnterFactoryResult)
- {
- Log.WriteErrorLog(SN + " Enter factory fail");
- MessageBox.Show(LResource.EnterFactoryError);
- goto end;
- }
- //烧录SN
- if (WritePSN.Checked)
- {
- Log.WriteInfoLog("Write PSN");
- if (SerialCMD.SetFireTVPSN(TVPort, Encoding.ASCII.GetBytes(SN), out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writePSN);
- Log.WriteInfoLog("Read PSN");
- if (SerialCMD.ReadFireTVPSN(TVPort, out result, out data, out error, SerailDelay))
- {
- if (!Encoding.ASCII.GetString(data).Equals(SN))
- {
- Log.WriteErrorLog("Compare PSN error!\r\n" + SN);
- MessageBox.Show("Compare PSN error!\r\n" + SN);
- goto end;
- }
- SetsuccessStatus(m_readPSN);
- }
- else
- {
- SetfailStatus(m_readPSN);
- Log.WriteErrorLog("Read S/N error!\r\n" + SN);
- MessageBox.Show("Read S/N error!\r\n" + SN);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writePSN);
- Log.WriteErrorLog("Write S/N error!\r\n" + SN);
- MessageBox.Show("Write S/N error!\r\n" + SN);
- goto end;
- }
- }
- // 如果是G客户,要在抄写其他key前时行fsn+psn查重处理;
- if (WriteDSN.Checked)
- {
- // 计算函数耗时;
- Stopwatch watch = new Stopwatch();
- watch.Start();
- if (SN == null)
- {
- MessageBox.Show("Please scan to trigger testing");
- goto end;
- }
- if (SN.Trim().Length == 0)
- {
- MessageBox.Show("Please scan to trigger testing");
- goto end;
- }
- Log.WriteInfoLog("Read FireTV Device Code...\r\n");
- if (SerialCMD.GetFireTVDevcieCode(TVPort, out result, out data, out error, SerailDelay))
- {
- string devicecode = Encoding.ASCII.GetString(data);
- if (devicecode == "N/A")
- {
- Log.WriteErrorLog("Device code format error!\r\n" + devicecode);
- MessageBox.Show(LResource.DeviceCodeFormatError + "\r\n" + devicecode);
- goto end;
- }
- // 先读取psn的值;
- byte[] result_psn;
- byte[] data_psn;
- string error_psn;
- #if true // 波兰工厂临时解决方案;
- if (PSN.Length == 17)
- {
- if (CommonMethod.GetFireTVDsn(midListNow.host, orderNow, Encoding.ASCII.GetString(data), SN, PSN, out string dsn, out error_psn, errorDBNow))
- {
- #else
- if (SerialCMD.ReadFireTVPSN(TVPort, out result_psn, out data_psn, out error_psn, SerailDelay))
- {
- string psn = Encoding.ASCII.GetString(data_psn);
- if (CommonMethod.GetFireTVDsn(midListNow.host, orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, out error_psn, errorDBNow))
- {
- #endif
- keyInfo.DSN = dsn;
- if (!CommonMethod.IsNumberAndWord(keyInfo.DSN))
- {
- Log.WriteErrorLog("DSN format error!\r\n" + keyInfo.DSN);
- MessageBox.Show(LResource.DSNFormatError + "\r\n" + keyInfo.DSN);
- goto end;
- }
- byte[] DSNData = System.Text.Encoding.ASCII.GetBytes(keyInfo.DSN);
- Log.WriteInfoLog("Write DSN...");
- if (SerialCMD.SetFireTVDSN(TVPort, DSNData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeDSN);
- Log.WriteInfoLog("Check DSN...");
- if (writeCheckNow.DSNCheckcheck ? SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkDSN);
- Log.WriteInfoLog("Read DSN...");
- if (readCheckNow.DSNReadcheck ? SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (SerialInit.BytesCompare_Base64(data, DSNData))
- {
- SetsuccessStatus(m_readDSN);
- //DSN读取别对成功
- }
- else
- {
- Log.WriteErrorLog(SN + " contrast DSN fail");
- MessageBox.Show(LResource.ContrastDSNError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_readDSN);
- Log.WriteErrorLog(SN + " read DSN fail");
- MessageBox.Show(LResource.ReadDSNError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkDSN);
- Log.WriteErrorLog(SN + " check DSN fail");
- MessageBox.Show(LResource.CheckDSNError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeDSN);
- Log.WriteErrorLog(SN + " Write DSN fail");
- MessageBox.Show(LResource.SetDSNError);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(error_psn);
- goto end;
- }
- }
- else
- {
- Log.WriteErrorLog("Failed to read PSN when requesting DSN !\r\n" + devicecode);
- MessageBox.Show(LResource.ReadPSNError);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.GetDeviceCodeError);
- goto end;
- }
- watch.Stop();
- Log.WriteInfoLog(string.Format("Write DSN Elapsed={0}", watch.Elapsed.TotalMilliseconds));
- }
- // 如果是要导出ACASID+SN,先判断ACASID是否等于20位长度;
- if (FunctionSettingNow.ExportSNACASID)
- {
- if (SerialCMD.ReadJapaneseACASID(TVPort, out result, out data, out error, SerailDelay))
- {
- if (data.Length != 20)
- {
- SetfailStatus(m_readACASID);
- Log.WriteErrorLog("The ACAS ID length doesn't equal 20!\r\n" + data.ToString());
- MessageBox.Show(LResource.ACASIDLengthError + "\r\n" + data.ToString());
- goto end;
- }
- SetsuccessStatus(m_readACASID);
- }
- else
- {
- SetfailStatus(m_readACASID);
- Log.WriteErrorLog("Read ACAS ID error!\r\n");
- MessageBox.Show(LResource.ReadACASIDError + "\r\n");
- goto end;
- }
- }
- //获取key
- if (midListNow.host == "LocalPC" && !preloadNow)
- {
- string Didpath = "";
- string Macpath = "";
- string Hdcppath = "";
- string Hdcp22path = "";
- string Esnpath = "";
- string MGKpath = "";
- string Widipath = "";
- string Widevinepath = "";
- string Cipath = "";
- string Attestationpath = "";
- string Fairplaypath = "";
- string LEKpath = "";
- string PEKpath = "";
- string Playreadypath = "";
- string Hashkeypath = "";
- string AcasKeypath = "";
- if (WriteDID.Checked)
- {
- if (GetLocalKeyCount.GetLocalStringKeys(orderNow, "DeviceID", FunctionSettingNow.LocalDidSize, out FileStream Stream, out StreamReader Reader, out string did, out Didpath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.DID = did;
- Log.WriteGetKeyLog("\r\nLocal DeviceID=" + keyInfo.DID);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Didpath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetDIDError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteMac.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "MAC", FunctionSettingNow.LocalMacSize, out FileStream Stream, out BinaryReader Reader, out string mac, out Macpath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.Mac = mac;
- Log.WriteGetKeyLog("\r\nLocal Mac=" + keyInfo.Mac);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Macpath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetMacError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteHDCP.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "HDCPKEY", FunctionSettingNow.LocalHdcpSize, out FileStream Stream, out BinaryReader Reader, out string hdcp, out Hdcppath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.HDCP = hdcp;
- Log.WriteGetKeyLog("\r\nLocal HDCP=" + keyInfo.HDCP);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Hdcppath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetHDCPError + error);
- goto end;
- }
- }
- if (WriteHDCP22.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "HDCPKEY22", FunctionSettingNow.LocalHdcp22Size, out FileStream Stream, out BinaryReader Reader, out string hdcp22, out Hdcp22path, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.HDCP22 = hdcp22;
- Log.WriteGetKeyLog("\r\nLocal HDCP22=" + keyInfo.HDCP22);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Hdcp22path);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetHDCP22Error + error);
- goto end;
- }
- }
- if (WriteESN.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "ESN", FunctionSettingNow.LocalEsnSize, out FileStream Stream, out BinaryReader Reader, out string esn, out Esnpath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.ESN = esn;
- Log.WriteGetKeyLog("\r\nLocal ESN=" + keyInfo.ESN);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Esnpath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetESNError + error);
- goto end;
- }
- }
- if (WriteMGK.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "MGK", FunctionSettingNow.LocalMGKSize, out FileStream Stream, out BinaryReader Reader, out string mgk, out MGKpath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.MGK = mgk;
- Log.WriteGetKeyLog("\r\nLocal MGK=" + keyInfo.MGK);
- if (Stream != null && Reader != null)
- {
- keypath.Add(MGKpath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetMGKError + error);
- goto end;
- }
- }
- if (WriteFairplay.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Fairplay", FunctionSettingNow.LocalFairplaySize, out FileStream Stream, out BinaryReader Reader, out string fairplay, out Fairplaypath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.Fairplay = fairplay;
- Log.WriteGetKeyLog("\r\nLocal Fairplay=" + keyInfo.Fairplay);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Fairplaypath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetFairplayError + error);
- goto end;
- }
- }
- if (WriteWiDi.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "WiDi", FunctionSettingNow.LocalWidiSize, out FileStream Stream, out BinaryReader Reader, out string widi, out Widipath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.WiDi = widi;
- Log.WriteGetKeyLog("\r\nLocal WiDi=" + keyInfo.WiDi);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Widipath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetWiDiError + error);
- goto end;
- }
- }
- if (WriteWidevine.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Widevine", FunctionSettingNow.LocalWidevineSize, out FileStream Stream, out BinaryReader Reader, out string widevine, out Widevinepath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.Widevine = widevine;
- Log.WriteGetKeyLog("\r\nLocal Widevine=" + keyInfo.Widevine);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Widevinepath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetWidevineError + error);
- goto end;
- }
- }
- if (WriteCiplus.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "CIKEY", FunctionSettingNow.LocalCiSize, out FileStream Stream, out BinaryReader Reader, out string ci, out Cipath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.CI_plus = ci;
- Log.WriteGetKeyLog("\r\nLocal CI_plus=" + keyInfo.CI_plus);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Cipath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetCiError + error);
- goto end;
- }
- }
- if (WriteAttestation.Checked)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Attestation", FunctionSettingNow.LocalCiSize, out FileStream Stream, out BinaryReader Reader, out string attestation, out Attestationpath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.Attestation = attestation;
- Log.WriteGetKeyLog("\r\nLocal attestation=" + keyInfo.Attestation);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Attestationpath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetAttestationError + error);
- goto end;
- }
- }
- if (fireTVKey.LEK)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "LEK", -1, out FileStream Stream, out BinaryReader Reader, out string lek, out LEKpath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.LEK = lek;
- Log.WriteGetKeyLog("\r\nLocal LEK=" + keyInfo.LEK);
- if (Stream != null && Reader != null)
- {
- keypath.Add(LEKpath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show("获取LEK失败" + error);
- goto end;
- }
- }
- if (fireTVKey.PEK)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "PEK", -1, out FileStream Stream, out BinaryReader Reader, out string pek, out PEKpath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.PEK = pek;
- Log.WriteGetKeyLog("\r\nLocal LEK=" + keyInfo.PEK);
- if (Stream != null && Reader != null)
- {
- keypath.Add(PEKpath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show("获取PEK失败" + error);
- goto end;
- }
- }
- if (fireTVKey.Playready)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Playready", -1, out FileStream Stream, out BinaryReader Reader, out string playready, out Playreadypath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.Playready = playready;
- Log.WriteGetKeyLog("\r\nLocal Playready=" + keyInfo.Playready);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Playreadypath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show("获取Playready失败" + error);
- goto end;
- }
- }
- if (fireTVKey.Hashkey)
- {
- if (GetLocalKeyCount.GetLocalHexKeys(orderNow, "Hashkey", -1, out FileStream Stream, out BinaryReader Reader, out string hashkey, out Hashkeypath, out error, errorDBNow, ref localmidList, SN))
- {
- keyInfo.Hashkey = hashkey;
- Log.WriteGetKeyLog("\r\nLocal Hashkey=" + keyInfo.Hashkey);
- if (Stream != null && Reader != null)
- {
- keypath.Add(Fairplaypath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show("获取hashkey失败" + error);
- goto end;
- }
- }
- if (WriteACASKey.Checked)
- {
- 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))
- {
- keyInfo.ACASKey_Data = acaskey;
- Log.WriteGetKeyLog("\r\nLocal ACASKey=" + keyInfo.ACASKey_Data);
- if (Stream != null && Reader != null)
- {
- keypath.Add(AcasKeypath);
- keyStream.Add(Stream);
- keyReader.Add(Reader);
- }
- }
- else
- {
- Log.WriteErrorLog(error);
- MessageBox.Show(LResource.GetACASKeyError + error);
- goto end;
- }
- }
- if (localmidList.host != null)
- {
- if (ClientTypeText.Text.Length == 0)
- {
- SetTextStatus(ClientTypeText, localmidList.clienttype);
- }
- if (SVText.Text.Length == 0)
- {
- SetTextStatus(SVText, localmidList.version);
- }
- if (ProjectIDText.Text.Length == 0)
- {
- SetTextStatus(ProjectIDText, localmidList.projectid);
- }
- }
- }
- else if (!preloadNow)
- {
- // 计算获取全部key耗时;
- Stopwatch watch = new Stopwatch();
- watch.Start();
- if (WriteDID.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "DeviceID", SN, "devicetype=tcl_unknown_model", errorDBNow, out string did, out error, orderNow, out string md5))
- {
- keyInfo.DID = did;
- Log.WriteGetKeyLog("\r\nDeviceID=" + keyInfo.DID);
- }
- else
- {
- MessageBox.Show(LResource.GetDIDError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteMac.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "MAC", SN, midListNow.keytype["MAC"], errorDBNow, out string mac, out error, orderNow, out string md5))
- {
- keyInfo.Mac = mac;
- Log.WriteGetKeyLog("\r\nMac=" + keyInfo.Mac);
- }
- else
- {
- MessageBox.Show(LResource.GetMacError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteHDCP.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "HDCP_KEY", SN, midListNow.keytype["HDCP_KEY"], errorDBNow, out string hdcp, out error, orderNow, out string md5))
- {
- keyInfo.HDCP = hdcp;
- Log.WriteGetKeyLog("\r\nHDCP=" + keyInfo.HDCP);
- }
- else
- {
- MessageBox.Show(LResource.GetHDCPError + error);
- goto end;
- }
- }
- if (WriteHDCP22.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "HDCP2.2_KEY", SN, midListNow.keytype["HDCP2.2_KEY"], errorDBNow, out string hdcp22, out error, orderNow, out string md5))
- {
- keyInfo.HDCP22 = hdcp22;
- Log.WriteGetKeyLog("\r\nHDCP22=" + keyInfo.HDCP22);
- }
- else
- {
- MessageBox.Show(LResource.GetHDCP22Error + error);
- goto end;
- }
- }
- if (WriteESN.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "NETFILX_ESN", SN, midListNow.keytype["NETFILX_ESN"], errorDBNow, out string esn, out error, orderNow, out string md5))
- {
- keyInfo.ESN = esn;
- Log.WriteGetKeyLog("\r\nESN=" + keyInfo.ESN);
- }
- else
- {
- MessageBox.Show(LResource.GetESNError + error);
- goto end;
- }
- }
- if (WriteWiDi.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "WiDi", SN, midListNow.keytype["WiDi"], errorDBNow, out string widi, out error, orderNow, out string md5))
- {
- keyInfo.WiDi = widi;
- Log.WriteGetKeyLog("\r\nWiDi=" + keyInfo.WiDi);
- }
- else
- {
- MessageBox.Show(LResource.GetWiDiError + error);
- goto end;
- }
- }
- if (WriteCiplus.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "CI_PLUS_KEY", SN, midListNow.keytype["CI_PLUS_KEY"], errorDBNow, out string ci, out error, orderNow, out string md5))
- {
- keyInfo.CI_plus = ci;
- Log.WriteGetKeyLog("\r\nCI_plus=" + keyInfo.CI_plus);
- }
- else
- {
- MessageBox.Show(LResource.GetCiError + error);
- goto end;
- }
- }
- if (WriteWidevine.Checked)
- {
- if (CommonMethod.GetWidevineAnAttestationKey(
- midListNow.host,
- SN,
- midListNow.keytype["Widevine_KEY"],
- errorDBNow,
- out bool isAndroidTV,
- out string widevine,
- out string attestation,
- out error,
- orderNow,
- out string md5))
- {
- keyInfo.Widevine = widevine;
- Log.WriteGetKeyLog("\r\nWidevine=" + keyInfo.Widevine);
- if (isAndroidTV)
- {
- keyInfo.Attestation = attestation;
- keyInfo.AttestationMD5 = md5;
- Log.WriteGetKeyLog("\r\nAttestationMD5=" + keyInfo.AttestationMD5);
- }
- }
- else
- {
- MessageBox.Show(LResource.GetWidevineError + error);
- goto end;
- }
- }
- if (WriteMGK.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "MGK_KEY", SN, midListNow.keytype["MGK_KEY"], errorDBNow, out string mgk, out error, orderNow, out string md5))
- {
- keyInfo.MGK = mgk;
- Log.WriteGetKeyLog("\r\nMGK=" + keyInfo.MGK);
- }
- else
- {
- MessageBox.Show(LResource.GetMGKError + error);
- goto end;
- }
- }
- if (WriteFairplay.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "Fairplay_KEY", SN, midListNow.keytype["Fairplay_KEY"], errorDBNow, out string fairplay, out error, orderNow, out string md5))
- {
- keyInfo.Fairplay = fairplay;
- Log.WriteGetKeyLog("\r\nFairplay=" + keyInfo.Fairplay);
- }
- else
- {
- MessageBox.Show(LResource.GetFairplayError + error);
- goto end;
- }
- }
- if (WriteWifiMac.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "MAC", "WiFi_MAC" + SN, midListNow.keytype["MAC"], errorDBNow, out string mac, out error, orderNow, out string md5))
- {
- keyInfo.WiFi_MAC = mac;
- Log.WriteGetKeyLog("\r\nWiFi_MAC=" + keyInfo.WiFi_MAC);
- }
- else
- {
- MessageBox.Show(LResource.GetMacError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteBTMac.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "MAC", "BT_MAC" + SN, midListNow.keytype["MAC"], errorDBNow, out string mac, out error, orderNow, out string md5))
- {
- keyInfo.BT_MAC = mac;
- Log.WriteGetKeyLog("\r\nBT_MAC=" + keyInfo.BT_MAC);
- }
- else
- {
- MessageBox.Show(LResource.GetMacError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteECP.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "ECP_KEY", SN, midListNow.keytype["ECP_KEY"], errorDBNow, out string ecp, out error, orderNow, out string md5))
- {
- keyInfo.ECP = ecp;
- Log.WriteGetKeyLog("\r\nECP_KEY=" + keyInfo.ECP);
- }
- else
- {
- MessageBox.Show(LResource.GetECPError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteLEK.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "LEK", SN, midListNow.keytype["LEK"], errorDBNow, out string lek, out error, orderNow, out string md5))
- {
- keyInfo.LEK = lek;
- Log.WriteGetKeyLog("\r\nLEK=" + keyInfo.LEK);
- }
- else
- {
- MessageBox.Show(LResource.GetLEKError + "\r\n" + error);
- goto end;
- }
- }
- if (WritePEK.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "PEK", SN, midListNow.keytype["PEK"], errorDBNow, out string pek, out error, orderNow, out string md5))
- {
- keyInfo.PEK = pek;
- Log.WriteGetKeyLog("\r\nPEK=" + keyInfo.PEK);
- }
- else
- {
- MessageBox.Show(LResource.GetPEKError + "\r\n" + error);
- goto end;
- }
- }
- if (WritePlayready.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "PlayReady_key", SN, midListNow.keytype["PlayReady_key"], errorDBNow, out string playready, out error, orderNow, out string md5))
- {
- keyInfo.Playready = playready;
- Log.WriteGetKeyLog("\r\nPlayReady_key=" + keyInfo.Playready);
- }
- else
- {
- MessageBox.Show(LResource.GetPlayreadyError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteHash.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "Hashkey", SN, midListNow.keytype["Hashkey"], errorDBNow, out string hash, out error, orderNow, out string md5))
- {
- keyInfo.Hashkey = hash;
- Log.WriteGetKeyLog("\r\nHashkey=" + keyInfo.Hashkey);
- }
- else
- {
- MessageBox.Show(LResource.GetHashkeyError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteYouTube.Checked)
- {
- if (CommonMethod.GetKeys(midListNow.host, "YouTube_KEY", SN, midListNow.keytype["YouTube_KEY"], errorDBNow, out string youtube, out error, orderNow, out string md5))
- {
- keyInfo.YouTube_KEY = youtube;
- Log.WriteGetKeyLog("\r\nYouTube_KEY=" + keyInfo.YouTube_KEY);
- }
- else
- {
- MessageBox.Show(LResource.GetYouTubekeyError + "\r\n" + error);
- goto end;
- }
- }
- if (WriteEDIDPID.Checked)
- {
- keyInfo.EDIDPid = midListNow.keytype["edid_pid"];
- }
- if (WriteEDIDName.Checked)
- {
- keyInfo.EDIDModelName = midListNow.keytype["edid_model_name"];
- }
- if (WriteACASKey.Checked)
- {
- if (CommonMethod.GetAcasKey(midListNow.host, "ACAS_KEY", SN, midListNow.keytype["ACAS_KEY"], errorDBNow, orderNow, out string acaskey_data, out string acaskey_datamd5, out string acaskey_tool, out string acaskey_toolmd5, out error))
- {
- keyInfo.ACASKey_Data = acaskey_data;
- keyInfo.ACASKey_DataMd5 = acaskey_datamd5;
- keyInfo.ACASKey_Tool = acaskey_tool;
- keyInfo.ACASKey_ToolMd5 = acaskey_toolmd5;
- Log.WriteGetKeyLog("\r\nACAS_KEY_DATA=" + keyInfo.ACASKey_Data + "\r\nACAS_KEY_MD5=" + keyInfo.ACASKey_DataMd5);
- Log.WriteGetKeyLog("\r\nACAS_KEY_TOOL=" + keyInfo.ACASKey_Tool + "\r\nACAS_KEY_TOOLMD5=" + keyInfo.ACASKey_ToolMd5);
- }
- else
- {
- MessageBox.Show(LResource.GetACASKeyError + "\r\n" + error);
- goto end;
- }
- }
- watch.Stop();
- Log.WriteInfoLog(string.Format("Get All Keys Elapsed={0}", watch.Elapsed.TotalMilliseconds));
- }
- // 如果是抄写EDID,则不获取白平衡数据;
- if (CommonMethod.IsEDIDCopy(midListNow))
- {
- SetspecificText(SoftwareVersionNote, LResource.SkipChecking, Color.Yellow);
- SetspecificText(ClientTypeNote, LResource.SkipChecking, Color.Yellow);
- if(midListNow.projectid.Equals("0"))
- SetspecificText(ProjectIDNote, LResource.SkipCovering, Color.Yellow);
- }
- //检查Software version
- if (SoftwareVersionNote.Text != LResource.SkipChecking)
- {
- Log.WriteInfoLog("Check software version...\r\n");
- if (SerialCMD.GetSoftVersion(TVPort, out result, out data, out error, SerailDelay))
- {
- string sfv = Encoding.ASCII.GetString(data);
- if (sfv != SVText.Text)
- {
- MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
- DialogResult dr = MessageBox.Show(LResource.MainboardFV + sfv + LResource.differentfromserver + SVText.Text + "\r\n" + LResource.SkipFVChecking, LResource.Error, messButton);
- if (dr == DialogResult.OK)
- {
- SetspecificText(SoftwareVersionNote, LResource.SkipChecking, Color.Yellow);
- SetcolorStatus(SVText, Color.Yellow);
- }
- else
- {
- SetspecificText(SoftwareVersionNote, sfv, Color.Red);
- SetcolorStatus(SVText, Color.Red);
- goto end;
- }
- }
- else
- {
- SetcolorStatus(SVText, Color.FromArgb(128, 255, 128));
- }
- }
- else
- {
- Log.WriteErrorLog(SN + " Read software version fail");
- MessageBox.Show(LResource.ReadSVError);
- goto end;
- }
- }
- //DID抄写
- if (WriteDID.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.DID))
- {
- Log.WriteErrorLog("DID format error!\r\n" + keyInfo.DID);
- MessageBox.Show(LResource.DIDFormatError + "\r\n" + keyInfo.DID);
- goto end;
- }
- byte[] DIDData = Encoding.ASCII.GetBytes(keyInfo.DID);
- Log.WriteInfoLog("Write DID...");
- if (SerialCMD.SetDeviceID(TVPort, DIDData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writedid);
- keycontent += "deviceid=" + keyInfo.DID + "&";
- Log.WriteInfoLog("Check DID...");
- if (writeCheckNow.DIDCheckcheck ? SerialCMD.CheckDeviceId(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkdid);
- Log.WriteInfoLog("Read DID...");
- if (readCheckNow.DIDReadcheck ? SerialCMD.GetDeviceId(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.DIDReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, DIDData))
- {
- SetsuccessStatus(m_readdid);
- }
- else
- {
- SetfailStatus(m_readdid);
- Log.WriteErrorLog(SN + " contrast DID fail");
- MessageBox.Show(LResource.ContrastDIDError);
- goto end; ;
- }
- }
- }
- else
- {
- SetfailStatus(m_readdid);
- Log.WriteErrorLog(SN + " read DID fail");
- MessageBox.Show(LResource.ReadDIDError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkdid);
- Log.WriteErrorLog(SN + " check DID fail");
- MessageBox.Show(LResource.CheckDIDError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writedid);
- Log.WriteErrorLog(SN + " Write DID fail");
- MessageBox.Show(LResource.SetDIDError);
- goto end;
- }
- }
- //Eth_Mac抄写
- if (WriteMac.Checked)
- {
- string mac = keyInfo.Mac.Replace("-", "");
- if (!CommonMethod.IsNumberAndWord(mac))
- {
- Log.WriteErrorLog("Mac format error!\r\n" + mac);
- MessageBox.Show(LResource.MacFormatError + "\r\n" + mac);
- goto end;
- }
- byte[] MacData = SerialInit.HexToByte(mac);
- Log.WriteInfoLog("Write Mac...");
- if (SerialCMD.SetMAC(TVPort, MacData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writemac);
- keycontent += "mac=" + keyInfo.Mac + "&";
- Log.WriteInfoLog("Check Mac...");
- if (writeCheckNow.MacCheckcheck ? SerialCMD.CheckMAC(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkmac);
- Log.WriteInfoLog("Read Mac...");
- if (readCheckNow.MacReadcheck ? SerialCMD.GetMAC(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.MacReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, MacData))
- {
- SetsuccessStatus(m_readmac);
- }
- else
- {
- SetfailStatus(m_readmac);
- Log.WriteErrorLog(SN + " contrast Mac fail");
- MessageBox.Show(LResource.ContrastMacError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readmac);
- Log.WriteErrorLog(SN + " read Mac fail");
- MessageBox.Show(LResource.ReadMacError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkmac);
- Log.WriteErrorLog(SN + " check Mac fail");
- MessageBox.Show(LResource.CheckMacError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writemac);
- Log.WriteErrorLog(SN + " Write Mac fail");
- MessageBox.Show(LResource.WriteMacError);
- goto end;
- }
- }
- //WiFi_MAC抄写
- if (WriteWifiMac.Checked)
- {
- string wifimac = keyInfo.WiFi_MAC.Replace("-", "");
- if (!CommonMethod.IsNumberAndWord(wifimac))
- {
- Log.WriteErrorLog("Wifi Mac format error!\r\n" + wifimac);
- MessageBox.Show(LResource.MacFormatError + "\r\n" + wifimac);
- goto end;
- }
- byte[] WifiMacData = Encoding.ASCII.GetBytes(wifimac);
- Log.WriteInfoLog("Write WifiMac...");
- if (SerialCMD.SetFireTVWifiMac(TVPort, WifiMacData, out result, out data, out error, SerailDelay))
- {
- keycontent += "wifimac=" + keyInfo.WiFi_MAC + "&";
- SetsuccessStatus(m_writeWifiMac);
- Log.WriteInfoLog("Check WifiMac...");
- if (writeCheckNow.WifiMacCheckcheck ? SerialCMD.CheckFireTVWifiMac(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkWifiMac);
- Log.WriteInfoLog("Read WifiMac...");
- if (readCheckNow.WifiMacReadcheck ? SerialCMD.GetFireTVWiFi_Mac(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.WifiMacReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, WifiMacData))
- {
- SetsuccessStatus(m_readWifiMac);
- }
- else
- {
- SetfailStatus(m_readWifiMac);
- Log.WriteErrorLog(SN + " contrast Wifi Mac fail");
- MessageBox.Show(LResource.ContrastMacError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readWifiMac);
- Log.WriteErrorLog(SN + " read Wifi Mac fail");
- MessageBox.Show(LResource.ReadMacError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkWifiMac);
- Log.WriteErrorLog(SN + " check Wifi Mac fail");
- MessageBox.Show(LResource.CheckMacError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeWifiMac);
- Log.WriteErrorLog(SN + " Write Wifi Mac fail");
- MessageBox.Show(LResource.WriteMacError);
- goto end;
- }
- }
- //BT_MAC抄写
- if (WriteBTMac.Checked)
- {
- string btmac = keyInfo.BT_MAC.Replace("-", "");
- if (!CommonMethod.IsNumberAndWord(btmac))
- {
- Log.WriteErrorLog("BTMac format error!\r\n" + btmac);
- MessageBox.Show(LResource.MacFormatError + "\r\n" + btmac);
- goto end;
- }
- byte[] BTMacData = Encoding.ASCII.GetBytes(btmac);
- Log.WriteInfoLog("Write BTMac...");
- if (SerialCMD.SetFireTVBTMac(TVPort, BTMacData, out result, out data, out error, SerailDelay))
- {
- keycontent += "btmac=" + keyInfo.BT_MAC + "&";
- SetsuccessStatus(m_writeBTMac);
- Log.WriteInfoLog("Check BTMac...");
- if (writeCheckNow.BTMacCheckcheck ? SerialCMD.CheckFireTVBTMac(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkBTMac);
- Log.WriteInfoLog("Read BTMac...");
- if (readCheckNow.BTMacReadcheck ? SerialCMD.GetFireTVBT_Mac(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.BTMacReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, BTMacData))
- {
- SetsuccessStatus(m_readBTMac);
- }
- else
- {
- SetfailStatus(m_readBTMac);
- Log.WriteErrorLog(SN + " contrast BT Mac fail");
- MessageBox.Show(LResource.ContrastMacError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readBTMac);
- Log.WriteErrorLog(SN + " read BT Mac fail");
- MessageBox.Show(LResource.ReadMacError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkBTMac);
- Log.WriteErrorLog(SN + " check BT Mac fail");
- MessageBox.Show(LResource.CheckMacError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeBTMac);
- Log.WriteErrorLog(SN + " Write BT Mac fail");
- MessageBox.Show(LResource.WriteMacError);
- goto end;
- }
- }
- //HDCP KEY抄写
- if (WriteHDCP.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.HDCP))
- {
- Log.WriteErrorLog("HDCP format error!\r\n" + keyInfo.HDCP);
- MessageBox.Show(LResource.HDCPFormatError + "\r\n" + keyInfo.HDCP);
- goto end;
- }
- byte[] HDCPData = SerialInit.HexToByte(keyInfo.HDCP);
- Log.WriteInfoLog("Write HDCP...");
- if (SerialCMD.SetHDCPKey(TVPort, HDCPData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writehdcp);
- keycontent += "hdcpkey=" + keyInfo.HDCP + "&";
- Log.WriteInfoLog("Check HDCP...");
- if (writeCheckNow.HDCPCheckcheck ? SerialCMD.CheckHDCP(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkhdcp);
- Log.WriteInfoLog("Read HDCP...");
- if (readCheckNow.HDCPReadcheck ? SerialCMD.GetHDCPKey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.HDCPReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, HDCPData))
- {
- SetsuccessStatus(m_readhdcp);
- }
- else
- {
- SetfailStatus(m_readhdcp);
- Log.WriteErrorLog(SN + " contrast HDCP fail");
- MessageBox.Show(LResource.ContrastHDCPError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readhdcp);
- Log.WriteErrorLog(SN + " read HDCP fail");
- MessageBox.Show(LResource.ReadHDCPError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkhdcp);
- Log.WriteErrorLog(SN + " check HDCP fail");
- MessageBox.Show(LResource.CheckHDCPError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writehdcp);
- Log.WriteErrorLog(SN + " Write HDCP fail");
- MessageBox.Show(LResource.WriteHDCPError);
- goto end;
- }
- }
- //HDCP22 KEY抄写
- if (WriteHDCP22.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.HDCP22))
- {
- Log.WriteErrorLog("HDCP22 format error!\r\n" + keyInfo.HDCP22);
- MessageBox.Show(LResource.HDCP22FormatError + "\r\n" + keyInfo.HDCP22);
- goto end;
- }
- byte[] HDCP22Data = SerialInit.HexToByte(keyInfo.HDCP22);
- Log.WriteInfoLog("Write HDCP22...");
- if (SerialCMD.SetHDCPKey22(TVPort, HDCP22Data, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writehdcp22);
- keycontent += "hdcpkey2=" + keyInfo.HDCP22 + "&";
- Log.WriteInfoLog("Check HDCP22...");
- if (writeCheckNow.HDCP22Checkcheck ? SerialCMD.CheckHDCP22(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkhdcp22);
- Log.WriteInfoLog("Read HDCP22...");
- if (readCheckNow.HDCP22Readcheck ? SerialCMD.GetHDCPKey22(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.HDCP22Readcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, HDCP22Data))
- {
- SetsuccessStatus(m_readhdcp22);
- }
- else
- {
- SetfailStatus(m_readhdcp22);
- Log.WriteErrorLog(SN + " contrast HDCP22 fail");
- MessageBox.Show(LResource.ContrastHDCP22Error);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readhdcp22);
- Log.WriteErrorLog(SN + " read HDCP22 fail");
- MessageBox.Show(LResource.ReadHDCP22Error);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkhdcp22);
- Log.WriteErrorLog(SN + " check HDCP22 fail");
- MessageBox.Show(LResource.CheckHDCP22Error);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writehdcp22);
- Log.WriteErrorLog(SN + " Write HDCP22 fail");
- MessageBox.Show(LResource.WriteHDCP22Error);
- goto end;
- }
- }
- //ESN KEY抄写
- if (WriteESN.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.ESN))
- {
- Log.WriteErrorLog("ESN format error!\r\n" + keyInfo.ESN);
- MessageBox.Show(LResource.ESNFormatError + "\r\n" + keyInfo.ESN);
- goto end;
- }
- byte[] ESNData = SerialInit.HexToByte(keyInfo.ESN);
- Log.WriteInfoLog("Write ESN...");
- if (SerialCMD.SetNetflixESN(TVPort, ESNData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeesn);
- keycontent += "netfilxesn=" + keyInfo.ESN + "&";
- Log.WriteInfoLog("Check ESN...");
- if (writeCheckNow.ESNCheckcheck ? SerialCMD.CheckNetflixESN(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkesn);
- Log.WriteInfoLog("Read ESN...");
- if (readCheckNow.ESNReadcheck ? SerialCMD.GetNetflixESN(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.ESNReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, ESNData))
- {
- SetsuccessStatus(m_readesn);
- }
- else
- {
- SetfailStatus(m_readesn);
- Log.WriteErrorLog(SN + " contrast ESN fail");
- MessageBox.Show(LResource.ContrastESNError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readesn);
- Log.WriteErrorLog(SN + " read ESN fail");
- MessageBox.Show(LResource.ReadESNError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkesn);
- Log.WriteErrorLog(SN + " check ESN fail");
- MessageBox.Show(LResource.CheckESNError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeesn);
- Log.WriteErrorLog(SN + " Write ESN fail");
- MessageBox.Show(LResource.WriteESNError);
- goto end;
- }
- }
- //WiDi KEY抄写
- if (WriteWiDi.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.WiDi))
- {
- Log.WriteErrorLog("WiDi format error!\r\n" + keyInfo.WiDi);
- MessageBox.Show(LResource.WiDiFormatError + "\r\n" + keyInfo.WiDi);
- goto end;
- }
- byte[] WiDiData = SerialInit.HexToByte(keyInfo.WiDi);
- Log.WriteInfoLog("Write WiDi...");
- if (SerialCMD.SetWidi(TVPort, WiDiData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writewidi);
- keycontent += "widi=" + keyInfo.WiDi + "&";
- Log.WriteInfoLog("Check WiDi...");
- if (writeCheckNow.WiDiCheckcheck ? SerialCMD.CheckWidi(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkwidi);
- Log.WriteInfoLog("Read WiDi...");
- if (readCheckNow.WiDiReadcheck ? SerialCMD.GetWidi(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.WiDiReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, WiDiData))
- {
- SetsuccessStatus(m_readwidi);
- }
- else
- {
- SetfailStatus(m_readwidi);
- Log.WriteErrorLog(SN + " contrast WiDi fail");
- MessageBox.Show(LResource.ContrastWiDiError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readwidi);
- Log.WriteErrorLog(SN + " read WiDi fail");
- MessageBox.Show(LResource.ReadWiDiError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkwidi);
- Log.WriteErrorLog(SN + " check WiDi fail");
- MessageBox.Show(LResource.CheckWiDiError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writewidi);
- Log.WriteErrorLog(SN + " Write WiDi fail");
- MessageBox.Show(LResource.WriteWiDiError);
- goto end;
- }
- }
- //PEK抄写
- if (WritePEK.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.PEK))
- {
- Log.WriteErrorLog("PEK format error!\r\n" + keyInfo.PEK);
- MessageBox.Show(LResource.PEKFormatError + "\r\n" + keyInfo.PEK);
- goto end;
- }
- byte[] PEKData = SerialInit.HexToByte(keyInfo.PEK);
- Log.WriteInfoLog("Write PEK...");
- if (SerialCMD.SetFireTVPEK(TVPort, PEKData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writePEK);
- keycontent += "pek=" + keyInfo.PEK + "&";
- Log.WriteInfoLog("Check PEK...");
- if (writeCheckNow.PEKCheckcheck ? SerialCMD.CheckFireTVPEK(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkPEK);
- Log.WriteInfoLog("Read PEK...");
- if (readCheckNow.PEKReadcheck ? SerialCMD.ReadFireTVPEK(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.PEKReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, PEKData))
- {
- SetsuccessStatus(m_readPEK);
- }
- else
- {
- SetfailStatus(m_readPEK);
- Log.WriteErrorLog(SN + " contrast PEK fail");
- MessageBox.Show(LResource.ContrastPEKError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readPEK);
- Log.WriteErrorLog(SN + " read PEK fail");
- MessageBox.Show(LResource.ReadPEKError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkPEK);
- Log.WriteErrorLog(SN + " check PEK fail");
- MessageBox.Show(LResource.CheckPEKError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writePEK);
- Log.WriteErrorLog(SN + " Write PEK fail");
- MessageBox.Show(LResource.WritePEKError);
- goto end;
- }
- }
- //Youtube key抄写
- if (WriteYouTube.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.YouTube_KEY))
- {
- Log.WriteErrorLog("YouTube format error!\r\n" + keyInfo.YouTube_KEY);
- MessageBox.Show(LResource.YouTubeFormatError + "\r\n" + keyInfo.YouTube_KEY);
- goto end;
- }
- byte[] YouTubeData = SerialInit.HexToByte(keyInfo.YouTube_KEY);
- Log.WriteInfoLog("Write YouTube key...");
- if (SerialCMD.SetFireTVYoutube(TVPort, YouTubeData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeYouTube);
- keycontent += "youtubekey=" + keyInfo.YouTube_KEY + "&";
- Log.WriteInfoLog("Check YouTube_KEY...");
- if (writeCheckNow.YouTubeCheckcheck ? SerialCMD.CheckFireTVYoutube(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkYouTube);
- Log.WriteInfoLog("Read YouTube_KEY...");
- if (readCheckNow.YouTubeReadcheck ? SerialCMD.ReadFireTVYoutube(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.YouTubeReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, YouTubeData))
- {
- SetsuccessStatus(m_readYouTube);
- }
- else
- {
- SetfailStatus(m_readYouTube);
- Log.WriteErrorLog(SN + " contrast YouTube_KEY fail");
- MessageBox.Show(LResource.ContrastYouTubeError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readYouTube);
- Log.WriteErrorLog(SN + " read YouTube_KEY fail");
- MessageBox.Show(LResource.ReadYouTubeError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkYouTube);
- Log.WriteErrorLog(SN + " check YouTube_KEY fail");
- MessageBox.Show(LResource.CheckYouTubeError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeYouTube);
- Log.WriteErrorLog(SN + " Write YouTube_KEY fail");
- MessageBox.Show(LResource.WriteYouTubeError);
- goto end;
- }
- }
- //Widevine KEY抄写
- if (WriteWidevine.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.Widevine))
- {
- Log.WriteErrorLog("Widevine format error!\r\n" + keyInfo.Widevine);
- MessageBox.Show(LResource.WidevineFormatError + "\r\n" + keyInfo.Widevine);
- goto end;
- }
- byte[] WidevineData = SerialInit.HexToByte(keyInfo.Widevine);
- Log.WriteInfoLog("Write Widevine...");
- if (SerialCMD.SetWidevine(TVPort, WidevineData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writewidevine);
- keycontent += "widevine=" + keyInfo.Widevine + "&";
- Log.WriteInfoLog("Check Widevine...");
- if (writeCheckNow.WidevineCheckcheck ? SerialCMD.CheckWidevine(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkwidevine);
- Log.WriteInfoLog("Read Widevine...");
- if (readCheckNow.WidevineReadcheck ? SerialCMD.GetWidevine(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.WidevineReadcheck)
- {
- if (CommonMethod.CompareMD5(WidevineData, data))
- {
- SetsuccessStatus(m_readwidevine);
- }
- else
- {
- if (SerialInit.BytesCompare_Base64(data, WidevineData))
- {
- SetsuccessStatus(m_readwidevine);
- }
- else
- {
- SetfailStatus(m_readwidevine);
- Log.WriteErrorLog(SN + " contrast Widevine fail");
- MessageBox.Show(LResource.ContrastWidevineError);
- goto end;
- }
- }
- }
- }
- else
- {
- SetfailStatus(m_readwidevine);
- Log.WriteErrorLog(SN + " read Widevine fail");
- MessageBox.Show(LResource.ReadWidevineError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkwidevine);
- Log.WriteErrorLog(SN + " check Widevine fail");
- MessageBox.Show(LResource.CheckWidevineError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writewidevine);
- Log.WriteErrorLog(SN + " Write Widevine fail");
- MessageBox.Show(LResource.WriteWidevineError);
- goto end;
- }
- }
- //CI plus KEY抄写
- if (WriteCiplus.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.CI_plus))
- {
- Log.WriteErrorLog("CI_plus format error!\r\n" + keyInfo.CI_plus);
- MessageBox.Show(LResource.CI_plusFormatError + "\r\n" + keyInfo.CI_plus);
- goto end;
- }
- byte[] CiplusData = SerialInit.HexToByte(keyInfo.CI_plus);
- Log.WriteInfoLog("Write CI plus...");
- if (SerialCMD.SetCiKey(TVPort, CiplusData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeci);
- keycontent += "cikey=" + keyInfo.CI_plus + "&";
- Log.WriteInfoLog("Check CI plus...");
- if (writeCheckNow.CI_plusCheckcheck ? SerialCMD.CheckCikey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkci);
- Log.WriteInfoLog("Read CI plus...");
- if (readCheckNow.CI_plusReadcheck ? SerialCMD.GetCiKey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.CI_plusReadcheck)
- {
- if (CommonMethod.CompareMD5(CiplusData, data))
- {
- SetsuccessStatus(m_readci);
- }
- else
- {
- if (SerialInit.BytesCompare_Base64(data, CiplusData))
- {
- SetsuccessStatus(m_readci);
- }
- else
- {
- SetfailStatus(m_readci);
- Log.WriteErrorLog(SN + " contrast CI plus fail");
- MessageBox.Show(LResource.ContrastCIError);
- goto end;
- }
- }
- }
- }
- else
- {
- SetfailStatus(m_readci);
- Log.WriteErrorLog(SN + " read CI plus fail");
- MessageBox.Show(LResource.ReadCIError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkci);
- Log.WriteErrorLog(SN + " check CI plus fail");
- MessageBox.Show(LResource.CheckCIError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeci);
- Log.WriteErrorLog(SN + " Write CI plus fail");
- MessageBox.Show(LResource.WriteCIError);
- goto end;
- }
- }
- //Attestation KEY抄写
- if (WriteAttestation.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.Attestation))
- {
- Log.WriteErrorLog("Attestation key format error!\r\n" + keyInfo.Attestation);
- MessageBox.Show(LResource.AttestationFormatError + "\r\n" + keyInfo.Attestation);
- goto end;
- }
- byte[] AttestationData = SerialInit.HexToByte(keyInfo.Attestation);
- Log.WriteInfoLog("Write Attestation key...");
- if (SerialCMD.SetAttestationKey(TVPort, AttestationData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeattestation);
- keycontent += "attestationmd5=" + keyInfo.AttestationMD5 + "&";
- Log.WriteInfoLog("Check Attestation key...");
- if (writeCheckNow.AttestationCheckcheck ? SerialCMD.CheckAttestationKey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkattestation);
- Log.WriteInfoLog("Read Attestation key...");
- if (readCheckNow.AttestationReadcheck ? SerialCMD.GetAttestationKey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.AttestationReadcheck)
- {
- if (CommonMethod.CompareMD5(AttestationData, data))
- {
- SetsuccessStatus(m_readattestation);
- }
- else
- {
- if (SerialInit.BytesCompare_Base64(data, AttestationData))
- {
- SetsuccessStatus(m_readattestation);
- }
- else
- {
- SetfailStatus(m_readattestation);
- Log.WriteErrorLog(SN + " contrast Attestation key fail");
- MessageBox.Show(LResource.ContrastAttestationError);
- goto end;
- }
- }
- }
- }
- else
- {
- SetfailStatus(m_readattestation);
- Log.WriteErrorLog(SN + " read Attestation key fail");
- MessageBox.Show(LResource.ReadAttestationError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkattestation);
- Log.WriteErrorLog(SN + " check Attestation key fail");
- MessageBox.Show(LResource.CheckAttestationError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeattestation);
- Log.WriteErrorLog(SN + " Write Attestation key fail");
- MessageBox.Show(LResource.WriteAttestationError);
- goto end;
- }
- }
- //MGK KEY抄写
- if (WriteMGK.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.MGK))
- {
- Log.WriteErrorLog("MGK format error!\r\n" + keyInfo.MGK);
- MessageBox.Show(LResource.MGKFormatError + "\r\n" + keyInfo.MGK);
- goto end;
- }
- byte[] MGKData = SerialInit.HexToByte(keyInfo.MGK);
- Log.WriteInfoLog("Write MGK...");
- if (SerialCMD.SetMGKKey(TVPort, MGKData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeMGK);
- keycontent += "mgk=" + keyInfo.MGK + "&";
- Log.WriteInfoLog("Check MGK...");
- if (writeCheckNow.MGKCheckcheck ? SerialCMD.CheckMGKkey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkMGK);
- Log.WriteInfoLog("Read MGK...");
- if (readCheckNow.MGKReadcheck ? SerialCMD.GetMGKKey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.MGKReadcheck)
- {
- if (CommonMethod.CompareMD5(MGKData, data))
- {
- SetsuccessStatus(m_readMGK);
- }
- else
- {
- if (SerialInit.BytesCompare_Base64(data, MGKData))
- {
- SetsuccessStatus(m_readMGK);
- }
- else
- {
- SetfailStatus(m_readMGK);
- Log.WriteErrorLog(SN + " contrast MGK fail");
- MessageBox.Show(LResource.ContrastMGKError);
- goto end;
- }
- }
- }
- }
- else
- {
- SetfailStatus(m_readMGK);
- Log.WriteErrorLog(SN + " read MGK fail");
- MessageBox.Show(LResource.ReadMGKError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkMGK);
- Log.WriteErrorLog(SN + " check MGK fail");
- MessageBox.Show(LResource.CheckMGKError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeMGK);
- Log.WriteErrorLog(SN + " Write MGK fail");
- MessageBox.Show(LResource.WriteMGKError);
- goto end;
- }
- }
- //Fairplay KEY抄写
- if (WriteFairplay.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.Fairplay))
- {
- Log.WriteErrorLog("Fairplay format error!\r\n" + keyInfo.Fairplay);
- MessageBox.Show(LResource.FairplayFormatError + "\r\n" + keyInfo.Fairplay);
- goto end;
- }
- byte[] FairplayData = SerialInit.HexToByte(keyInfo.Fairplay);
- Log.WriteInfoLog("Write Fairplay...");
- if (SerialCMD.SetFireTVFairplay(TVPort, FairplayData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeFairplay);
- keycontent += "fairplay=" + keyInfo.Fairplay + "&";
- Log.WriteInfoLog("Check Fairplay...");
- if (writeCheckNow.FairplayCheckcheck ? SerialCMD.CheckFireTVFairplay(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkFairplay);
- Log.WriteInfoLog("Read Fairplay...");
- if (readCheckNow.FairplayReadcheck ? SerialCMD.ReadFireTVFairplay(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.FairplayReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, FairplayData))
- {
- SetsuccessStatus(m_readFairplay);
- }
- else
- {
- SetfailStatus(m_readFairplay);
- Log.WriteErrorLog(SN + " contrast Fairplay fail");
- MessageBox.Show(LResource.ContrastFairplayError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readFairplay);
- Log.WriteErrorLog(SN + " read Fairplay fail");
- MessageBox.Show(LResource.ReadFairplayError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkFairplay);
- Log.WriteErrorLog(SN + " check Fairplay fail");
- MessageBox.Show(LResource.CheckFairplayError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeFairplay);
- Log.WriteErrorLog(SN + " Write Fairplay fail");
- MessageBox.Show(LResource.WriteFairplayError);
- goto end;
- }
- }
- //ECP KEY抄写
- if (WriteECP.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.ECP))
- {
- Log.WriteErrorLog("ECP format error!\r\n" + keyInfo.ECP);
- MessageBox.Show(LResource.ECPFormatError + "\r\n" + keyInfo.ECP);
- goto end;
- }
- byte[] ECPData = SerialInit.HexToByte(keyInfo.ECP);
- Log.WriteInfoLog("Write ECP...");
- if (SerialCMD.SetECP(TVPort, ECPData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeECP);
- keycontent += "ecp=" + keyInfo.ECP + "&";
- Log.WriteInfoLog("Check ECP...");
- if (writeCheckNow.ECPCheckcheck ? SerialCMD.CheckECP(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkECP);
- Log.WriteInfoLog("Read ECP...");
- if (readCheckNow.ECPReadcheck ? SerialCMD.GetECP(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.ECPReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, ECPData))
- {
- SetsuccessStatus(m_readECP);
- }
- else
- {
- SetfailStatus(m_readECP);
- Log.WriteErrorLog(SN + " contrast ECP fail");
- MessageBox.Show(LResource.ContrastECPError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readECP);
- Log.WriteErrorLog(SN + " read ECP fail");
- MessageBox.Show(LResource.ReadECPError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkECP);
- Log.WriteErrorLog(SN + " check ECP fail");
- MessageBox.Show(LResource.CheckECPError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeECP);
- Log.WriteErrorLog(SN + " Write ECP fail");
- MessageBox.Show(LResource.WriteECPError);
- goto end;
- }
- }
- //LEK抄写
- if (WriteLEK.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.LEK))
- {
- Log.WriteErrorLog("LEK format error!\r\n" + keyInfo.LEK);
- MessageBox.Show(LResource.LEKFormatError + "\r\n" + keyInfo.LEK);
- goto end;
- }
- byte[] LEKData = SerialInit.HexToByte(keyInfo.LEK);
- Log.WriteInfoLog("Write LEK...");
- if (SerialCMD.SetFireTVLEK(TVPort, LEKData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeLEK);
- keycontent += "lek=" + keyInfo.LEK + "&";
- Log.WriteInfoLog("Check LEK...");
- if (writeCheckNow.LEKCheckcheck ? SerialCMD.CheckFireTVLEK(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkLEK);
- Log.WriteInfoLog("Read LEK...");
- if (readCheckNow.LEKReadcheck ? SerialCMD.ReadFireTVLEK(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.LEKReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, LEKData))
- {
- SetsuccessStatus(m_readLEK);
- }
- else
- {
- SetfailStatus(m_readLEK);
- Log.WriteErrorLog(SN + " contrast LEK fail");
- MessageBox.Show(LResource.ContrastLEKError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readLEK);
- Log.WriteErrorLog(SN + " read LEK fail");
- MessageBox.Show(LResource.ReadLEKError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkLEK);
- Log.WriteErrorLog(SN + " check LEK fail");
- MessageBox.Show(LResource.CheckLEKError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeLEK);
- Log.WriteErrorLog(SN + " Write LEK fail");
- MessageBox.Show(LResource.WriteLEKError);
- goto end;
- }
- }
- //Playready抄写
- if (WritePlayready.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.Playready))
- {
- Log.WriteErrorLog("Playready format error!\r\n" + keyInfo.Playready);
- MessageBox.Show(LResource.PlayreadyFormatError + "\r\n" + keyInfo.Playready);
- goto end;
- }
- byte[] PlayreadyData = SerialInit.HexToByte(keyInfo.Playready);
- Log.WriteInfoLog("Write Playready...");
- if (SerialCMD.SetFireTVPlayready(TVPort, PlayreadyData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writePlayready);
- keycontent += "playready=" + keyInfo.Playready + "&";
- Log.WriteInfoLog("Check Playready...");
- if (writeCheckNow.PlayreadyCheckcheck ? SerialCMD.CheckFireTVPlayready(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkPlayready);
- Log.WriteInfoLog("Read Playready...");
- if (readCheckNow.PlayreadyReadcheck ? SerialCMD.ReadFireTVPlayready(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.PlayreadyReadcheck)
- {
- if (CommonMethod.CompareMD5(PlayreadyData, data))
- {
- SetsuccessStatus(m_readPlayready);
- }
- else
- {
- if (SerialInit.BytesCompare_Base64(data, PlayreadyData))
- {
- SetsuccessStatus(m_readPlayready);
- }
- else
- {
- SetfailStatus(m_readPlayready);
- Log.WriteErrorLog(SN + " contrast Playready fail");
- MessageBox.Show(LResource.ContrastPlayreadyError);
- goto end;
- }
- }
- }
- }
- else
- {
- SetfailStatus(m_readPlayready);
- Log.WriteErrorLog(SN + " read Playready fail");
- MessageBox.Show(LResource.ReadPlayreadyError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkPlayready);
- Log.WriteErrorLog(SN + " check Playready fail");
- MessageBox.Show(LResource.CheckPlayreadyError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writePlayready);
- Log.WriteErrorLog(SN + " Write Playready fail");
- MessageBox.Show(LResource.WritePlayreadyError);
- goto end;
- }
- }
- //Hash抄写
- if (WriteHash.Checked)
- {
- if (!CommonMethod.IsNumberAndWord(keyInfo.Hashkey))
- {
- Log.WriteErrorLog("Hash format error!\r\n" + keyInfo.Hashkey);
- MessageBox.Show(LResource.HashFormatError + "\r\n" + keyInfo.Hashkey);
- goto end;
- }
- byte[] HashData = SerialInit.HexToByte(keyInfo.Hashkey);
- Log.WriteInfoLog("Write Hash...");
- if (SerialCMD.SetFireTVHashkey(TVPort, HashData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeHash);
- keycontent += "hash=" + keyInfo.Hashkey + "&";
- Log.WriteInfoLog("Check Hash...");
- if (writeCheckNow.HashCheckcheck ? SerialCMD.CheckFireTVHashkey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkHash);
- Log.WriteInfoLog("Read Hash...");
- if (readCheckNow.HashReadcheck ? SerialCMD.ReadFireTVHashkey(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.HashReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, HashData))
- {
- SetsuccessStatus(m_readHash);
- }
- else
- {
- SetfailStatus(m_readHash);
- Log.WriteErrorLog(SN + " contrast Hash fail");
- MessageBox.Show(LResource.ContrastHashError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readHash);
- Log.WriteErrorLog(SN + " read Hash fail");
- MessageBox.Show(LResource.ReadHashError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkHash);
- Log.WriteErrorLog(SN + " check Hash fail");
- MessageBox.Show(LResource.CheckHashError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeHash);
- Log.WriteErrorLog(SN + " Write Hash fail");
- MessageBox.Show(LResource.WriteHashError);
- goto end;
- }
- }
- //频道预置
- if (FunctionSettingNow.WriteChannel)
- {
- Log.WriteInfoLog("setting channel...");
- if (SerialCMD.SetChannel(TVPort, FunctionSettingNow.ChannelCode, out result, out data, out error, SerailDelay))
- {
- /*
- Log.WriteInfoLog("getting channel...");
- if (SerialCMD.GetChannel(TVPort, out result, out data, out error))
- {
- if(SerialInit.BytesCompare_Base64(data, FunctionSettingNow.ChannelCode))
- {
- }
- else
- {
- Log.WriteErrorLog(SN + " get different channel");
- goto end;
- }
- }
- else
- {
- Log.WriteErrorLog(SN + " fail to get channel");
- goto end;
- }*/
- Log.WriteInfoLog(SN + " set channel success");
- SetcolorStatus(ChannelText, Color.FromArgb(128, 255, 128));
- }
- else
- {
- Log.WriteErrorLog(SN + " fail to set channel");
- MessageBox.Show(LResource.SetChannelError);
- goto end;
- }
- }
- //OSD语言设置
- if (FunctionSettingNow.WriteOSD)
- {
- Log.WriteInfoLog("setting OSD language...");
- if (SerialCMD.SetOSDLanguage(TVPort, FunctionSettingNow.OSDLCode, out result, out data, out error, SerailDelay))
- {
- if (readCheckNow.OSDReadcheck)
- {
- Log.WriteInfoLog("getting OSD language...");
- if (SerialCMD.GetOSDLanguage(TVPort, out result, out data, out error, SerailDelay))
- {
- if (SerialInit.BytesCompare_Base64(data, FunctionSettingNow.OSDLCode))
- {
- SetcolorStatus(OSDText, Color.FromArgb(128, 255, 128));
- }
- else
- {
- Log.WriteErrorLog(SN + " get different OSD language");
- MessageBox.Show(LResource.ContrastOSDLError);
- goto end;
- }
- }
- else
- {
- Log.WriteErrorLog(SN + " fail to get OSD language");
- MessageBox.Show(LResource.GetOSDLError);
- goto end;
- }
- }
- else
- Log.WriteInfoLog("skip read OSD language...");
- }
- else
- {
- Log.WriteErrorLog(SN + " fail to set OSD language");
- MessageBox.Show(LResource.SetOSDLError);
- goto end;
- }
- }
- //Shop语言设置
- if (FunctionSettingNow.WriteSHOP)
- {
- Log.WriteInfoLog("setting SHOP language...");
- if (SerialCMD.SetShopLanguage(TVPort, FunctionSettingNow.ShopLCode, out result, out data, out error, SerailDelay))
- {
- if (readCheckNow.SHOPReadcheck)
- {
- Log.WriteInfoLog("getting SHOP language...");
- if (SerialCMD.GetShopLanguage(TVPort, out result, out data, out error, SerailDelay))
- {
- if (SerialInit.BytesCompare_Base64(data, FunctionSettingNow.ShopLCode))
- {
- SetcolorStatus(SHOPText, Color.FromArgb(128, 255, 128));
- }
- else
- {
- Log.WriteErrorLog(SN + " get different SHOP language");
- MessageBox.Show(LResource.ContrastSHOPLError);
- goto end;
- }
- }
- else
- {
- Log.WriteErrorLog(SN + " fail to get SHOP language");
- MessageBox.Show(LResource.GetSHOPLError);
- goto end;
- }
- }
- else
- Log.WriteInfoLog("skip read SHOP language...");
- }
- else
- {
- Log.WriteErrorLog(SN + " fail to set SHOP language");
- MessageBox.Show(LResource.SetSHOPLError);
- goto end;
- }
- }
- // EDID Pid抄写;
- if (WriteEDIDPID.Checked)
- {
- // 4字节转成整数:0~65535,0x0000~0xffff;
- if (Regex.IsMatch(keyInfo.EDIDPid, "^[A-Za-z0-9]{4}$"))
- {
- byte[] EDIDPidData = SerialInit.strToToHexByte(keyInfo.EDIDPid);
- Log.WriteInfoLog("Write EDID Pid...");
- if (SerialCMD.SetEDIDPid(TVPort, EDIDPidData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeEDIDPID);
- keycontent += "EDIDPid=" + keyInfo.EDIDPid + "&";
- Log.WriteInfoLog("Read EDID Pid...");
- if (readCheckNow.EDIDPIDReadcheck ? SerialCMD.ReadEDIDPid(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.EDIDPIDReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, EDIDPidData))
- {
- SetsuccessStatus(m_readEDIDPID);
- }
- else
- {
- SetfailStatus(m_readEDIDPID);
- Log.WriteErrorLog(SN + " contrast EDID PID fail");
- MessageBox.Show(LResource.ContrastEDIDPIDError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readEDIDPID);
- Log.WriteErrorLog(SN + " read EDID PID fail");
- MessageBox.Show(LResource.ReadEDIDPIDError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeEDIDPID);
- Log.WriteErrorLog(SN + " Write EDID PID fail");
- MessageBox.Show(LResource.WriteEDIDPidError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeEDIDPID);
- Log.WriteErrorLog(SN + " The EDID PID Format Error!");
- MessageBox.Show(LResource.EDIDPIDFormatError);
- goto end;
- }
- }
- // EDID Mode Name抄写;
- if (WriteEDIDName.Checked)
- {
- if (Regex.IsMatch(keyInfo.EDIDModelName, @"^[A-Za-z0-9][A-Za-z0-9_ -]{0,12}$"))
- {
- // 长度为13字节;
- byte[] EDIDNameData = Encoding.ASCII.GetBytes(keyInfo.EDIDModelName);
- Log.WriteInfoLog("Write EDID Mode Name...");
- if (SerialCMD.SetEDIDModelName(TVPort, EDIDNameData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeEDIDName);
- keycontent += "EDIDModeName=" + keyInfo.EDIDModelName + "&";
- Log.WriteInfoLog("Read EDID Mode Name...");
- if (readCheckNow.EDIDModeNameReadcheck ? SerialCMD.ReadEDIDModelName(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.EDIDModeNameReadcheck)
- {
- if (SerialInit.BytesCompare_Base64(data, EDIDNameData))
- {
- SetsuccessStatus(m_readEDIDName);
- }
- else
- {
- SetfailStatus(m_readEDIDName);
- Log.WriteErrorLog(SN + " contrast EDID Mode Name fail");
- MessageBox.Show(LResource.ContrastEDIDModelNameError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readEDIDName);
- Log.WriteErrorLog(SN + " read EDID Mode Name fail");
- MessageBox.Show(LResource.ReadEDIDModelNameError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeEDIDName);
- Log.WriteErrorLog(SN + " Write EDID Mode Name fail");
- MessageBox.Show(LResource.WriteEDIDModelNameError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeEDIDName);
- Log.WriteErrorLog(SN + " The EDID Model Name Format Error!");
- MessageBox.Show(LResource.EDIDModelNameFormatError);
- goto end;
- }
- }
- // ACAS Key抄写;
- if (WriteACASKey.Checked)
- {
- // 1.acas key抄写前,必须先抄写playreadkey;
- // 2.将tool先抄写再抄写data;
- Log.WriteInfoLog("Write ACAC Key...");
- byte[] ACASKeyTool = SerialInit.HexToByte(keyInfo.ACASKey_Tool);
- if (SerialCMD.SetACASKeyTool(TVPort, ACASKeyTool, out result, out data, out error, SerailDelay))
- {
- //SetsuccessStatus(m_writeACASKey);
- keycontent += "acas_tool=" + keyInfo.ACASKey_Tool+ "&";
- Log.WriteInfoLog("Check ACAS Key Tool...");
- if (writeCheckNow.ACASKeyCheckcheck ? SerialCMD.CheckACASKeyTool(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- //SetsuccessStatus(m_checkACASKey);
- Log.WriteInfoLog("Read ACAS Key Tool...");
- if (readCheckNow.ACASKeyReadcheck ? SerialCMD.ReadACASKeyTool(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.ACASKeyReadcheck)
- {
- if (CommonMethod.CompareMD5(ACASKeyTool, data))
- {
- //SetsuccessStatus(m_readACASKey);
- }
- else
- {
- SetfailStatus(m_readACASKey);
- Log.WriteErrorLog(SN + " contrast ACAS Key Tool fail");
- MessageBox.Show(LResource.ContrastACASKeyError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readACASKey);
- Log.WriteErrorLog(SN + " read ACAS Key Tool fail");
- MessageBox.Show(LResource.ReadACASKeyError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkACASKey);
- Log.WriteErrorLog(SN + " Check ACAS Key Tool fail");
- MessageBox.Show(LResource.WriteACASKeyError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeACASKey);
- Log.WriteErrorLog(SN + " Write ACAS Key Tool fail");
- MessageBox.Show(LResource.WriteACASKeyError);
- goto end;
- }
- byte[] ACASKeyData = SerialInit.HexToByte(keyInfo.ACASKey_Data);
- if (SerialCMD.SetACASKeyData(TVPort, ACASKeyData, out result, out data, out error, SerailDelay))
- {
- SetsuccessStatus(m_writeACASKey);
- keycontent += "acas_data=" + keyInfo.ACASKey_Data + "&";
- Log.WriteInfoLog("Check ACAS Key Data...");
- if (writeCheckNow.ACASKeyCheckcheck ? SerialCMD.CheckACASKeyData(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- SetsuccessStatus(m_checkACASKey);
- Log.WriteInfoLog("Read ACAS Key Data...");
- if (readCheckNow.ACASKeyReadcheck ? SerialCMD.ReadACASKeyData(TVPort, out result, out data, out error, SerailDelay) : true)
- {
- if (readCheckNow.ACASKeyReadcheck)
- {
- if (CommonMethod.CompareMD5(ACASKeyData, data))
- {
- SetsuccessStatus(m_readACASKey);
- }
- else
- {
- SetfailStatus(m_readACASKey);
- Log.WriteErrorLog(SN + " contrast ACAS Key Data fail");
- MessageBox.Show(LResource.ContrastACASKeyError);
- goto end;
- }
- }
- }
- else
- {
- SetfailStatus(m_readACASKey);
- Log.WriteErrorLog(SN + " read ACAS Key fail");
- MessageBox.Show(LResource.ReadACASKeyError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_checkACASKey);
- Log.WriteErrorLog(SN + " Check ACAS Key Data fail");
- MessageBox.Show(LResource.WriteACASKeyError);
- goto end;
- }
- }
- else
- {
- SetfailStatus(m_writeACASKey);
- Log.WriteErrorLog(SN + " Write ACAS Key Data fail");
- MessageBox.Show(LResource.WriteACASKeyError);
- goto end;
- }
- }
- //Project ID 抄写检查
- if (ProjectIDNote.Text != LResource.SkipCovering)
- {
- Log.WriteInfoLog("Write projectID...");
- keycontent += "projectid=" + ProjectIDText.Text + "&";
- if (ProjectIDNote.Text == LResource.Covering || ProjectIDNote.Text == LResource.SkipReadCheck)
- {
- SetspecificText(ProjectIDNote, ProjectIDNote.Text, Color.FromArgb(128, 255, 128));
- byte[] param = CommonMethod.InttoBytelist(Convert.ToInt32(ProjectIDText.Text));
- Log.WriteInfoLog("Set projectID...");
- if (SerialCMD.SetProjectId(TVPort, param, out result, out data, out error, SerailDelay))
- {
- if (ProjectIDNote.Text != LResource.SkipReadCheck)
- {
- Log.WriteInfoLog("Check projectID...");
- if (writeDoneNow.PIDWriteDelay > 0)
- {
- Thread.Sleep(writeDoneNow.PIDWriteDelay);//MS6586切完PID需要强制等待3s
- }
- if (SerialCMD.GetProjectID(TVPort, out result, out data, out error, SerailDelay))
- {
- int readpid2 = CommonMethod.BytelisttoInt(data);
- if (readpid2.ToString() != ProjectIDText.Text)
- {
- SetcolorStatus(ProjectIDText, Color.Red);
- Log.WriteErrorLog(SN + " read project id:" + readpid2.ToString() + "different from written: " + ProjectIDText.Text + " error");
- MessageBox.Show(LResource.ContrastPIDError);
- goto end;
- }
- else
- {
- SetcolorStatus(ProjectIDText, Color.Green);
- }
- }
- else
- {
- SetcolorStatus(ProjectIDText, Color.Red);
- Log.WriteErrorLog(SN + " get project id error");
- MessageBox.Show(LResource.GetPIDError);
- goto end;
- }
- }
- else
- {
- Log.WriteInfoLog("Skip check projectID...");
- }
- }
- else
- {
- SetcolorStatus(ProjectIDText, Color.Red);
- Log.WriteErrorLog(SN + " set project id error");
- MessageBox.Show(LResource.SetPIDError);
- goto end;
- }
- }
- else
- {
- if (SerialCMD.GetProjectID(TVPort, out result, out data, out error, SerailDelay))
- {
- int readpid = CommonMethod.BytelisttoInt(data);
- if (readpid.ToString() != ProjectIDText.Text)
- {
- MessageBoxButtons messButton = MessageBoxButtons.YesNoCancel;
- DialogResult dr = MessageBox.Show(LResource.MainboardPID + readpid.ToString() + LResource.DifferentFromSetting + "\r\n" + LResource.CoveringPID, LResource.Error, messButton);
- if (dr == DialogResult.Yes)
- {
- SetspecificText(ProjectIDNote, LResource.Covering, Color.FromArgb(128, 255, 128));
- byte[] param = CommonMethod.InttoBytelist(Convert.ToInt32(ProjectIDText.Text));
- if (SerialCMD.SetProjectId(TVPort, param, out result, out data, out error, SerailDelay))
- {
- if (writeDoneNow.PIDWriteDelay > 0)
- {
- Thread.Sleep(writeDoneNow.PIDWriteDelay);//MS6586切完PID需要强制等待3s
- }
- Log.WriteInfoLog("Check projectID...");
- if (SerialCMD.GetProjectID(TVPort, out result, out data, out error, SerailDelay))
- {
- int readpid2 = CommonMethod.BytelisttoInt(data);
- if (readpid2.ToString() != ProjectIDText.Text)
- {
- SetcolorStatus(ProjectIDText, Color.Red);
- Log.WriteErrorLog(SN + " read project id:" + readpid2.ToString() + "different from written: " + ProjectIDText.Text + " error");
- MessageBox.Show(LResource.ContrastPIDError);
- goto end;
- }
- else
- {
- SetcolorStatus(ProjectIDText, Color.Green);
- }
- }
- else
- {
- SetcolorStatus(ProjectIDText, Color.Red);
- Log.WriteErrorLog(SN + " get project id error");
- MessageBox.Show(LResource.GetPIDError);
- goto end;
- }
- }
- else
- {
- SetcolorStatus(ProjectIDText, Color.Red);
- Log.WriteErrorLog(SN + " set project id error");
- MessageBox.Show(LResource.SetPIDError);
- goto end;
- }
- }
- else if (dr == DialogResult.No)
- {
- SetspecificText(ProjectIDNote, LResource.SkipCovering, Color.Yellow);
- SetcolorStatus(ProjectIDText, Color.Yellow);
- }
- else
- {
- SetspecificText(ProjectIDNote, readpid.ToString(), Color.Red);
- SetcolorStatus(ProjectIDText, Color.Red);
- goto end;
- }
- }
- else
- {
- SetcolorStatus(ProjectIDText, Color.FromArgb(128, 255, 128));
- }
- }
- else
- {
- Log.WriteErrorLog(SN + " Read ProjectID fail");
- MessageBox.Show(LResource.GetPIDError);
- goto end;
- }
- }
- }
- //检查ClientType
- if (ClientTypeNote.Text != LResource.SkipChecking)
- {
- Log.WriteInfoLog("Read ClientType...");
- if (SerialCMD.GetClientType(TVPort, out result, out data, out error, SerailDelay))
- {
- string ctype = Encoding.ASCII.GetString(data);
- if (ctype != ClientTypeText.Text)
- {
- MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
- DialogResult dr = MessageBox.Show(LResource.MainboardCType + ctype + LResource.differentfromserver + ClientTypeText.Text + "\r\n" + LResource.SkipCTypeChecking, LResource.Error, messButton);
- if (dr == DialogResult.OK)
- {
- SetspecificText(ClientTypeNote, LResource.SkipChecking, Color.Yellow);
- SetcolorStatus(ClientTypeText, Color.Yellow);
- }
- else
- {
- SetspecificText(ClientTypeNote, ctype, Color.Red);
- SetcolorStatus(ClientTypeText, Color.Red);
- goto end;
- }
- }
- else
- {
- SetcolorStatus(ClientTypeText, Color.FromArgb(128, 255, 128));
- }
- }
- else
- {
- Log.WriteErrorLog(SN + " Read ClientType fail");
- MessageBox.Show(LResource.ReadCTypeError);
- goto end;
- }
- }
- //白平衡初始化
- if (FunctionSettingNow.WBInit)
- {
- Log.WriteInfoLog("WhiteBalance init...");
- if (SerialCMD.WBInit(TVPort, out result, out data, out error, SerailDelay))
- {
- }
- else
- {
- Log.WriteErrorLog(SN + " WhiteBalance ini fail");
- MessageBox.Show(LResource.WBInitError);
- goto end;
- }
- }
- //白平衡赋值
- if (FunctionSettingNow.WriteWB)
- {
- Log.WriteInfoLog("Set normal RGB...");
- if (SerialCMD.SetWBNormal(TVPort, FunctionSettingNow.NormalRGB, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Set cool RGB...");
- if (SerialCMD.SetWBCool(TVPort, FunctionSettingNow.CoolRGB, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Set warm RGB...");
- if (SerialCMD.SetWBWarm(TVPort, FunctionSettingNow.WarmRGB, out result, out data, out error, SerailDelay))
- {
- SetcolorStatus(WBPathText, Color.FromArgb(128, 255, 128));
- }
- else
- {
- Log.WriteErrorLog(SN + " Set warm RGB fail");
- MessageBox.Show(LResource.SetWarmError);
- goto end;
- }
- 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() + "&";
- }
- else
- {
- Log.WriteErrorLog(SN + " Set cool RGB fail");
- MessageBox.Show(LResource.SetCoolError);
- goto end;
- }
- }
- else
- {
- Log.WriteErrorLog(SN + " Set normal RGB fail");
- MessageBox.Show(LResource.SetNormalError);
- goto end;
- }
- }
- //Roku客户服务信息抄写
- if (midListNow.rokuCustomer != null)
- {
- string brand = midListNow.rokuCustomer.brand;
- Log.WriteInfoLog("Write Roku brand...");
- if (SerialCMD.SetROKUBrand(TVPort, Encoding.ASCII.GetBytes(brand), out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Check Roku brand...");
- if (SerialCMD.CheckROKUBrand(TVPort, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Read Roku brand...");
- if (SerialCMD.GetROKUBrand(TVPort, out result, out data, out error, SerailDelay))
- {
- if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(brand)))
- {
- Log.WriteInfoLog("ROKU brand 写入成功:" + Encoding.ASCII.GetString(data));
- }
- else
- {
- MessageBox.Show(LResource.CompareRokuBrandFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.ReadRokuBrandFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.CheckRokuBrandFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.WriteRokuBrandFail);
- goto end;
- }
- string model = midListNow.rokuCustomer.oemmodel;
- Log.WriteInfoLog("Write Roku model...");
- if (SerialCMD.SetModelName(TVPort, Encoding.ASCII.GetBytes(model), out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Check Roku model...");
- if (SerialCMD.CheckModelName(TVPort, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Read Roku model...");
- if (SerialCMD.GetModelName(TVPort, out result, out data, out error, SerailDelay))
- {
- if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(model)))
- {
- Log.WriteInfoLog("ROKU model 写入成功:" + Encoding.ASCII.GetString(data));
- }
- else
- {
- MessageBox.Show(LResource.CompareRokuModelFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.ReadRokuModelFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.CheckRokuModelFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.WriteRokuModelFail);
- goto end;
- }
- string[] dateInit = midListNow.rokuCustomer.productiondate.Split('-');
- byte[] productdate = new byte[3] { Convert.ToByte(dateInit[0]), Convert.ToByte(dateInit[1]), Convert.ToByte(dateInit[2]) };
- Log.WriteInfoLog("Write Roku production date...");
- if (SerialCMD.SetROKUProductionDate(TVPort, productdate, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Check Roku production date...");
- if (SerialCMD.CheckROKUProductionDate(TVPort, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Read Roku production date...");
- if (SerialCMD.GetROKUProductionDate(TVPort, out result, out data, out error, SerailDelay))
- {
- string date = "20" + productdate[0].ToString() + "." + productdate[1].ToString() + ".WW" + productdate[2].ToString();
- if (Encoding.ASCII.GetString(data) == date)
- {
- Log.WriteInfoLog("ROKU production date 写入成功:" + Encoding.ASCII.GetString(data));
- }
- else
- {
- MessageBox.Show(LResource.CompareRokuDateFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.ReadRokuDateFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.CheckRokuDateFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.WriteRokuDateFail);
- goto end;
- }
- string region = midListNow.rokuCustomer.region;
- Log.WriteInfoLog("Write Roku region...");
- if (SerialCMD.SetROKURegion(TVPort, Encoding.ASCII.GetBytes(region), out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Check Roku region...");
- if (SerialCMD.CheckROKURegion(TVPort, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Read Roku region...");
- if (SerialCMD.GetROKURegion(TVPort, out result, out data, out error, SerailDelay))
- {
- if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(region)))
- {
- Log.WriteInfoLog("ROKU region 写入成功:" + Encoding.ASCII.GetString(data));
- }
- else
- {
- MessageBox.Show(LResource.CompareRokuRegionFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.ReadRokuRegionFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.CheckRokuRegionFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.WriteRokuRegionFail);
- goto end;
- }
- string phone = midListNow.rokuCustomer.supportphone;
- Log.WriteInfoLog("Write Roku phone...");
- if (SerialCMD.SetROKUSupportPhone(TVPort, Encoding.ASCII.GetBytes(phone), out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Check Roku phone...");
- if (SerialCMD.CheckROKUSupportPhone(TVPort, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Read Roku phone...");
- if (SerialCMD.GetROKUSupportPhone(TVPort, out result, out data, out error, SerailDelay))
- {
- if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(phone)))
- {
- Log.WriteInfoLog("ROKU phone 写入成功:" + Encoding.ASCII.GetString(data));
- }
- else
- {
- MessageBox.Show(LResource.CompareRokuPhoneFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.ReadRokuPhoneFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.CheckRokuPhoneFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.WriteRokuPhoneFail);
- goto end;
- }
- string url = midListNow.rokuCustomer.supporturl;
- Log.WriteInfoLog("Write Roku url...");
- if (SerialCMD.SetROKUSupportURL(TVPort, Encoding.ASCII.GetBytes(url), out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Check Roku url...");
- if (SerialCMD.CheckROKUSupportURL(TVPort, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Read Roku url...");
- if (SerialCMD.GetROKUSupportURL(TVPort, out result, out data, out error, SerailDelay))
- {
- if (SerialInit.BytesCompare_Base64(data, Encoding.ASCII.GetBytes(url)))
- {
- Log.WriteInfoLog("ROKU url 写入成功:" + Encoding.ASCII.GetString(data));
- }
- else
- {
- MessageBox.Show(LResource.CompareRokuUrlFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.ReadRokuUrlFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.CheckRokuUrlFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.WriteRokuUrlFail);
- goto end;
- }
- if (midListNow.rokuCustomer.remotetype.Length > 0 && midListNow.rokuCustomer.remotetype != "null")
- {
- byte[] remotetype = new byte[1] { Convert.ToByte(midListNow.rokuCustomer.remotetype) };
- Log.WriteInfoLog("Write Roku remotetype...");
- if (SerialCMD.SetROKURemoteType(TVPort, remotetype, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Check Roku remotetype...");
- if (SerialCMD.CheckROKURemoteType(TVPort, out result, out data, out error, SerailDelay))
- {
- Log.WriteInfoLog("Read Roku remotetype...");
- if (SerialCMD.GetROKURemoteType(TVPort, out result, out data, out error, SerailDelay))
- {
- if (SerialInit.BytesCompare_Base64(data, remotetype))
- {
- Log.WriteInfoLog("ROKU remotetype 写入成功:" + Encoding.ASCII.GetString(data));
- }
- else
- {
- MessageBox.Show(LResource.CompareRokuRemoteTypeFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.ReadRokuRemoteTypeFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.CheckRokuRemoteTypeFail);
- goto end;
- }
- }
- else
- {
- MessageBox.Show(LResource.WriteRokuRemoteTypeFail);
- goto end;
- }
- }
- SetcolorStatus(ProductMsg_Text, Color.FromArgb(128, 255, 128));
- }
- keycontent += "toolVersion=" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "&";
- //自定义指令发送
- if (FunctionSettingNow.CustomCMD != null)
- {
- if (FunctionSettingNow.CustomCMD.Count > 0)
- {
- foreach (string cmd in FunctionSettingNow.CustomCMD.Values)
- {
- byte[] Cmddata = SerialInit.HexToByte(cmd);
- TVPort.Write(Cmddata, 0, Cmddata.Count());
- Thread.Sleep(500);
- }
- }
- }
- #region 波兰工厂临时功能-抄写所有Key后执行Trigger和Check指令;
- Log.WriteInfoLog("Start to Trigger DHA...");
- if ( SerialCMD.TriggerDHA(TVPort, out result, out data, out error, SerailDelay) )
- {
- Thread.Sleep(FunctionSettingNow.CheckDHAWaitTime);
- Log.WriteInfoLog("Start to Check DHA...");
- if ( !SerialCMD.CheckDHA(TVPort, out result, out data, out error, SerailDelay) )
- {
- MessageBox.Show("Check DHA Fail!");
- goto end;
- }
- }
- else
- {
- MessageBox.Show("Trigger DHA Fail!");
- goto end;
- }
- #endregion
- //数据上传
- if (midListNow.host == "LocalPC" && !preloadNow)
- {
- if (GetLocalKeyCount.DeleteLocalKeys(keypath, keyStream, keyReader))
- {
- TestResult = true;
- UploadCopyCount();
- LocalTxtRecord.LocalRecord(keycontent + "sversionid=" + localmidList.version + "&clienttype=" + localmidList.clienttype + "&ordernum=" + orderNow + "\r\n", orderNow);
- }
- else
- {
- MessageBox.Show("Fail to delete local keys!");
- goto end;
- }
- }
- else if (preloadNow)
- {
- //更新DB抄写状态
- if (SQLiteHelper.UpdateCopyStatus(localDBNow, SN, out string copydate))
- {
- UploadCopyCount();
- TestResult = true;
- }
- else
- {
- Log.WriteErrorLog(SN + " update copy record fail");
- goto end;
- }
- //上传抄写状态
- if (midListNow.host != "LocalPC")
- CommonMethod.UploadPreloadCopyResult(MidAddressNow.host, copydate, SN, localDBNow, errorDBNow, false, "", FunctionSettingNow.ReportTimeOut);
- }
- else if (!CommonMethod.HTTPChecker(midListNow.host))
- {
- Log.WriteGetKeyLog("Order:" + orderNow + " host is null,scanning sn:" + SN);
- TestResult = true;
- UploadCopyCount();
- UpdateKeys(midListNow.keytype, false);
- }
- else
- {
- if (WriteDID.Checked)
- {
- if (CommonMethod.UploadCopyResult(keycontent + "sversionid=" + midListNow.version + "&clienttype=" + midListNow.clienttype + "&ordernum=" + orderNow, midListNow.host + "/report.do?", errorDBNow, orderNow, false, "", FunctionSettingNow.ReportTimeOut))
- TestResult = true;
- else
- {
- TestResult = false;
- UploadCopyCount();
- UpdateKeys(midListNow.keytype, false);
- goto end;
- }
- }
- else
- {
- if (SN.Trim().Length > 0)
- {
- keycontent += "nodid=true&";
- if (CommonMethod.UploadCopyResult(keycontent + "sversionid=" + midListNow.version + "&clienttype=" + midListNow.clienttype + "&ordernum=" + orderNow, midListNow.host + "/report.do?", errorDBNow, orderNow, false, "", FunctionSettingNow.ReportTimeOut))
- TestResult = true;
- else
- {
- TestResult = false;
- UploadCopyCount();
- UpdateKeys(midListNow.keytype, false);
- goto end;
- }
- }
- else
- {
- LocalTxtRecord.LocalRecord(midListNow.host + "/report.do?\r\n" + keycontent + "sversionid=" + midListNow.version + "&clienttype=" + midListNow.clienttype + "&ordernum=" + orderNow + "\r\n\r\n", orderNow);
- if (FunctionSettingNow.AllowNoScanning)
- {
- TestResult = true;
- }
- else
- {
- MessageBox.Show("You must scan to start the burning!");
- TestResult = false;
- }
- }
- }
- UploadCopyCount();
- UpdateKeys(midListNow.keytype, false);
- }
- if (FunctionSettingNow.ExportSNACASID)
- {
- SerialCMD.ReadJapaneseACASID(TVPort, out result, out data, out error, SerailDelay);
- CommonMethod.ExportSNACASID(orderNow, SN, Encoding.ASCII.GetString(data));
- }
- SetsuccessStatus(ResultStatus);
- Thread.Sleep(FunctionSettingNow.Wait_after_completion);
- end:
- if (!TestResult)
- {
- SetfailStatus(ResultStatus);
- if (midListNow.host == "LocalPC" && !preloadNow)
- {
- GetLocalKeyCount.UnlockLocalKeys(keypath, keyStream, keyReader);
- }
- // 是否启用G客户防呆措施;
- if (FunctionSettingNow.UsingGFoolProofing)
- {
- StringBuilder strValue = new StringBuilder(256);
- // 获取上一次的SN号;
- CommonMethod.GetProfileString("MOKAFactoryTools", "LastGSN", "", strValue, 256);
- if (strValue.ToString().Equals(SN, StringComparison.OrdinalIgnoreCase))
- {
- int lastCount = 0;
- CommonMethod.GetProfileString("MOKAFactoryTools", "GFailCount", "0", strValue, 256);
- int.TryParse(strValue.ToString(), out lastCount);
- CommonMethod.WriteProfileString("MOKAFactoryTools", "GFailCount", (++lastCount).ToString());
- }
- }
- }
- if (midListNow.host == "LocalPC" && !preloadNow)
- {
- GetLocalKeysCount();
- }
- timer1.Stop();
- usingTime = 0;
- EnableText(SNText);
- EnableButton(BtnClickstart);
- SN = "";
- #region 波兰工厂临时解决方案;
- PSN = "";
- #endregion
- }
- /// <summary>
- /// 显示白平衡配置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void OnBtnWBView(object sender, EventArgs e)
- {
- SNText.Focus();
- if (FunctionSettingNow.WriteWB)
- {
- 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]);
- }
- else
- {
- MessageBox.Show(LResource.WBNoSet);
- }
- }
- /// <summary>
- /// 更新key的状态
- /// </summary>
- /// <param name="keys">GetMIDInfo的keytype字典</param>
- /// <returns></returns>
- public bool UpdateKeys(Dictionary<string, string> keys, bool autokey)
- {
- GetOrderRemainKeyCount(orderNow);
- if (keys.ContainsKey("DeviceID"))
- {
- if (writeDoneNow.DIDWrite_YesNo)
- SetCheckboxStatus(WriteDID, true);
- UpdateKeyCount("DeviceID", midListNow.clienttype, autokey);
- }
- if (keys.ContainsKey("MAC"))
- {
- if (writeDoneNow.MacWrite_YesNo)
- SetCheckboxStatus(WriteMac, true);
- UpdateKeyCount("MAC", keys["MAC"], autokey);
- }
- if (keys.ContainsKey("HDCP_KEY"))
- {
- if (writeDoneNow.HDCPWrite_YesNo)
- SetCheckboxStatus(WriteHDCP, true);
- UpdateKeyCount("HDCP_KEY", keys["HDCP_KEY"], autokey);
- }
- if (keys.ContainsKey("CI_PLUS_KEY"))
- {
- if (writeDoneNow.CI_plusWrite_YesNo)
- SetCheckboxStatus(WriteCiplus, true);
- UpdateKeyCount("CI_PLUS_KEY", keys["CI_PLUS_KEY"], autokey);
- }
- if (keys.ContainsKey("WiDi"))
- {
- if (writeDoneNow.WiDiWrite_YesNo)
- SetCheckboxStatus(WriteWiDi, true);
- UpdateKeyCount("WiDi", keys["WiDi"], autokey);
- }
- if (keys.ContainsKey("Widevine_KEY"))
- {
- if (writeDoneNow.WidevineWrite_YesNo)
- SetCheckboxStatus(WriteWidevine, true);
- UpdateKeyCount("Widevine_KEY", keys["Widevine_KEY"], autokey);
- }
- if (keys.ContainsKey("HDCP2.2_KEY"))
- {
- if (writeDoneNow.HDCP22Write_YesNo)
- SetCheckboxStatus(WriteHDCP22, true);
- UpdateKeyCount("HDCP2.2_KEY", keys["HDCP2.2_KEY"], autokey);
- }
- if (keys.ContainsKey("NETFILX_ESN"))
- {
- if (writeDoneNow.ESNWrite_YesNo)
- SetCheckboxStatus(WriteESN, true);
- UpdateKeyCount("NETFILX_ESN", keys["NETFILX_ESN"], autokey);
- }
- if (keys.ContainsKey("Attestation_key"))
- {
- if (writeDoneNow.AttestationWrite_YesNo)
- SetCheckboxStatus(WriteAttestation, true);
- UpdateKeyCount("Attestation_key", keys["Attestation_key"], autokey);
- }
- if (keys.ContainsKey("MGK_KEY"))
- {
- if (writeDoneNow.MGKWrite_YesNo)
- SetCheckboxStatus(WriteMGK, true);
- UpdateKeyCount("MGK_KEY", keys["MGK_KEY"], autokey);
- }
- if (keys.ContainsKey("Fairplay_KEY"))
- {
- if (writeDoneNow.FairplayWrite_YesNo)
- SetCheckboxStatus(WriteFairplay, true);
- UpdateKeyCount("Fairplay_KEY", keys["Fairplay_KEY"], autokey);
- }
- if (keys.ContainsKey("ECP_KEY"))
- {
- if (writeDoneNow.ECPWrite_YesNo)
- SetCheckboxStatus(WriteECP, true);
- UpdateKeyCount("ECP_KEY", keys["ECP_KEY"], autokey);
- }
- if (keys.ContainsKey("WiFi_MAC"))
- {
- if (writeDoneNow.WifiMacWrite_YesNo)
- SetCheckboxStatus(WriteWifiMac, true);
- UpdateKeyCount("WiFi_MAC", keys["WiFi_MAC"], autokey);
- }
- if (keys.ContainsKey("BT_MAC"))
- {
- if (writeDoneNow.BTMacWrite_YesNo)
- SetCheckboxStatus(WriteBTMac, true);
- UpdateKeyCount("BT_MAC", keys["BT_MAC"], autokey);
- }
- if (keys.ContainsKey("LEK"))
- {
- if (writeDoneNow.LEKWrite_YesNo)
- SetCheckboxStatus(WriteLEK, true);
- UpdateKeyCount("LEK", keys["LEK"], false);
- }
- if (keys.ContainsKey("PEK"))
- {
- if (writeDoneNow.PEKWrite_YesNo)
- SetCheckboxStatus(WritePEK, true);
- UpdateKeyCount("PEK", keys["PEK"], false);
- }
- if (keys.ContainsKey("PlayReady_key"))
- {
- if (writeDoneNow.PlayreadyWrite_YesNo)
- SetCheckboxStatus(WritePlayready, true);
- UpdateKeyCount("PlayReady_key", keys["PlayReady_key"], false);
- }
- if (keys.ContainsKey("Hashkey"))
- {
- if (writeDoneNow.HashWrite_YesNo)
- SetCheckboxStatus(WriteHash, true);
- UpdateKeyCount("Hashkey", keys["Hashkey"], false);
- }
- if (keys.ContainsKey("YouTube_KEY"))
- {
- if (writeDoneNow.YouTubeWrite_YesNo)
- SetCheckboxStatus(WriteYouTube, true);
- UpdateKeyCount("YouTube_KEY", keys["YouTube_KEY"], false);
- }
- if (keys.ContainsKey("DSN"))
- {
- if (writeDoneNow.DSNWrite_YesNo)
- SetCheckboxStatus(WriteDSN, true);
- }
- if (keys.ContainsKey("edid_pid"))
- {
- if (writeDoneNow.EDIDPIDWrite_YesNo)
- SetCheckboxStatus(WriteEDIDPID, true);
- }
- if (keys.ContainsKey("edid_model_name"))
- {
- if (writeDoneNow.EDIDModeNameWrite_YesNo)
- SetCheckboxStatus(WriteEDIDName, true);
- }
- if (keys.ContainsKey("ACAS_KEY"))
- {
- if (writeDoneNow.ACASKeyWrite_YesNo)
- SetCheckboxStatus(WriteACASKey, true);
- UpdateKeyCount("ACAS_KEY", keys["ACAS_KEY"], false);
- }
- return true;
- }
- /// <summary>
- /// 获取key数量,更新Keycount
- /// </summary>
- /// <param name="key">key种类</param>
- /// <param name="keytype">key的具体类型</param>
- /// <returns></returns>
- public bool UpdateKeyCount(string key, string keytype, bool autokey)
- {
- string url = midListNow.host;
- string url1;
- string count;
- string code;
- string desc;
- HttpHelper http = new HttpHelper();
- HttpItem item = new HttpItem()
- {
- Encoding = Encoding.Default,
- Method = "post",
- ContentType = "application/x-www-form-urlencoded"
- };
- switch (key)
- {
- case "DeviceID":
- {
- url1 = url + "/statdeviceid.do?";
- item.URL = url1;
- item.Postdata = "devicetype=tcl_unknown_model";
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetDeviceID count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(DIDCount, count, 2);
- else
- SetKeyCountStatus(DIDCount, count, 0);
- if (autokey && WriteDID.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, "tcl_unknown_model");
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, "tcl_unknown_model");
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse DID count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(DIDCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get DID count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(DIDCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "MAC":
- {
- url1 = url + "/statmac.do?";
- item.URL = url1;
- item.Postdata = "typeString=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetMac count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(MacCount, count, 2);
- else
- SetKeyCountStatus(MacCount, count, 0);
- if (autokey && WriteMac.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse Mac count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(MacCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get Mac count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(MacCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "HDCP_KEY":
- {
- url1 = url + "/stathdcpkey.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetHDCP_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(HDCPCount, count, 2);
- else
- SetKeyCountStatus(HDCPCount, count, 0);
- if (autokey && WriteHDCP.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse hdcp count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(HDCPCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get hdcp count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(HDCPCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "CI_PLUS_KEY":
- {
- url1 = url + "/statcikey.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetCI_PLUS_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(CICount, count, 2);
- else
- SetKeyCountStatus(CICount, count, 0);
- if (autokey && WriteCiplus.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parses ciplus count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(CICount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get ciplus count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(CICount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "WiDi":
- {
- url1 = url + "/statwidi.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetWiDi count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(WidiCount, count, 2);
- else
- SetKeyCountStatus(WidiCount, count, 0);
- if (autokey && WriteWiDi.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse widi count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(WidiCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get widi count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(WidiCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "Widevine_KEY":
- {
- url1 = url + "/statWidevineAndAttestation.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetWidevine_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(WideVineCount, count, 2);
- else
- SetKeyCountStatus(WideVineCount, count, 0);
- if (autokey && WriteWidevine.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse widevine count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(WideVineCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get widevine count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(WideVineCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "HDCP2.2_KEY":
- {
- url1 = url + "/stathdcpkey2.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetHDCP2.2_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(HDCP22Count, count, 2);
- else
- SetKeyCountStatus(HDCP22Count, count, 0);
- if (autokey && WriteHDCP22.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse hdcp22 count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(HDCP22Count, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get hdcp22 count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(HDCP22Count, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "NETFILX_ESN":
- {
- url1 = url + "/statnetfilxesn.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetNETFILX_ESN count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(ESNCount, count, 2);
- else
- SetKeyCountStatus(ESNCount, count, 0);
- if (autokey && WriteESN.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse esn count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(ESNCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get esn count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(ESNCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "Attestation_key":
- {
- url1 = url + "/statWidevineAndAttestation.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetAttestation_key count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(AttestationCount, count, 2);
- else
- SetKeyCountStatus(AttestationCount, count, 0);
- if (autokey && WriteAttestation.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parses attestation count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(AttestationCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get ciplus count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(AttestationCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "MGK_KEY":
- {
- url1 = url + "/statmgk.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetMGK count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(MGKCount, count, 2);
- else
- SetKeyCountStatus(MGKCount, count, 0);
- if (autokey && WriteMGK.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse MGK count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(MGKCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get MGK count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(MGKCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "Fairplay_KEY":
- {
- url1 = url + "/statfairplay.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetFairplay_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(FairplayCount, count, 2);
- else
- SetKeyCountStatus(FairplayCount, count, 0);
- if (autokey && WriteFairplay.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse Fairplay count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(FairplayCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get Fairplay count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(FairplayCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "ECP_KEY":
- {
- url1 = url + "/statecp.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetECP_KEY count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(ECPCount, count, 2);
- else
- SetKeyCountStatus(ECPCount, count, 0);
- if (autokey && WriteECP.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse ECP count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(ECPCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get ECP count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(ECPCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "WiFi_MAC":
- {
- url1 = url + "/statmac.do?";
- item.URL = url1;
- item.Postdata = "typeString=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetWifiMac count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(WifiMacCount, count, 2);
- else
- SetKeyCountStatus(WifiMacCount, count, 0);
- if (autokey && WriteWifiMac.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse WifiMac count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(WifiMacCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get WifiMac count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(WifiMacCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "BT_MAC":
- {
- url1 = url + "/statmac.do?";
- item.URL = url1;
- item.Postdata = "typeString=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetBTMac count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(BTMacCount, count, 2);
- else
- SetKeyCountStatus(BTMacCount, count, 0);
- if (autokey && WriteBTMac.Checked)
- {
- int keycount = Convert.ToInt32(count.Replace(",", ""));
- if (availableCount != "unknow")
- {
- if (Convert.ToInt32(availableCount) > keycount)
- AutoKeyRequire(this.Handle, key, keytype);
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- else if (keycount < 500)
- AutoKeyRequire(this.Handle, key, keytype);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse BTMac count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(BTMacCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get BTMac count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(BTMacCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "LEK":
- {
- url1 = url + "/statlek.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetLEK count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(LEKCount, count, 2);
- else
- SetKeyCountStatus(LEKCount, count, 0);
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse LEK count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(LEKCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get LEK count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(LEKCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "PEK":
- {
- url1 = url + "/statpek.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetPEK count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(PEKCount, count, 2);
- else
- SetKeyCountStatus(PEKCount, count, 0);
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse PEK count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(PEKCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get PEK count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(PEKCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "PlayReady_key":
- {
- url1 = url + "/statplayready.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetPlayReady_key count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(PlayreadyCount, count, 2);
- else
- SetKeyCountStatus(PlayreadyCount, count, 0);
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse PlayReady_key count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(PlayreadyCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get PlayReady_key count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(PlayreadyCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "Hashkey":
- {
- url1 = url + "/stathash.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetHashkey count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(HashCount, count, 2);
- else
- SetKeyCountStatus(HashCount, count, 0);
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse Hashkey count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(HashCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get Hashkey count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(HashCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "YouTube_KEY":
- {
- url1 = url + "/statYoutubeKey.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetYoutubehkey count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(YouTubeCount, count, 2);
- else
- SetKeyCountStatus(YouTubeCount, count, 0);
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse Youtube key count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(YouTubeCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get Youtube key count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(YouTubeCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- case "ACAS_KEY": // 获取ACAS KEY数量;
- {
- url1 = url + "/statAcasKey.do?";
- item.URL = url1;
- item.Postdata = "type=" + keytype;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetACASkey count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- if (count == "0")
- SetKeyCountStatus(ACASKeyCount, count, 2);
- else
- SetKeyCountStatus(ACASKeyCount, count, 0);
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to parse ACAS key count", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(ACASKeyCount, code + "Error", 1);
- }
- }
- else
- {
- CommonMethod.ReportErrormsg("Fail to get ACAS key count", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- SetKeyCountStatus(ACASKeyCount, result.StatusDescription, 1);
- return false;
- }
- break;
- }
- default:
- {
- break;
- }
- }
- return true;
- }
- /// <summary>
- /// 获取订单可用key余量
- /// </summary>
- /// <param name="order">订单号</param>
- /// <returns></returns>
- public bool GetOrderRemainKeyCount(string order)
- {
- string url = midListNow.host;
- string url1;
- string count;
- string code;
- string desc;
- if (!CommonMethod.HTTPChecker(url))
- return false;
- HttpHelper http = new HttpHelper();
- HttpItem item = new HttpItem()
- {
- Encoding = Encoding.Default,
- Method = "post",
- ContentType = "application/x-www-form-urlencoded",
- Timeout = 3000
- };
- url1 = url + "/getAvailableKeyCount.do?";
- item.URL = url1;
- item.Postdata = "ordernum=" + order;
- HttpResult result = http.GetHtml(item);
- if (result.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Log.WriteGetKeyLog("\r\nGetOrderRemainKeyCount count:\r\n" + item.URL + "\r\n" + item.Postdata + "\r\n" + result.Html);
- if (Xmlconfig.KeyCountXml(result.Html, "response", "count", out code, out desc, out count))
- {
- availableCount = count.Replace(",", "");
- }
- else
- {
- availableCount = "unknow";
- CommonMethod.ReportErrormsg("Fail to parse GetOrderRemainKeyCount", desc + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- }
- }
- else
- {
- availableCount = "unknow";
- CommonMethod.ReportErrormsg("Fail to get GetOrderRemainKeyCount", result.StatusDescription + "\r\n" + result.Html + "\r\nAddress: " + item.URL + "\r\nPostdata: " + item.Postdata, errorDBNow);
- return false;
- }
- return true;
- }
- /// <summary>
- /// 按键触发在线抄写
- /// 注意:此按键的作用是给不需要输入SN号的工厂使用;
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void OnBtnClickStart(object sender, EventArgs e)
- {
- SN = ""; // SN置为空,用于不需要扫码SN的某些工厂;
- keyInfo = new KeyInfo();
- if (preloadNow)
- {
- MessageBox.Show(LResource.PreloadError, LResource.Error);
- return;
- }
- SetInitialStatus();
- BtnClickstart.Enabled = false;
- SNText.Enabled = false;
- Onlinemode();
- }
- /// <summary>
- /// 在线获取key的方式抄写
- /// </summary>
- public void Onlinemode()
- {
- WriteDID.Checked = (WriteDID.Checked && m_writedid.Text != LResource.Skip);
- WriteMac.Checked = (WriteMac.Checked && m_writemac.Text != LResource.Skip);
- WriteHDCP.Checked = (WriteHDCP.Checked && m_writehdcp.Text != LResource.Skip);
- WriteHDCP22.Checked = (WriteHDCP22.Checked && m_writehdcp22.Text != LResource.Skip);
- WriteWiDi.Checked = (WriteWiDi.Checked && m_writewidi.Text != LResource.Skip);
- WriteWidevine.Checked = (WriteWidevine.Checked && m_writewidevine.Text != LResource.Skip);
- WriteESN.Checked = (WriteESN.Checked && m_writeesn.Text != LResource.Skip);
- WriteCiplus.Checked = (WriteCiplus.Checked && m_writeci.Text != LResource.Skip);
- WriteAttestation.Checked = (WriteAttestation.Checked && m_writeattestation.Text != LResource.Skip);
- WriteMGK.Checked = (WriteMGK.Checked && m_writeMGK.Text != LResource.Skip);
- WriteWifiMac.Checked = (WriteWifiMac.Checked && m_writeWifiMac.Text != LResource.Skip);
- WriteBTMac.Checked = (WriteBTMac.Checked && m_writeBTMac.Text != LResource.Skip);
- WriteECP.Checked = (WriteECP.Checked && m_writeECP.Text != LResource.Skip);
- WriteLEK.Checked = (WriteLEK.Checked && m_writeLEK.Text != LResource.Skip);
- WritePEK.Checked = (WritePEK.Checked && m_writePEK.Text != LResource.Skip);
- WritePlayready.Checked = (WritePlayready.Checked && m_writePlayready.Text != LResource.Skip);
- WriteHash.Checked = (WriteHash.Checked && m_writeHash.Text != LResource.Skip);
- WriteYouTube.Checked = (WriteYouTube.Checked && m_writeYouTube.Text != LResource.Skip);
- WriteEDIDPID.Checked = (WriteEDIDPID.Checked && m_writeEDIDPID.Text != LResource.Skip);
- WriteEDIDName.Checked = (WriteEDIDName.Checked && m_writeEDIDName.Text != LResource.Skip);
- WriteACASKey.Checked = (WriteACASKey.Checked && m_writeACASKey.Text != LResource.Skip);
- bool preloadresult = false;
- preloadresult = true;
- timer1.Start();
- UpdateKeys(midListNow.keytype, true);
- WritekeyThread = new Thread(Writekey);
- WritekeyThread.Start();
- if (!preloadresult)
- {
- SNText.Enabled = true;
- }
- }
- /// <summary>
- /// 更新订单抄写数量
- /// </summary>
- /// <returns></returns>
- public bool UploadCopyCount()
- {
- return (SQLiteHelper.UpdateProductionNum(errorDBNow, orderNow));
- }
- /// <summary>
- /// 获取定制化抄写信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void OnBtnOtherView(object sender, EventArgs e)
- {
- if (midListNow.rokuCustomer != null)
- 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);
- else
- MessageBox.Show("null");
- }
- /// <summary>
- /// 获取本地key数量
- /// </summary>
- public void GetLocalKeysCount()
- {
- int didnum;
- if (GetLocalKeyCount.GetLocalDidCount(orderNow, out didnum, ref localmidList, errorDBNow))
- {
- SetCheckboxStatus(WriteDID, true);
- if (didnum != -1)
- SetKeyCountStatus(DIDCount, didnum.ToString(), 0);
- else
- SetKeyCountStatus(DIDCount, "Read error", 1);
- }
- int macnum;
- if (GetLocalKeyCount.GetLocalMacCount(orderNow, out macnum, ref localmidList, errorDBNow))
- {
- SetCheckboxStatus(WriteMac, true);
- if (macnum != -1)
- SetKeyCountStatus(MacCount, macnum.ToString(), 0);
- else
- SetKeyCountStatus(MacCount, "Read error", 1);
- }
- int hdcpnum;
- if (GetLocalKeyCount.GetLocalHDCPKEYCount(orderNow, out hdcpnum))
- {
- SetCheckboxStatus(WriteHDCP, true);
- if (hdcpnum != -1)
- SetKeyCountStatus(HDCPCount, hdcpnum.ToString(), 0);
- else
- SetKeyCountStatus(HDCPCount, "Read error", 1);
- }
- int widinum;
- if (GetLocalKeyCount.GetLocalWiDiCount(orderNow, out widinum))
- {
- SetCheckboxStatus(WriteWiDi, true);
- if (widinum != -1)
- SetKeyCountStatus(WidiCount, widinum.ToString(), 0);
- else
- SetKeyCountStatus(WidiCount, "Read error", 1);
- }
- int hdcp22num;
- if (GetLocalKeyCount.GetLocalHDCPKEY22Count(orderNow, out hdcp22num))
- {
- SetCheckboxStatus(WriteHDCP22, true);
- if (hdcp22num != -1)
- SetKeyCountStatus(HDCP22Count, hdcp22num.ToString(), 0);
- else
- SetKeyCountStatus(HDCP22Count, "Read error", 1);
- }
- int esnnum;
- if (GetLocalKeyCount.GetLocalESNCount(orderNow, out esnnum))
- {
- SetCheckboxStatus(WriteESN, true);
- if (esnnum != -1)
- SetKeyCountStatus(ESNCount, esnnum.ToString(), 0);
- else
- SetKeyCountStatus(ESNCount, "Read error", 1);
- }
- int widevinenum;
- if (GetLocalKeyCount.GetLocalWidevineCount(orderNow, out widevinenum))
- {
- SetCheckboxStatus(WriteWidevine, true);
- if (widevinenum != -1)
- SetKeyCountStatus(WideVineCount, widevinenum.ToString(), 0);
- else
- SetKeyCountStatus(WideVineCount, "Read error", 1);
- }
- int cinum;
- if (GetLocalKeyCount.GetLocalCIKEYCount(orderNow, out cinum))
- {
- SetCheckboxStatus(WriteCiplus, true);
- if (cinum != -1)
- SetKeyCountStatus(CICount, cinum.ToString(), 0);
- else
- SetKeyCountStatus(CICount, "Read error", 1);
- }
- int mgknum;
- if (GetLocalKeyCount.GetLocalMGKCount(orderNow, out mgknum))
- {
- SetCheckboxStatus(WriteMGK, true);
- if (mgknum != -1)
- SetKeyCountStatus(MGKCount, mgknum.ToString(), 0);
- else
- SetKeyCountStatus(MGKCount, "Read error", 1);
- }
- int attestationnum;
- if (GetLocalKeyCount.GetLocalAttestationCount(orderNow, out attestationnum))
- {
- SetCheckboxStatus(WriteAttestation, true);
- if (attestationnum != -1)
- SetKeyCountStatus(AttestationCount, attestationnum.ToString(), 0);
- else
- SetKeyCountStatus(AttestationCount, "Read error", 1);
- }
- int fairplaynum;
- if (GetLocalKeyCount.GetLocalFairplayCount(orderNow, out fairplaynum))
- {
- SetCheckboxStatus(WriteFairplay, true);
- if (fairplaynum != -1)
- SetKeyCountStatus(FairplayCount, fairplaynum.ToString(), 0);
- else
- SetKeyCountStatus(FairplayCount, "Read error", 1);
- }
- int leknum;
- fireTVKey.LEK = GetLocalKeyCount.GetLocalFolderKeyCount(orderNow, "LEK", out leknum);
- int peknum;
- fireTVKey.PEK = GetLocalKeyCount.GetLocalFolderKeyCount(orderNow, "PEK", out peknum);
- int palyreadynum;
- fireTVKey.Playready = GetLocalKeyCount.GetLocalFolderKeyCount(orderNow, "Playready", out palyreadynum);
- int hashkeynum;
- fireTVKey.Hashkey = GetLocalKeyCount.GetLocalFolderKeyCount(orderNow, "Hashkey", out hashkeynum);
- }
- /// <summary>
- /// 抄写用时计数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void timer1_Tick(object sender, EventArgs e)
- {
- usingTime += 1;
- UsingTime_Text.Text = usingTime.ToString();
- }
- /// <summary>
- /// 取消SN扫描框聚焦
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void SNText_DoubleClick(object sender, EventArgs e)
- {
- FocusMark = false;
- this.CaptionBackColorTop = Color.RoyalBlue;
- this.CaptionBackColorBottom = Color.Cyan;
- this.Refresh();
- }
- /// <summary>
- /// 强制刷新抄写线程
- /// </summary>
- private void OnBtnRefresh(object sender, EventArgs e)
- {
- usingTime = 0;
- EnableText(SNText);
- EnableButton(BtnClickstart);
- SN = "";
- keyInfo = new KeyInfo();
- SetInitialStatus();
- if (WritekeyThread != null)
- {
- if (WritekeyThread.IsAlive)
- {
- WritekeyThread.Abort();
- if (timer1.Enabled)
- {
- timer1.Stop();
- }
- while (WritekeyThread.ThreadState != System.Threading.ThreadState.Aborted)
- {
- Thread.Sleep(100);
- }
- }
- }
- UsingTime_Text.Text = "0";
- GC.Collect();
- MessageBox.Show(LResource.RefreshPanel);
- }
- /// <summary>
- /// 显示订单key可用余量
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void OrderText_MouseEnter(object sender, EventArgs e)
- {
- toolTip1.SetToolTip(OrderText, LResource.AvailableKey + availableCount);
- }
- }
- }
|