OperationPanel.cs 277 KB

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