ZstUtils.cs 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Web;
  4. using System.Linq;
  5. using System.Text;
  6. namespace CP.Common
  7. {
  8. /// <summary>
  9. /// 走势图上的工具集合..
  10. /// </summary>
  11. public class ZstUtils
  12. {
  13. #region 快乐扑克3号码形态
  14. /// <summary>
  15. /// 快乐扑克3号码形态
  16. /// </summary>
  17. /// <param name="kjh"></param>
  18. /// <param name="hs"></param>
  19. /// <returns></returns>
  20. public static string GetTcsdKlpk3Hmxt(List<int> kjh, List<int> hs)
  21. {
  22. kjh.Sort();
  23. if (hs[0] == hs[1] && hs[1] == hs[2])
  24. {
  25. if (Math.Abs(kjh[2] - kjh[1]) == 1 && Math.Abs(kjh[1] - kjh[0]) == 1)
  26. return "同花顺";
  27. else
  28. return "同花";
  29. }
  30. else
  31. {
  32. if (Math.Abs(kjh[2] - kjh[1]) == 1 && Math.Abs(kjh[1] - kjh[0]) == 1)
  33. return "顺子";
  34. else if (kjh[0] == kjh[1] && kjh[1] == kjh[2])
  35. return "豹子";
  36. else if (kjh[0] != kjh[1] && kjh[0] != kjh[2] && kjh[1] != kjh[2])
  37. return "散牌";
  38. else
  39. return "对子";
  40. }
  41. }
  42. #endregion
  43. #region 获取山西泳坛夺金组选形态
  44. /// <summary>
  45. /// 获取山西泳坛夺金组选形态
  46. /// </summary>
  47. /// <param name="kjh"></param>
  48. /// <returns>0:组选4(3个号码相同) 1:组选6(2对号码相同) 2:组选12(2个号码相同) 3:组选24(都不相同)</returns>
  49. public static int GetYtdjZxxt(List<int> kjh)
  50. {
  51. Dictionary<int, int> hmCount = new Dictionary<int, int>();
  52. for (var i = 0; i < kjh.Count; i++)
  53. {
  54. var cur = kjh[i];
  55. for (var j = i + 1; j < kjh.Count; j++)
  56. {
  57. var hm = kjh[j];
  58. if (hm == cur)
  59. {
  60. if (hmCount.Keys.Contains(hm))
  61. {
  62. hmCount[hm]++;
  63. }
  64. else
  65. {
  66. hmCount.Add(hm, 1);
  67. }
  68. }
  69. }
  70. }
  71. if (hmCount.Count == 0)
  72. return 3;
  73. else if (hmCount.Count == 1)
  74. {
  75. if (hmCount.ElementAt(0).Value == 6)
  76. return 6;
  77. else if (hmCount.ElementAt(0).Value == 3)
  78. return 0;
  79. else if (hmCount.ElementAt(0).Value == 1)
  80. return 2;
  81. }
  82. return 1;
  83. }
  84. #endregion
  85. #region 大小相关方法
  86. /// <summary>
  87. /// 返回大小的状态,需要传中间值,小于中间值为小,大于等于中间值为大。
  88. /// </summary>
  89. /// <param name="n"></param>
  90. /// <param name="middle"></param>
  91. /// <returns></returns>
  92. public static int GetDxBymiddle(int n, int middle)
  93. {
  94. int r = 1;
  95. if (n < middle)
  96. r = 0;
  97. return r;
  98. }
  99. /// <summary>
  100. /// 返回0~9大小的状态
  101. /// 0=小
  102. /// 1=大
  103. /// </summary>
  104. /// <param name="n"></param>
  105. /// <returns></returns>
  106. public static int GetDx(int n)
  107. {
  108. return GetDxBymiddle(n, 5);
  109. }
  110. /// <summary>
  111. /// 大小形态
  112. /// </summary>
  113. /// <param name="num"></param>
  114. /// <param name="istyle"></param>
  115. /// <returns></returns>
  116. public static string Getdxxt(List<int> kjh, int middle)
  117. {
  118. StringBuilder result = new StringBuilder();
  119. int size = kjh.Count;
  120. for (int i = 0; i < size; i++)
  121. {
  122. if (GetDxBymiddle(kjh[i], middle) == 1)
  123. result.Append("大");
  124. else
  125. result.Append("小");
  126. }
  127. return result.ToString();
  128. }
  129. /// <summary>
  130. /// 大小形态
  131. /// </summary>
  132. /// <param name="num"></param>
  133. /// <param name="istyle"></param>
  134. /// <returns></returns>
  135. public static string GetDxxt(List<int> kjh, bool istyle = true)
  136. {
  137. StringBuilder result = new StringBuilder();
  138. int size = kjh.Count;
  139. for (int i = 0; i < size; i++)
  140. {
  141. if (istyle)
  142. {
  143. if (kjh[i] > 4)
  144. result.Append("<span class=\"wz1\">大</span>");
  145. else
  146. result.Append("<span class=\"wz2\">小</span>");
  147. }
  148. else
  149. {
  150. if (kjh[i] > 4)
  151. result.Append("大");
  152. else
  153. result.Append("小");
  154. }
  155. }
  156. return result.ToString();
  157. }
  158. /// <summary>
  159. /// 大小形态
  160. /// </summary>
  161. /// <param name="num"></param>
  162. /// <param name="istyle"></param>
  163. /// <returns></returns>
  164. public static string GetDxxtByMiddle(List<int> kjh, int middle, bool istyle = true)
  165. {
  166. StringBuilder result = new StringBuilder();
  167. int size = kjh.Count;
  168. for (int i = 0; i < size; i++)
  169. {
  170. if (istyle)
  171. {
  172. if (kjh[i] >= middle)
  173. result.Append("<span class=\"wz1\">大</span>");
  174. else
  175. result.Append("<span class=\"wz2\">小</span>");
  176. }
  177. else
  178. {
  179. if (kjh[i] >= middle)
  180. result.Append("大");
  181. else
  182. result.Append("小");
  183. }
  184. }
  185. return result.ToString();
  186. }
  187. /// <summary>
  188. /// 返回开奖号的大小形态
  189. /// 如:大大小
  190. /// 有样式
  191. /// </summary>
  192. /// <param name="num"></param>
  193. /// <returns></returns>
  194. public static string GetDxxt(int num, bool istyle = true)
  195. {
  196. List<int> kjh = GetNumList(num);
  197. StringBuilder result = new StringBuilder();
  198. int size = kjh.Count;
  199. for (int i = 0; i < size; i++)
  200. {
  201. if (istyle)
  202. {
  203. if (kjh[i] > 4)
  204. result.Append("<span class=\"wz1\">大</span>");
  205. else
  206. result.Append("<span class=\"wz2\">小</span>");
  207. }
  208. else
  209. {
  210. if (kjh[i] > 4)
  211. result.Append("大");
  212. else
  213. result.Append("小");
  214. }
  215. }
  216. return result.ToString();
  217. }
  218. /// <summary>
  219. /// 东方6+1的大小比
  220. /// </summary>
  221. /// <param name="list"></param>
  222. /// <returns></returns>
  223. public static string GetDf61Dxb(List<int> list)
  224. {
  225. return GetDxb(list, 5);
  226. }
  227. /// <summary>
  228. /// 22选5 大小比
  229. /// </summary>
  230. /// <param name="kjh"></param>
  231. /// <returns></returns>
  232. public static string Get22x5Dxb(List<int> list)
  233. {
  234. return GetDxb(list, 12);
  235. }
  236. /// <summary>
  237. /// 25选5 大小比
  238. /// </summary>
  239. /// <param name="kjh"></param>
  240. /// <returns></returns>
  241. public static string Get25x5Dxb(List<int> list)
  242. {
  243. return GetDxb(list, 13);
  244. }
  245. /// <summary>
  246. /// 25选5 大小比
  247. /// </summary>
  248. /// <param name="kjh"></param>
  249. /// <returns></returns>
  250. public static string Get26x5Dxb(List<int> list)
  251. {
  252. return GetDxb(list, 14);
  253. }
  254. /// <summary>
  255. /// 25选7 大小比
  256. /// </summary>
  257. /// <param name="kjh"></param>
  258. /// <returns></returns>
  259. public static string Get25x7Dxb(List<int> list)
  260. {
  261. return GetDxb(list, 13);
  262. }
  263. /// <summary>
  264. /// 24选7 大小比
  265. /// </summary>
  266. /// <param name="kjh"></param>
  267. /// <returns></returns>
  268. public static string Get24x7Dxb(List<int> list)
  269. {
  270. return GetDxb(list, 12);
  271. }
  272. /// <summary>
  273. /// 20选5 大小比
  274. /// </summary>
  275. /// <param name="kjh"></param>
  276. /// <returns></returns>
  277. public static string Get20x5Dxb(List<int> list)
  278. {
  279. return GetDxb(list, 11);
  280. }
  281. /// <summary>
  282. /// 18x7 大小比
  283. /// </summary>
  284. /// <param name="kjh"></param>
  285. /// <returns></returns>
  286. public static string Get18x7Dxb(List<int> list)
  287. {
  288. return GetDxb(list, 10);
  289. }
  290. /// <summary>
  291. /// 30选5
  292. /// </summary>
  293. /// <param name="kjh"></param>
  294. /// <param name="istyle"></param>
  295. /// <returns></returns>
  296. public static string Get30x5Dxxt(List<int> kjh, bool istyle = true)
  297. {
  298. StringBuilder result = new StringBuilder();
  299. int size = kjh.Count;
  300. for (int i = 0; i < size; i++)
  301. {
  302. if (istyle)
  303. {
  304. if (GetDxBymiddle(kjh[i], 16) == 1)
  305. result.Append("<span class=\"wz1\">大</span>");
  306. else
  307. result.Append("<span class=\"wz2\">小</span>");
  308. }
  309. else
  310. {
  311. if (GetDxBymiddle(kjh[i], 12) == 1)
  312. result.Append("大");
  313. else
  314. result.Append("小");
  315. }
  316. }
  317. return result.ToString();
  318. }
  319. /// <summary>
  320. /// 22选5 大小形态
  321. /// </summary>
  322. /// <param name="kjh"></param>
  323. /// <param name="istyle"></param>
  324. /// <returns></returns>
  325. public static string Get22x5Dxxt(List<int> kjh, bool istyle = true)
  326. {
  327. StringBuilder result = new StringBuilder();
  328. int size = kjh.Count;
  329. for (int i = 0; i < size; i++)
  330. {
  331. if (istyle)
  332. {
  333. if (GetDxBymiddle(kjh[i], 12) == 1)
  334. result.Append("<span class=\"wz1\">大</span>");
  335. else
  336. result.Append("<span class=\"wz2\">小</span>");
  337. }
  338. else
  339. {
  340. if (GetDxBymiddle(kjh[i], 12) == 1)
  341. result.Append("大");
  342. else
  343. result.Append("小");
  344. }
  345. }
  346. return result.ToString();
  347. }
  348. /// <summary>
  349. /// 20选5 大小形态
  350. /// </summary>
  351. /// <param name="kjh"></param>
  352. /// <param name="istyle"></param>
  353. /// <returns></returns>
  354. public static string Get20x5Dxxt(List<int> kjh, bool istyle = true)
  355. {
  356. StringBuilder result = new StringBuilder();
  357. int size = kjh.Count;
  358. for (int i = 0; i < size; i++)
  359. {
  360. if (istyle)
  361. {
  362. if (GetDxBymiddle(kjh[i], 11) == 1)
  363. result.Append("<span class=\"wz1\">大</span>");
  364. else
  365. result.Append("<span class=\"wz2\">小</span>");
  366. }
  367. else
  368. {
  369. if (GetDxBymiddle(kjh[i], 11) == 1)
  370. result.Append("大");
  371. else
  372. result.Append("小");
  373. }
  374. }
  375. return result.ToString();
  376. }
  377. /// <summary>
  378. /// 好彩1大小
  379. /// </summary>
  380. /// <param name="n"></param>
  381. /// <returns></returns>
  382. public static int GetHc1Dx(int n)
  383. {
  384. return GetDxBymiddle(n, 19);
  385. }
  386. /// <summary>
  387. /// 七乐彩大小比
  388. /// </summary>
  389. /// <param name="kjh"></param>
  390. /// <returns></returns>
  391. public static string GetQlcDxb(string[] kjh)
  392. {
  393. string bz = string.Empty;
  394. if (kjh != null && kjh.Length > 0)
  395. {
  396. int d = 0;
  397. int x = 0;
  398. for (int i = 0; i < kjh.Length; i++)
  399. {
  400. if (TypeConverter.StrToInt(kjh[i], 0) > 15)
  401. d++;
  402. else
  403. x++;
  404. }
  405. bz = d.ToString() + ":" + x.ToString();
  406. }
  407. return bz;
  408. }
  409. /// <summary>
  410. /// 七乐彩大小比
  411. /// </summary>
  412. /// <param name="list"></param>
  413. /// <returns></returns>
  414. public static string GetQlcDxb(List<int> list)
  415. {
  416. return GetDxb(list, 16);
  417. }
  418. /// <summary>
  419. /// 7位数和值大小
  420. /// </summary>
  421. /// <param name="n"></param>
  422. /// <returns></returns>
  423. public static int Get7hwhz(int n)
  424. {
  425. return GetDxBymiddle(n, 33);
  426. }
  427. /// <summary>
  428. /// 返回p5和值大小
  429. /// </summary>
  430. /// <param name="n"></param>
  431. /// <returns></returns>
  432. public static int GetP5HzDx(int n)
  433. {
  434. return GetDxBymiddle(n, 23);
  435. }
  436. /// <summary>
  437. /// 15x5大小
  438. /// </summary>
  439. /// <param name="n"></param>
  440. /// <returns></returns>
  441. public static int Get15x5Dx(int n)
  442. {
  443. return GetDxBymiddle(n, 8);
  444. }
  445. /// <summary>
  446. /// 11选5大小
  447. /// </summary>
  448. /// <param name="n"></param>
  449. /// <returns></returns>
  450. public static int Get11x5Dx(int n)
  451. {
  452. return GetDxBymiddle(n, 6);
  453. }
  454. /// <summary>
  455. /// 11选5的大小形态
  456. /// </summary>
  457. /// <param name="kjh"></param>
  458. /// <returns></returns>
  459. public static string Get11x5Dxxt(List<int> kjh)
  460. {
  461. string xt = string.Empty;
  462. if (kjh != null && kjh.Count > 0)
  463. {
  464. foreach (int i in kjh)
  465. {
  466. if (Get11x5Dx(i) == 1)
  467. xt = xt + "大";
  468. else
  469. xt = xt + "小";
  470. }
  471. }
  472. return xt;
  473. }
  474. /// <summary>
  475. /// 七星彩和值大小
  476. /// </summary>
  477. /// <param name="n"></param>
  478. /// <returns></returns>
  479. public static int GetQxcHzDx(int n)
  480. {
  481. return GetDxBymiddle(n, 33);
  482. }
  483. /// <summary>
  484. /// 3D/p3和值大小
  485. /// </summary>
  486. /// <param name="n"></param>
  487. /// <returns></returns>
  488. public static int GetHzDx(int n)
  489. {
  490. return GetDxBymiddle(n, 14);
  491. }
  492. /// <summary>
  493. /// 福建36x7
  494. /// </summary>
  495. /// <param name="list"></param>
  496. /// <returns></returns>
  497. public static string GetTcfj36x7DXB(List<int> list)
  498. {
  499. return GetDxb(list, 19);
  500. }
  501. /// <summary>
  502. /// 31x7大小比
  503. /// </summary>
  504. /// <param name="list"></param>
  505. /// <returns></returns>
  506. public static string GetTcfj31x7DXB(List<int> list)
  507. {
  508. return GetDxb(list, 16);
  509. }
  510. /// <summary>
  511. /// 大乐透后区大小比
  512. /// </summary>
  513. /// <param name="kjh"></param>
  514. /// <returns></returns>
  515. public static string GetDltHqDxt(string[] kjh)
  516. {
  517. string bz = string.Empty;
  518. if (kjh != null && kjh.Length > 0)
  519. {
  520. int d = 0;
  521. int x = 0;
  522. for (int i = 0; i < kjh.Length; i++)
  523. {
  524. if (GetDxBymiddle(TypeConverter.StrToInt(kjh[i], 0), 7) == 1)
  525. d++;
  526. else
  527. x++;
  528. }
  529. bz = d.ToString() + ":" + x.ToString();
  530. }
  531. return bz;
  532. }
  533. /// <summary>
  534. /// 大乐透前区大小比
  535. /// </summary>
  536. /// <param name="kjh"></param>
  537. /// <returns></returns>
  538. public static string GetDltDxb(string[] kjh)
  539. {
  540. string bz = string.Empty;
  541. if (kjh != null && kjh.Length > 0)
  542. {
  543. int d = 0;
  544. int x = 0;
  545. for (int i = 0; i < kjh.Length; i++)
  546. {
  547. if (GetDxBymiddle(TypeConverter.StrToInt(kjh[i], 0), 18) == 1)
  548. d++;
  549. else
  550. x++;
  551. }
  552. bz = d.ToString() + ":" + x.ToString();
  553. }
  554. return bz;
  555. }
  556. /// <summary>
  557. /// 双色球红球大小比
  558. /// </summary>
  559. /// <param name="kjh"></param>
  560. /// <returns></returns>
  561. public static string GetSSqDxb(string[] kjh)
  562. {
  563. string bz = string.Empty;
  564. if (kjh != null && kjh.Length > 0)
  565. {
  566. int d = 0;
  567. int x = 0;
  568. for (int i = 0; i < kjh.Length; i++)
  569. {
  570. if (GetDxBymiddle(TypeConverter.StrToInt(kjh[i], 0), 17) == 1)
  571. d++;
  572. else
  573. x++;
  574. }
  575. bz = d.ToString() + ":" + x.ToString();
  576. }
  577. return bz;
  578. }
  579. /// <summary>
  580. /// 双色球红球大小比
  581. /// </summary>
  582. /// <param name="list"></param>
  583. /// <returns></returns>
  584. public static string GetSsqDxb(List<int> list)
  585. {
  586. return GetDxb(list, 17);
  587. }
  588. /// <summary>
  589. /// 大乐透前区大小比
  590. /// </summary>
  591. /// <param name="list"></param>
  592. /// <returns></returns>
  593. public static string GetDltDxb(List<int> list)
  594. {
  595. return GetDxb(list, 18);
  596. }
  597. /// <summary>
  598. /// 15x5大小比
  599. /// </summary>
  600. /// <param name="kjh"></param>
  601. /// <returns></returns>
  602. public static string GetHd15x5Dxb(List<int> kjh)
  603. {
  604. return GetDxb(kjh, 7);
  605. }
  606. /// <summary>
  607. /// 15x5的的大小形态
  608. /// </summary>
  609. /// <param name="kjh"></param>
  610. /// <param name="istyle"></param>
  611. /// <returns></returns>
  612. public static string GetHd15x5Dxxt(List<int> kjh, bool istyle = true)
  613. {
  614. StringBuilder result = new StringBuilder();
  615. int size = kjh.Count;
  616. for (int i = 0; i < size; i++)
  617. {
  618. if (istyle)
  619. {
  620. if (GetDxBymiddle(kjh[i], 8) == 1)
  621. result.Append("<span class=\"wz1\">大</span>");
  622. else
  623. result.Append("<span class=\"wz2\">小</span>");
  624. }
  625. else
  626. {
  627. if (GetDxBymiddle(kjh[i], 8) == 1)
  628. result.Append("大");
  629. else
  630. result.Append("小");
  631. }
  632. }
  633. return result.ToString();
  634. }
  635. /// <summary>
  636. /// 广东11选5大小比
  637. /// </summary>
  638. /// <param name="kjh"></param>
  639. /// <returns></returns>
  640. public static string GetGd11x5Dxb(List<int> kjh)
  641. {
  642. return GetDxb(kjh, 6);
  643. }
  644. /// <summary>
  645. /// 湖北11选5大小比
  646. /// </summary>
  647. /// <param name="kjh"></param>
  648. /// <returns></returns>
  649. public static string GetHb11x5Dxb(List<int> kjh)
  650. {
  651. return GetDxb(kjh, 6);
  652. }
  653. /// <summary>
  654. /// 大小比
  655. /// </summary>
  656. /// <param name="kjh">数据</param>
  657. /// <param name="middle">中间数</param>
  658. /// <returns></returns>
  659. public static string GetDxb(List<int> kjh, int middle)
  660. {
  661. int d = 0;
  662. int x = 0;
  663. for (int i = 0; i < kjh.Count; i++)
  664. {
  665. if (GetDxBymiddle(kjh[i], middle) == 1)
  666. d++;
  667. else
  668. x++;
  669. }
  670. return d.ToString() + ":" + x.ToString();
  671. }
  672. /// <summary>
  673. /// 旧的大小比方法
  674. /// </summary>
  675. /// <param name="num"></param>
  676. /// <returns></returns>
  677. public static string GetDxb(int num)
  678. {
  679. List<int> kjh = GetNumList(num);
  680. return GetDxb(kjh, 5);
  681. }
  682. #endregion
  683. #region 012路相关方法
  684. /// <summary>
  685. /// 返回某个号码的012路形态
  686. /// </summary>
  687. /// <param name="kjh"></param>
  688. /// <returns></returns>
  689. public static string Get012Xt(List<int> k)
  690. {
  691. StringBuilder xt = new StringBuilder();
  692. for (int i = 0; i < k.Count; i++)
  693. {
  694. xt.Append(Get012(k[i]));
  695. }
  696. return xt.ToString();
  697. }
  698. /// <summary>
  699. /// 某数字的012路形态
  700. /// 返回 0 1 2
  701. /// </summary>
  702. /// <param name="n"></param>
  703. /// <returns></returns>
  704. public static int Get012(int n)
  705. {
  706. return n % 3;
  707. }
  708. /// <summary>
  709. /// 获取和尾的 升平降 0:升 1:平 2:降
  710. /// </summary>
  711. /// <param name="hw"></param>
  712. /// <param name="uphw"></param>
  713. /// <param name="i">第几行</param>
  714. /// <returns></returns>
  715. public static int GetSpj(int hw, int uphw = 0, int i = 0)
  716. {
  717. if (i == 0)
  718. return 1;
  719. else
  720. {
  721. if (hw > uphw)
  722. return 0;
  723. else if (hw == uphw)
  724. return 1;
  725. else
  726. return 2;
  727. }
  728. }
  729. /// <summary>
  730. /// 通用的012个数路比
  731. /// </summary>
  732. /// <param name="list"></param>
  733. /// <returns></returns>
  734. public static string GetCommon012b(List<int> list)
  735. {
  736. string bz = string.Empty;
  737. if (list != null && list.Count > 0)
  738. {
  739. int a = 0;
  740. int b = 0;
  741. int c = 0;
  742. for (int i = 0; i < list.Count; i++)
  743. {
  744. if (Get012(list[i]) == 0)
  745. a++;
  746. if (Get012(list[i]) == 1)
  747. b++;
  748. if (Get012(list[i]) == 2)
  749. c++;
  750. }
  751. bz = a.ToString() + ":" + b.ToString() + ":" + c.ToString();
  752. }
  753. return bz;
  754. }
  755. /// <summary>
  756. /// 取某个开奖号某路的个数
  757. /// 如开奖号258的0路号码个数为0
  758. /// 139的0路号码个数为2
  759. /// </summary>
  760. /// <param name="n"></param>
  761. /// <param name="kjh"></param>
  762. /// <returns></returns>
  763. public static int Get012Count(int n, List<int> k)
  764. {
  765. int count = 0;
  766. for (int i = 0; i < k.Count; i++)
  767. {
  768. if (k[i] % 3 == n)
  769. count++;
  770. }
  771. return count;
  772. }
  773. #endregion
  774. #region 质合相关方法
  775. /// <summary>
  776. /// 通用求质合 质合 0为合 1为质(适用0-100)
  777. /// </summary>
  778. /// <param name="n"></param>
  779. /// <returns></returns>
  780. public static int GetZh(int n)
  781. {
  782. //0~100
  783. List<int> zs = new List<int> { 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
  784. if (zs.Contains(n))
  785. return 1;
  786. else
  787. return 0;
  788. }
  789. /// <summary>
  790. /// 通用求质合比
  791. /// </summary>
  792. /// <param name="kjh"></param>
  793. /// <returns></returns>
  794. public static string GetZhb(List<int> kjh)
  795. {
  796. string bz = string.Empty;
  797. if (kjh != null && kjh.Count > 0)
  798. {
  799. int h = 0;
  800. int z = 0;
  801. for (int i = 0; i < kjh.Count; i++)
  802. {
  803. if (GetZh(kjh[i]) == 0)
  804. h++;
  805. else
  806. z++;
  807. }
  808. bz = z.ToString() + ":" + h.ToString();
  809. }
  810. return bz;
  811. }
  812. /// <summary>
  813. /// 通用质合比
  814. /// </summary>
  815. /// <param name="kjh"></param>
  816. /// <returns></returns>
  817. public static string GetZhb(string[] kjh)
  818. {
  819. string bz = string.Empty;
  820. if (kjh != null && kjh.Length > 0)
  821. {
  822. int z = 0;
  823. int h = 0;
  824. for (int i = 0; i < kjh.Length; i++)
  825. {
  826. if (GetZh(TypeConverter.StrToInt(kjh[i], 0)) == 1)
  827. z++;
  828. if (GetZh(TypeConverter.StrToInt(kjh[i], 0)) == 0)
  829. h++;
  830. }
  831. bz = z.ToString() + ":" + h.ToString();
  832. }
  833. return bz;
  834. }
  835. /// <summary>
  836. /// 质合形态
  837. /// </summary>
  838. /// <param name="kjh"></param>
  839. /// <param name="istyle"></param>
  840. /// <returns></returns>
  841. public static string GetZhxt(List<int> kjh, bool istyle = true)
  842. {
  843. StringBuilder result = new StringBuilder();
  844. for (int i = 0; i < kjh.Count; i++)
  845. {
  846. if (istyle)
  847. {
  848. if (GetZh(kjh[i]) == 0)
  849. result.Append("<span class=\"wz3\">合</span>");
  850. else
  851. result.Append("<span class=\"wz4\">质</span>");
  852. }
  853. else
  854. {
  855. if (GetZh(kjh[i]) == 0)
  856. result.Append("合");
  857. else
  858. result.Append("质");
  859. }
  860. }
  861. return result.ToString();
  862. }
  863. /// <summary>
  864. /// 开奖号的质合形态
  865. /// </summary>
  866. /// <param name="kjh"></param>
  867. /// <param name="istyle">是否带样式输出</param>
  868. /// <returns></returns>
  869. public static string GetZhxt(int num, bool istyle = true)
  870. {
  871. List<int> kjh = GetNumList(num);
  872. StringBuilder result = new StringBuilder();
  873. for (int i = 0; i < kjh.Count; i++)
  874. {
  875. if (istyle)
  876. {
  877. if (GetZh(kjh[i]) == 0)
  878. result.Append("<span class=\"wz3\">合</span>");
  879. else
  880. result.Append("<span class=\"wz4\">质</span>");
  881. }
  882. else
  883. {
  884. if (GetZh(kjh[i]) == 0)
  885. result.Append("合");
  886. else
  887. result.Append("质");
  888. }
  889. }
  890. return result.ToString();
  891. }
  892. #endregion
  893. #region 奇偶相关方法
  894. /// <summary>
  895. /// 返回奇偶状态
  896. /// 0=偶
  897. /// 1=奇
  898. /// </summary>
  899. /// <param name="n"></param>
  900. /// <returns></returns>
  901. public static int GetJo(int n)
  902. {
  903. if (n % 2 == 0)
  904. return 0;
  905. else
  906. return 1;
  907. }
  908. /// <summary>
  909. /// 奇偶比
  910. /// </summary>
  911. /// <param name="kjh"></param>
  912. /// <returns></returns>
  913. public static string GetJob(List<int> kjh)
  914. {
  915. int j = 0;
  916. int o = 0;
  917. for (int i = 0; i < kjh.Count; i++)
  918. {
  919. if (GetJo(kjh[i]) == 0)
  920. o++;
  921. else
  922. j++;
  923. }
  924. return j.ToString() + ":" + o.ToString();
  925. }
  926. /// <summary>
  927. /// 奇偶比
  928. /// </summary>
  929. /// <param name="kjh"></param>
  930. /// <returns></returns>
  931. public static string GetJob(string[] kjh)
  932. {
  933. string bz = string.Empty;
  934. if (kjh != null && kjh.Length > 0)
  935. {
  936. int j = 0;
  937. int o = 0;
  938. for (int i = 0; i < kjh.Length; i++)
  939. {
  940. if (GetJo(TypeConverter.StrToInt(kjh[i], 0)) == 0)
  941. o++;
  942. else
  943. j++;
  944. }
  945. bz = j.ToString() + ":" + o.ToString();
  946. }
  947. return bz;
  948. }
  949. /// <summary>
  950. /// 奇偶比
  951. /// </summary>
  952. /// <param name="num"></param>
  953. /// <returns></returns>
  954. public static string GetJob(int num)
  955. {
  956. List<int> kjh = GetNumList(num);
  957. return GetJob(kjh);
  958. }
  959. /// <summary>
  960. /// 返回开奖号的奇偶形态
  961. /// 如:奇偶偶
  962. /// </summary>
  963. /// <param name="num"></param>
  964. /// <param name="istyle">是否带样式输出</param>
  965. /// <returns></returns>
  966. public static string GetJoxt(int num, bool istyle = true)
  967. {
  968. List<int> kjh = GetNumList(num);
  969. StringBuilder result = new StringBuilder();
  970. for (int i = 0; i < kjh.Count; i++)
  971. {
  972. if (istyle)
  973. {
  974. if (GetJo(kjh[i]) == 0)
  975. result.Append("<span class=\"wz3\">偶</span>");
  976. else
  977. result.Append("<span class=\"wz4\">奇</span>");
  978. }
  979. else
  980. {
  981. if (GetJo(kjh[i]) == 0)
  982. result.Append("偶");
  983. else
  984. result.Append("奇");
  985. }
  986. }
  987. return result.ToString();
  988. }
  989. /// <summary>
  990. /// 奇偶形态
  991. /// </summary>
  992. /// <param name="num"></param>
  993. /// <param name="istyle"></param>
  994. /// <returns></returns>
  995. public static string GetJoxt(List<int> kjh, bool istyle = true)
  996. {
  997. StringBuilder result = new StringBuilder();
  998. for (int i = 0; i < kjh.Count; i++)
  999. {
  1000. if (istyle)
  1001. {
  1002. if (GetJo(kjh[i]) == 0)
  1003. result.Append("<span class=\"wz3\">偶</span>");
  1004. else
  1005. result.Append("<span class=\"wz4\">奇</span>");
  1006. }
  1007. else
  1008. {
  1009. if (GetJo(kjh[i]) == 0)
  1010. result.Append("偶");
  1011. else
  1012. result.Append("奇");
  1013. }
  1014. }
  1015. return result.ToString();
  1016. }
  1017. /// <summary>
  1018. /// 返回大乐透后区大小形态,必顺序传入参数
  1019. /// </summary>
  1020. /// <param name="n6"></param>
  1021. /// <param name="n7"></param>
  1022. /// <returns></returns>
  1023. public static string GetDltHqJoxt(int n6, int n7)
  1024. {
  1025. string n6jo = "奇";
  1026. string n7jo = "奇";
  1027. if (n6 % 2 == 0)
  1028. n6jo = "偶";
  1029. if (n7 % 2 == 0)
  1030. n7jo = "偶";
  1031. return (n6jo + n7jo).ToString().Trim();
  1032. }
  1033. #endregion
  1034. #region 重号/连号个数/连号对数
  1035. /// <summary>
  1036. /// 通用的
  1037. /// 计算重号个数
  1038. /// </summary>
  1039. /// <param name="kjh1"></param>
  1040. /// <param name="kjh2"></param>
  1041. /// <returns></returns>
  1042. public static int GetChCount(List<int> kjh1, List<int> kjh2)
  1043. {
  1044. return kjh1.Intersect(kjh2).ToList().Count;
  1045. }
  1046. /// <summary>
  1047. /// 广东11选5连号计算
  1048. /// </summary>
  1049. /// <param name="kjh"></param>
  1050. /// <returns></returns>
  1051. public static int GetGd11x5LhCount(List<int> _kjh)
  1052. {
  1053. int c = 0;
  1054. List<int> kjh = new List<int>(_kjh);
  1055. if (kjh != null && kjh.Count > 0)
  1056. {
  1057. kjh.Sort();
  1058. for (int i = 0; i < kjh.Count; i++)
  1059. {
  1060. if (i > 0 && (kjh[i] - kjh[i - 1] == 1))
  1061. c++;
  1062. }
  1063. if (kjh[kjh.Count - 1] - kjh[0] == 10)
  1064. c++;
  1065. if (c > 0)
  1066. c = c + 1;
  1067. }
  1068. return c;
  1069. }
  1070. public static int GetGd11x5LhDsCount(List<int> _kjh)
  1071. {
  1072. int c = 0;
  1073. List<int> kjh = new List<int>(_kjh);
  1074. if (kjh.Count > 0)
  1075. {
  1076. kjh.Sort();
  1077. for (int i = 0; i < kjh.Count; i++)
  1078. {
  1079. if (i > 0 && (kjh[i] - kjh[i - 1]) == 1)
  1080. c++;
  1081. }
  1082. if (kjh[kjh.Count - 1] - kjh[0] == 10)
  1083. c++;
  1084. }
  1085. return c;
  1086. }
  1087. /// <summary>
  1088. /// 广东11选5前三形态
  1089. /// </summary>
  1090. /// <param name="kjh"></param>
  1091. /// <returns></returns>
  1092. public static int GetGd11x5Xt(List<int> kjh)
  1093. {
  1094. int c = 0;
  1095. if (kjh != null && kjh.Count > 0)
  1096. {
  1097. if (kjh[0] < kjh[1] && kjh[1] < kjh[2])
  1098. c = 1;
  1099. else if (kjh[0] > kjh[1] && kjh[1] > kjh[2])
  1100. c = 2;
  1101. else if (kjh[1] > kjh[0] && kjh[1] > kjh[2])
  1102. c = 3;
  1103. else if (kjh[0] > kjh[1] && kjh[1] < kjh[2])
  1104. c = 4;
  1105. }
  1106. return c;
  1107. }
  1108. /// <summary>
  1109. /// 通用的
  1110. /// 计算连号个数
  1111. /// </summary>
  1112. /// <param name="kjh"></param>
  1113. /// <returns></returns>
  1114. public static int GetLhCount(List<int> _kjh)
  1115. {
  1116. int c = 0;
  1117. List<int> kjh = new List<int>(_kjh);
  1118. if (kjh != null && kjh.Count > 0)
  1119. {
  1120. kjh.Sort();
  1121. for (int i = 0; i < kjh.Count; i++)
  1122. {
  1123. if (i > 0 && (kjh[i] - kjh[i - 1]) == 1)
  1124. c++;
  1125. }
  1126. if (c > 0)
  1127. c = c + 1;
  1128. }
  1129. return c;
  1130. }
  1131. /// <summary>
  1132. /// 通用的
  1133. /// 计算连号个数--高频-新的连号数统计
  1134. /// </summary>
  1135. /// <param name="kjh"></param>
  1136. /// <returns></returns>
  1137. public static Dictionary<int, int> GetLhCountGp(List<int> _kjh)
  1138. {
  1139. Dictionary<int, int> dic = new Dictionary<int, int>();
  1140. List<int> kjh = new List<int>(_kjh);
  1141. if (kjh != null && kjh.Count > 0)
  1142. {
  1143. kjh.Sort();
  1144. for (int i = 0; i < kjh.Count; i++)
  1145. {
  1146. if (i > 0 && (kjh[i] - kjh[i - 1]) == 1)
  1147. {
  1148. if (dic.Keys.Contains(i - 1))
  1149. {
  1150. dic.Add(i, dic[i - 1] + 1);
  1151. dic.Remove(i - 1);
  1152. }
  1153. else
  1154. {
  1155. dic.Add(i, 2);//第i个位置2连
  1156. }
  1157. }
  1158. }
  1159. }
  1160. if (dic.Count == 0)
  1161. dic.Add(0, 0);//零连号,无连号
  1162. return dic;
  1163. }
  1164. /// <summary>
  1165. /// 连号对数
  1166. /// </summary>
  1167. /// <param name="kjh"></param>
  1168. /// <returns></returns>
  1169. public static int GetLhDsCount(List<int> _kjh)
  1170. {
  1171. int c = 0;
  1172. List<int> kjh = new List<int>(_kjh);
  1173. if (kjh.Count > 0)
  1174. {
  1175. kjh.Sort();
  1176. for (int i = 0; i < kjh.Count; i++)
  1177. {
  1178. if (i > 0 && (kjh[i] - kjh[i - 1]) == 1)
  1179. c++;
  1180. }
  1181. }
  1182. return c;
  1183. }
  1184. /// <summary>
  1185. /// 双色球连号的对数
  1186. /// </summary>
  1187. /// <param name="kjh"></param>
  1188. /// <returns></returns>
  1189. public static int GetSsqRedLhCount(string[] os)
  1190. {
  1191. List<int> kjh = new List<int>();
  1192. if (os != null && os.Length > 0)
  1193. {
  1194. for (int i = 0; i < os.Length; i++)
  1195. {
  1196. kjh.Add(TypeConverter.StrToInt(os[i], 0));
  1197. }
  1198. }
  1199. return GetLhDsCount(kjh);
  1200. }
  1201. #endregion
  1202. /// <summary>
  1203. /// 求双色球红球的和值
  1204. /// </summary>
  1205. /// <param name="kjh"></param>
  1206. /// <returns></returns>
  1207. public static int GetSsqRedHz(string[] kjh)
  1208. {
  1209. int hz = 0;
  1210. if (kjh != null && kjh.Length > 0)
  1211. {
  1212. for (int i = 0; i < kjh.Length; i++)
  1213. {
  1214. hz = hz + TypeConverter.StrToInt(kjh[i], 0);
  1215. }
  1216. }
  1217. return hz;
  1218. }
  1219. /// <summary>
  1220. /// 返回某蓝球是否属于某个区间
  1221. /// </summary>
  1222. /// <param name="qj"></param>
  1223. /// <param name="val"></param>
  1224. /// <returns></returns>
  1225. public static bool GetSsqBlueSq(int qj, int val)
  1226. {
  1227. bool flag = false;
  1228. List<int> b1 = new List<int> { 1, 2, 3, 4 };
  1229. List<int> b2 = new List<int> { 5, 6, 7, 8 };
  1230. List<int> b3 = new List<int> { 9, 10, 11, 12 };
  1231. List<int> b4 = new List<int> { 13, 14, 15, 16 };
  1232. if (qj == 1)
  1233. return b1.Contains(val);
  1234. if (qj == 2)
  1235. return b2.Contains(val);
  1236. if (qj == 3)
  1237. return b3.Contains(val);
  1238. if (qj == 4)
  1239. return b4.Contains(val);
  1240. return flag;
  1241. }
  1242. /// <summary>
  1243. /// 得到距离开奖的时间差
  1244. /// </summary>
  1245. /// <param name="nowtime">现在时间</param>
  1246. /// <param name="kjtime">开奖时间</param>
  1247. /// <param name="days">过期时间 增加的天数</param>
  1248. /// <returns>时间差</returns>
  1249. public static TimeSpan KjTimeDiff(DateTime nowtime, DateTime kjtime)
  1250. {
  1251. TimeSpan ts = new TimeSpan();
  1252. if (kjtime > nowtime)
  1253. {
  1254. TimeSpan ts1 = new TimeSpan(nowtime.Ticks);
  1255. TimeSpan ts2 = new TimeSpan(kjtime.Ticks);
  1256. ts = ts1.Subtract(ts2).Duration();
  1257. }
  1258. else
  1259. {
  1260. TimeSpan ts1 = new TimeSpan(nowtime.Ticks);
  1261. TimeSpan ts2 = new TimeSpan(nowtime.Ticks);
  1262. ts = ts1.Subtract(ts2).Duration();
  1263. }
  1264. return ts;
  1265. }
  1266. /// <summary>
  1267. /// 将日期转换成星期几
  1268. /// </summary>
  1269. /// <param name="date"></param>
  1270. /// <returns></returns>
  1271. public static string GetWday(DateTime date)
  1272. {
  1273. DateTime dt = date;
  1274. string wday = "";
  1275. switch (dt.DayOfWeek)
  1276. {
  1277. case DayOfWeek.Monday:
  1278. wday = "星期一"; break;
  1279. case DayOfWeek.Tuesday:
  1280. wday = "星期二"; break;
  1281. case DayOfWeek.Wednesday:
  1282. wday = "星期三"; break;
  1283. case DayOfWeek.Thursday:
  1284. wday = "星期四"; break;
  1285. case DayOfWeek.Friday:
  1286. wday = "星期五"; break;
  1287. case DayOfWeek.Saturday:
  1288. wday = "星期六"; break;
  1289. case DayOfWeek.Sunday:
  1290. wday = "星期日"; break;
  1291. }
  1292. return wday;
  1293. }
  1294. /// <summary>
  1295. /// 计算出双色球红球中尾数不相同的个数
  1296. /// </summary>
  1297. /// <param name="kjh"></param>
  1298. /// <returns></returns>
  1299. public static int GetSsqRedWsCount(string[] os)
  1300. {
  1301. List<int> kjh = new List<int>();
  1302. if (os != null && os.Length > 0)
  1303. {
  1304. for (int i = 0; i < os.Length; i++)
  1305. {
  1306. kjh.Add(TypeConverter.StrToInt(os[i], 0));
  1307. }
  1308. }
  1309. List<int> wss = new List<int>();
  1310. for (int i = 0; i < kjh.Count; i++)
  1311. {
  1312. int ws = GetHw(kjh[i]);
  1313. if (!wss.Contains(ws))
  1314. wss.Add(ws);
  1315. }
  1316. return wss.Count;
  1317. }
  1318. /// <summary>
  1319. /// 判断两个List int 列表是否有交集数据
  1320. /// </summary>
  1321. /// <param name="list1"></param>
  1322. /// <param name="list2"></param>
  1323. /// <returns></returns>
  1324. public static bool GetNumMix(List<int> list1, List<int> list2)
  1325. {
  1326. return list1.Intersect(list2).ToList().Count > 0 ? true : false;
  1327. }
  1328. #region 大乐透相关方法
  1329. /// <summary>
  1330. /// 返回大乐透后区奇偶形态,必顺序传入参数
  1331. /// </summary>
  1332. /// <param name="n6"></param>
  1333. /// <param name="n7"></param>
  1334. /// <returns></returns>
  1335. public static string GetDltHqDxxt(int n6, int n7)
  1336. {
  1337. string n6dx = "小";
  1338. string n7dx = "小";
  1339. if (n6 > 6)
  1340. n6dx = "大";
  1341. if (n7 > 6)
  1342. n7dx = "大";
  1343. return (n6dx + n7dx).ToString().Trim();
  1344. }
  1345. #endregion
  1346. /// <summary>
  1347. /// 返回某个组三号码里的相同号码
  1348. /// </summary>
  1349. /// <param name="kjh"></param>
  1350. /// <returns></returns>
  1351. public static int GetZ3Num(int kjh)
  1352. {
  1353. string result = string.Empty;
  1354. List<int> k = GetNumList(kjh);
  1355. int n = 0;
  1356. if (k[0] == k[1])
  1357. return k[0];
  1358. if (k[1] == k[2])
  1359. return k[1];
  1360. if (k[0] == k[2])
  1361. return k[0];
  1362. return n;
  1363. }
  1364. /// <summary>
  1365. /// 返回开个开奖号组三形态
  1366. /// AAB
  1367. /// ABA
  1368. /// BAA
  1369. /// </summary>
  1370. /// <param name="kjh"></param>
  1371. /// <returns></returns>
  1372. public static string GetZ3Xt(int kjh)
  1373. {
  1374. string result = string.Empty;
  1375. List<int> k = GetNumList(kjh);
  1376. if (k != null)
  1377. {
  1378. if (k[0] == k[1])
  1379. result = "AAB";
  1380. if (k[1] == k[2])
  1381. result = "BAA";
  1382. if (k[0] == k[2])
  1383. result = "ABA";
  1384. }
  1385. return result;
  1386. }
  1387. /// <summary>
  1388. /// 试机号和开奖号的比较
  1389. /// 组选同号 个数
  1390. /// </summary>
  1391. /// <param name="sjh"></param>
  1392. /// <param name="kjh"></param>
  1393. /// <returns>0 1 2 3</returns>
  1394. public static int GetZxth(int sjh, int kjh)
  1395. {
  1396. int result = 0;
  1397. List<int> s = GetNumList(sjh);
  1398. List<int> k = GetNumList(kjh);
  1399. for (int i = 0; i < s.Count; i++)
  1400. {
  1401. if (k.Contains(s[i]))
  1402. result++;
  1403. }
  1404. return result;
  1405. }
  1406. /// <summary>
  1407. /// 试机号和开奖号的比较
  1408. /// 组选同号 个数
  1409. /// </summary>
  1410. /// <param name="sjh"></param>
  1411. /// <param name="kjh"></param>
  1412. /// <returns>0 1 2 3</returns>
  1413. public static int GetZxth(List<int> sjh, List<int> kjh)
  1414. {
  1415. int result = 0;
  1416. for (int i = 0; i < sjh.Count; i++)
  1417. {
  1418. if (kjh.Contains(sjh[i]))
  1419. result++;
  1420. }
  1421. return result;
  1422. }
  1423. /// <summary>
  1424. /// 试机号和开奖号的
  1425. /// 直选同号比较
  1426. /// </summary>
  1427. /// <param name="sjh"></param>
  1428. /// <param name="kjh"></param>
  1429. /// <returns>返回3个长度的list,确认是否同号</returns>
  1430. public static List<bool> GetZxtw(int sjh, int kjh)
  1431. {
  1432. List<bool> list = new List<bool> { false, false, false };
  1433. List<int> s = GetNumList(sjh);
  1434. List<int> k = GetNumList(kjh);
  1435. for (int i = 0; i < s.Count; i++)
  1436. {
  1437. if (k[i] == s[i])
  1438. list[i] = true;
  1439. }
  1440. return list;
  1441. }
  1442. /// <summary>
  1443. /// 试机号和开奖号的
  1444. /// 直选同号比较
  1445. /// </summary>
  1446. /// <param name="sjh"></param>
  1447. /// <param name="kjh"></param>
  1448. /// <returns>返回3个长度的list,确认是否同号</returns>
  1449. public static List<bool> GetZxtw(List<int> sjh, List<int> kjh)
  1450. {
  1451. List<bool> list = new List<bool> { false, false, false };
  1452. for (int i = 0; i < sjh.Count; i++)
  1453. {
  1454. if (kjh[i] == sjh[i])
  1455. list[i] = true;
  1456. }
  1457. return list;
  1458. }
  1459. /// <summary>
  1460. /// 把某个数字拆分成1 2 3 的形式
  1461. /// 如980成9 8 0
  1462. /// </summary>
  1463. /// <param name="num"></param>
  1464. /// <returns></returns>
  1465. public static List<int> GetNumList(int num)
  1466. {
  1467. //359
  1468. List<int> nums = new List<int>();
  1469. if (num < 0)
  1470. {
  1471. nums.Add(-1);
  1472. nums.Add(-1);
  1473. nums.Add(-1);
  1474. return nums;
  1475. }
  1476. int b = num / 100;
  1477. int s = (num - b * 100) / 10;
  1478. int g = num - (b * 100 + s * 10);
  1479. nums.Add(b);
  1480. nums.Add(s);
  1481. nums.Add(g);
  1482. return nums;
  1483. }
  1484. /// <summary>
  1485. /// 15x5是否4连号..
  1486. /// 1为true 0为false
  1487. /// </summary>
  1488. /// <param name="kjh"></param>
  1489. /// <returns></returns>
  1490. public static int GetHd15x5_4lh(List<int> _kjh)
  1491. {
  1492. int c = 0;
  1493. List<int> kjh = new List<int>(_kjh);
  1494. if (kjh != null && kjh.Count > 0)
  1495. {
  1496. kjh.Sort();
  1497. for (int i = 0; i < kjh.Count; i++)
  1498. {
  1499. if (i > 0 && (kjh[i] - kjh[i - 1]) == 1 && Math.Abs(kjh[i - 1] - kjh[i]) == 1)
  1500. c++;
  1501. else if (c < 3)
  1502. c = 0;
  1503. }
  1504. }
  1505. if (c >= 3)
  1506. return 1;
  1507. return 0;
  1508. }
  1509. /// <summary>
  1510. /// 22x5是否3连号..
  1511. /// 1为true 0为false
  1512. /// </summary>
  1513. /// <param name="kjh"></param>
  1514. /// <returns></returns>
  1515. public static int GetIs3lh(List<int> _kjh)
  1516. {
  1517. int c = 0;
  1518. List<int> kjh = new List<int>(_kjh);
  1519. if (kjh != null && kjh.Count > 0)
  1520. {
  1521. kjh.Sort();
  1522. for (int i = 0; i < kjh.Count; i++)
  1523. {
  1524. if (i > 0 && (kjh[i] - kjh[i - 1]) == 1 && Math.Abs(kjh[i - 1] - kjh[i]) == 1)
  1525. c++;
  1526. else if (c < 3)
  1527. c = 0;
  1528. }
  1529. }
  1530. if (c >= 2)
  1531. return 1;
  1532. return 0;
  1533. }
  1534. /// <summary>
  1535. /// 某个开奖号是否连号
  1536. /// 145 905这种
  1537. /// </summary>
  1538. /// <param name="kjh"></param>
  1539. /// <returns></returns>
  1540. public static string GetLh(int num)
  1541. {
  1542. string result = "否";
  1543. List<int> kds = GetKdList(num);
  1544. if (kds != null && kds.Count > 0)
  1545. {
  1546. for (int i = 0; i < kds.Count; i++)
  1547. {
  1548. if (kds[i] == 1 || kds[i] == 9)
  1549. {
  1550. result = "是";
  1551. return result;
  1552. }
  1553. }
  1554. }
  1555. return result;
  1556. }
  1557. /// <summary>
  1558. /// 某个开奖号是否是半顺子、顺子
  1559. /// 012 045这种
  1560. /// </summary>
  1561. /// <param name="num"></param>
  1562. /// <returns></returns>
  1563. public static string GetSZ(int num)
  1564. {
  1565. string result = "否";
  1566. List<int> kds = GetKdList(num);
  1567. if (kds != null && kds.Count > 0)
  1568. {
  1569. if (kds[0] == 2 && kds[1] == 1 && kds[2] == 1)
  1570. {
  1571. result = "顺";
  1572. return result;
  1573. }
  1574. for (int i = 0; i < kds.Count; i++)
  1575. {
  1576. if (kds[i] == 1)
  1577. {
  1578. result = "半";
  1579. return result;
  1580. }
  1581. }
  1582. }
  1583. return result;
  1584. }
  1585. /// <summary>
  1586. /// 判断是否有重号,适用3D
  1587. /// </summary>
  1588. /// <param name="kjh1"></param>
  1589. /// <param name="kjh2"></param>
  1590. /// <returns></returns>
  1591. public static string GetCh(int num1, int num2)
  1592. {
  1593. string result = "否";
  1594. List<int> kjh1 = GetNumList(num1);
  1595. List<int> kjh2 = GetNumList(num2);
  1596. if (kjh1.Intersect(kjh2).ToList().Count > 0)
  1597. result = "是";
  1598. return result;
  1599. }
  1600. /// <summary>
  1601. /// 返回开奖号对应的组选二码组合
  1602. ///
  1603. /// </summary>
  1604. /// <param name="num"></param>
  1605. /// <returns></returns>
  1606. public static List<string> Get2m(List<int> _kjh)
  1607. {
  1608. List<string> list = new List<string>();
  1609. List<int> kjh = new List<int>(_kjh);
  1610. kjh.Sort();
  1611. list.Add(kjh[0].ToString() + kjh[1].ToString());
  1612. list.Add(kjh[0].ToString() + kjh[2].ToString());
  1613. list.Add(kjh[1].ToString() + kjh[2].ToString());
  1614. return list;
  1615. }
  1616. /// <summary>
  1617. /// 返回某个开奖号码的区段
  1618. /// 返回值 a b c d
  1619. /// a:000~249
  1620. /// b:250~499
  1621. /// c:500~749
  1622. /// d:750~999
  1623. /// </summary>
  1624. /// <param name="kjh"></param>
  1625. /// <returns></returns>
  1626. public static string GetQd(int kjh)
  1627. {
  1628. string result = string.Empty;
  1629. if (kjh >= 0 && kjh < 250)
  1630. result = "A";
  1631. if (kjh >= 250 && kjh < 500)
  1632. result = "B";
  1633. if (kjh >= 500 && kjh < 750)
  1634. result = "C";
  1635. if (kjh >= 750 && kjh < 1000)
  1636. result = "D";
  1637. return result;
  1638. }
  1639. /// <summary>
  1640. /// 返回某个开奖号的
  1641. /// 升降序组合的情况
  1642. /// </summary>
  1643. /// <param name="kjh"></param>
  1644. /// <returns></returns>
  1645. public static string GetSjxzh(List<int> nums)
  1646. {
  1647. string result = string.Empty;
  1648. if (nums[0] == nums[1] && nums[1] == nums[2]) //豹子
  1649. {
  1650. result = "平";
  1651. return result;
  1652. }
  1653. if (nums[0] > nums[1] && nums[1] > nums[2])
  1654. {
  1655. result = "降";
  1656. return result;
  1657. }
  1658. if (nums[0] < nums[1] && nums[1] < nums[2])
  1659. {
  1660. result = "升";
  1661. return result;
  1662. }
  1663. if (nums[0] > nums[1] && nums[1] < nums[2])
  1664. {
  1665. result = "凹";
  1666. return result;
  1667. }
  1668. if (nums[0] < nums[1] && nums[1] > nums[2])
  1669. {
  1670. result = "凸";
  1671. return result;
  1672. }
  1673. if (nums[0] == nums[1] || nums[1] == nums[2] || nums[0] == nums[2]) //组三
  1674. {
  1675. result = "偏";
  1676. return result;
  1677. }
  1678. return result;
  1679. }
  1680. /// <summary>
  1681. /// 计算出某个跨度值的数据统计
  1682. /// list[0] = 总数
  1683. /// list[1] = 组三数
  1684. /// list[2] = 组六数
  1685. /// list[3] = 豹子数
  1686. /// </summary>
  1687. /// <param name="kd"></param>
  1688. /// <returns></returns>
  1689. public static List<int> GetKdCount(int kd, List<int> data)
  1690. {
  1691. List<int> list = new List<int>();
  1692. List<int> temp = new List<int>();
  1693. list.Add(0);
  1694. list.Add(0);
  1695. list.Add(0);
  1696. list.Add(0);
  1697. for (int i = 0; i < data.Count; i++)
  1698. {
  1699. if (GetKd(data[i]) == kd)
  1700. temp.Add(data[i]);
  1701. }
  1702. list[0] = temp.Count;
  1703. for (int i = 0; i < temp.Count; i++)
  1704. {
  1705. if (GetZxxt(temp[i]) == 3)
  1706. list[1]++;
  1707. if (GetZxxt(temp[i]) == 6)
  1708. list[2]++;
  1709. if (GetZxxt(temp[i]) == 0)
  1710. list[3]++;
  1711. }
  1712. return list;
  1713. }
  1714. /// <summary>
  1715. /// 计算出某个和值号的数据统计
  1716. /// list[0] = 总数
  1717. /// list[1] = 组三数
  1718. /// list[2] = 组六数
  1719. /// list[3] = 豹子数
  1720. /// </summary>
  1721. /// <param name="hz"></param>
  1722. /// <returns></returns>
  1723. public static List<int> GetHzCount(int hz, List<int> data)
  1724. {
  1725. List<int> list = new List<int>();
  1726. List<int> temp = new List<int>();
  1727. list.Add(0);
  1728. list.Add(0);
  1729. list.Add(0);
  1730. list.Add(0);
  1731. for (int i = 0; i < data.Count; i++)
  1732. {
  1733. if (GetHz(data[i]) == hz)
  1734. temp.Add(data[i]);
  1735. }
  1736. list[0] = temp.Count;
  1737. for (int i = 0; i < temp.Count; i++)
  1738. {
  1739. if (GetZxxt(temp[i]) == 3)
  1740. list[1]++;
  1741. if (GetZxxt(temp[i]) == 6)
  1742. list[2]++;
  1743. if (GetZxxt(temp[i]) == 0)
  1744. list[3]++;
  1745. }
  1746. return list;
  1747. }
  1748. /// <summary>
  1749. /// 返回某个3位数号码的组选形态
  1750. /// </summary>
  1751. /// <param name="num">158</param>
  1752. /// <returns></returns>
  1753. public static int GetZxxt(int num)
  1754. {
  1755. List<int> temp = GetNumList(num);
  1756. return GetZxxt(temp);
  1757. }
  1758. /// <summary>
  1759. /// 组三/组6形态
  1760. /// </summary>
  1761. /// <param name="nums"></param>
  1762. /// <returns></returns>
  1763. public static int GetZxxt(List<int> l)
  1764. {
  1765. int xt = 0;
  1766. List<int> temp = new List<int>(l);
  1767. if (temp[0] == temp[1] && temp[1] == temp[2] && temp[0] == temp[2])
  1768. {
  1769. xt = 0;
  1770. return xt;
  1771. }
  1772. if (temp[0] == temp[1] || temp[1] == temp[2] || temp[0] == temp[2])
  1773. {
  1774. xt = 3;
  1775. return xt;
  1776. }
  1777. if (temp[0] != temp[1] && temp[1] != temp[2] && temp[0] != temp[2])
  1778. {
  1779. xt = 6;
  1780. return xt;
  1781. }
  1782. return xt;
  1783. }
  1784. public static int GetKd(List<int> kjh)
  1785. {
  1786. List<int> _kjh = new List<int>(kjh);
  1787. _kjh.Sort();
  1788. return Math.Abs(_kjh[0] - _kjh[_kjh.Count - 1]);
  1789. }
  1790. /// <summary>
  1791. /// 根据开奖号获取最大跨度值
  1792. /// </summary>
  1793. /// <param name="kjh">List形式的开奖号</param>
  1794. /// <returns></returns>
  1795. public static int GetKd(int num)
  1796. {
  1797. List<int> kjh = GetNumList(num);
  1798. kjh.Sort();
  1799. return Math.Abs(kjh[0] - kjh[kjh.Count - 1]);
  1800. }
  1801. /// <summary>
  1802. /// 排序5跨度计算
  1803. /// </summary>
  1804. /// <param name="kjh"></param>
  1805. /// <returns></returns>
  1806. public static List<int> GetP5KdList(List<int> _kjh)
  1807. {
  1808. List<int> kjh = new List<int>(_kjh);
  1809. kjh.Sort();
  1810. List<int> kds = new List<int>();
  1811. for (int i = 0; i < kjh.Count; i++)
  1812. {
  1813. if (i > 0)
  1814. kds.Add(Math.Abs(kjh[i] - kjh[i - 1]));
  1815. }
  1816. return kds;
  1817. }
  1818. /// <summary>
  1819. /// 取三个跨度 组选
  1820. /// </summary>
  1821. /// <param name="kjh"></param>
  1822. /// <returns></returns>
  1823. public static List<int> GetKdList(List<int> _kjh)
  1824. {
  1825. List<int> kds = new List<int>();
  1826. List<int> kjh = new List<int>(_kjh);
  1827. kjh.Sort();
  1828. kds.Add(Math.Abs(kjh[0] - kjh[kjh.Count - 1])); //最大跨度
  1829. kds.Add(Math.Abs(kjh[0] - kjh[1])); //1跨
  1830. kds.Add(Math.Abs(kjh[1] - kjh[kjh.Count - 1])); //2跨
  1831. return kds;
  1832. }
  1833. /// <summary>
  1834. /// 取三个跨度 组选
  1835. /// </summary>
  1836. /// <param name="kjh"></param>
  1837. /// <returns></returns>
  1838. public static List<int> GetKdList(int num)
  1839. {
  1840. List<int> kjh = GetNumList(num);
  1841. List<int> kds = new List<int>();
  1842. kjh.Sort();
  1843. kds.Add(Math.Abs(kjh[0] - kjh[kjh.Count - 1])); //最大跨度
  1844. kds.Add(Math.Abs(kjh[0] - kjh[1])); //1跨
  1845. kds.Add(Math.Abs(kjh[1] - kjh[kjh.Count - 1])); //2跨
  1846. return kds;
  1847. }
  1848. /// <summary>
  1849. /// 取百、十、个跨度 直选 [0,1,2]
  1850. /// </summary>
  1851. /// <param name="kjh"></param>
  1852. /// <returns></returns>
  1853. public static List<int> GetBSGKdList(int num)
  1854. {
  1855. List<int> kjh = GetNumList(num);
  1856. List<int> kds = new List<int>();
  1857. kds.Add(Math.Abs(kjh[0] - kjh[1])); //百十
  1858. kds.Add(Math.Abs(kjh[1] - kjh[2])); //十个
  1859. kds.Add(Math.Abs(kjh[0] - kjh[2])); //百个
  1860. return kds;
  1861. }
  1862. /// <summary>
  1863. /// 根据开奖号获取和值
  1864. /// </summary>
  1865. /// <param name="kjh">int形式的开奖号</param>
  1866. /// <returns></returns>
  1867. public static int GetHz(int kjh)
  1868. {
  1869. List<int> k = GetNumList(kjh);
  1870. k.Sort();
  1871. return k[0] + k[1] + k[2];
  1872. }
  1873. /// <summary>
  1874. /// 和值
  1875. /// </summary>
  1876. /// <param name="k"></param>
  1877. /// <returns></returns>
  1878. public static int GetHz(List<int> k)
  1879. {
  1880. return k[0] + k[1] + k[2];
  1881. }
  1882. /// <summary>
  1883. /// 通用方法.返回012路,指定路数的个数
  1884. /// </summary>
  1885. /// <param name="list"></param>
  1886. /// <param name="ls"></param>
  1887. /// <returns></returns>
  1888. public static int Get012Gs(List<int> list, int ls)
  1889. {
  1890. int n = 0;
  1891. for (int i = 0; i < list.Count; i++)
  1892. {
  1893. if (Get012(list[i]) == ls)
  1894. n++;
  1895. }
  1896. return n;
  1897. }
  1898. #region P5一些方法
  1899. /// <summary>
  1900. /// p5号码数组
  1901. /// </summary>
  1902. /// <param name="num"></param>
  1903. /// <returns></returns>
  1904. public static List<int> GetP5NumList(string num)
  1905. {
  1906. List<int> list = new List<int>();
  1907. if (num.Trim().Length != 5)
  1908. return list;
  1909. for (int i = 0; i < num.Length; i++)
  1910. {
  1911. list.Add(TypeConverter.StrToInt(num.Substring(i, 1), 0));
  1912. }
  1913. return list;
  1914. }
  1915. /// <summary>
  1916. /// p5和值
  1917. /// </summary>
  1918. /// <param name="num"></param>
  1919. /// <returns></returns>
  1920. public static int GetP5Hz(string num)
  1921. {
  1922. List<int> list = GetP5NumList(num);
  1923. int hz = 0;
  1924. if (list != null && list.Count > 0)
  1925. {
  1926. for (int i = 0; i < list.Count; i++)
  1927. {
  1928. hz = hz + list[i];
  1929. }
  1930. }
  1931. return hz;
  1932. }
  1933. /// <summary>
  1934. /// 排列5的连号组数
  1935. /// </summary>
  1936. /// <param name="num"></param>
  1937. /// <returns></returns>
  1938. public static int GetP5LhCount(string num)
  1939. {
  1940. List<int> list = GetP5NumList(num);
  1941. int c = 0;
  1942. if (list != null && list.Count > 0)
  1943. {
  1944. for (int i = 0; i < list.Count; i++)
  1945. {
  1946. if (i > 0 && (list[i] - list[i - 1]) == 1)
  1947. c++;
  1948. }
  1949. }
  1950. return c;
  1951. }
  1952. #endregion
  1953. #region P7的一些方法
  1954. /// <summary>
  1955. /// p7号码数组
  1956. /// </summary>
  1957. /// <param name="num"></param>
  1958. /// <returns></returns>
  1959. public static List<int> GetP7NumList(string num)
  1960. {
  1961. List<int> list = new List<int>();
  1962. if (num.Trim().Length != 7)
  1963. return list;
  1964. for (int i = 0; i < num.Length; i++)
  1965. {
  1966. list.Add(TypeConverter.StrToInt(num.Substring(i, 1), 0));
  1967. }
  1968. return list;
  1969. }
  1970. /// <summary>
  1971. /// p7和值
  1972. /// </summary>
  1973. /// <param name="num"></param>
  1974. /// <returns></returns>
  1975. public static int GetP7Hz(string num)
  1976. {
  1977. List<int> list = GetP7NumList(num);
  1978. int hz = 0;
  1979. if (list != null && list.Count > 0)
  1980. {
  1981. for (int i = 0; i < list.Count; i++)
  1982. {
  1983. hz = hz + list[i];
  1984. }
  1985. }
  1986. return hz;
  1987. }
  1988. /// <summary>
  1989. /// 排列7的连号组数
  1990. /// </summary>
  1991. /// <param name="num"></param>
  1992. /// <returns></returns>
  1993. public static int GetP7LhCount(string num)
  1994. {
  1995. List<int> list = GetP7NumList(num);
  1996. int c = 0;
  1997. if (list != null && list.Count > 0)
  1998. {
  1999. for (int i = 0; i < list.Count; i++)
  2000. {
  2001. if (i > 0 && (list[i] - list[i - 1]) == 1)
  2002. c++;
  2003. }
  2004. }
  2005. return c;
  2006. }
  2007. /// <summary>
  2008. /// 排列7相同号码的个数
  2009. /// </summary>
  2010. /// <param name="num"></param>
  2011. /// <returns></returns>
  2012. public static int GetP7ThCount(string num)
  2013. {
  2014. List<int> list = GetP7NumList(num);
  2015. List<int> th = new List<int>();
  2016. List<int> temp = new List<int>();
  2017. foreach (int i in list)
  2018. {
  2019. if (!th.Contains(i))
  2020. {
  2021. th.Add(i);
  2022. }
  2023. else
  2024. {
  2025. temp.Add(i);
  2026. }
  2027. }
  2028. list.RemoveAll(o =>
  2029. {
  2030. if (temp.Contains(o))
  2031. return true;
  2032. else
  2033. return false;
  2034. });
  2035. return 7 - list.Count();
  2036. }
  2037. #endregion
  2038. #region 东方61的一些方法
  2039. /// <summary>
  2040. /// df61
  2041. /// </summary>
  2042. /// <param name="num"></param>
  2043. /// <returns></returns>
  2044. public static List<int> GetDf61NumList(string num)
  2045. {
  2046. List<int> list = new List<int>();
  2047. if (num.Trim().Length != 6)
  2048. return list;
  2049. for (int i = 0; i < num.Length; i++)
  2050. {
  2051. list.Add(TypeConverter.StrToInt(num.Substring(i, 1), 0));
  2052. }
  2053. return list;
  2054. }
  2055. /// <summary>
  2056. /// df61和值
  2057. /// </summary>
  2058. /// <param name="num"></param>
  2059. /// <returns></returns>
  2060. public static int GetDf61Hz(string num)
  2061. {
  2062. List<int> list = GetDf61NumList(num);
  2063. int hz = 0;
  2064. if (list != null && list.Count > 0)
  2065. {
  2066. for (int i = 0; i < list.Count; i++)
  2067. {
  2068. hz = hz + list[i];
  2069. }
  2070. }
  2071. return hz;
  2072. }
  2073. /// <summary>
  2074. /// df61的连号组数
  2075. /// </summary>
  2076. /// <param name="num"></param>
  2077. /// <returns></returns>
  2078. public static int GetDf61LhCount(string num)
  2079. {
  2080. List<int> list = GetDf61NumList(num);
  2081. int c = 0;
  2082. if (list != null && list.Count > 0)
  2083. {
  2084. for (int i = 0; i < list.Count; i++)
  2085. {
  2086. if (i > 0 && (list[i] - list[i - 1]) == 1)
  2087. c++;
  2088. }
  2089. }
  2090. return c;
  2091. }
  2092. /// <summary>
  2093. /// df61相同号码的个数
  2094. /// </summary>
  2095. /// <param name="num"></param>
  2096. /// <returns></returns>
  2097. public static int GetDf61ThCount(string num)
  2098. {
  2099. List<int> list = GetDf61NumList(num);
  2100. List<int> th = new List<int>();
  2101. List<int> temp = new List<int>();
  2102. foreach (int i in list)
  2103. {
  2104. if (!th.Contains(i))
  2105. {
  2106. th.Add(i);
  2107. }
  2108. else
  2109. {
  2110. temp.Add(i);
  2111. }
  2112. }
  2113. list.RemoveAll(o =>
  2114. {
  2115. if (temp.Contains(o))
  2116. return true;
  2117. else
  2118. return false;
  2119. });
  2120. return 6 - list.Count();
  2121. }
  2122. #endregion
  2123. #region 浙江6+1
  2124. /// <summary>
  2125. /// zj61
  2126. /// </summary>
  2127. /// <param name="num"></param>
  2128. /// <returns></returns>
  2129. public static List<int> GetZj61NumList(string num)
  2130. {
  2131. List<int> list = new List<int>();
  2132. if (num.Trim().Length != 7)
  2133. return list;
  2134. for (int i = 0; i < num.Length; i++)
  2135. {
  2136. list.Add(TypeConverter.StrToInt(num.Substring(i, 1), 0));
  2137. }
  2138. return list;
  2139. }
  2140. /// <summary>
  2141. /// zj61和值
  2142. /// </summary>
  2143. /// <param name="num"></param>
  2144. /// <returns></returns>
  2145. public static int GetZj61Hz(string num)
  2146. {
  2147. List<int> list = GetZj61NumList(num);
  2148. int hz = 0;
  2149. if (list != null && list.Count > 0)
  2150. {
  2151. for (int i = 0; i < list.Count; i++)
  2152. {
  2153. hz = hz + list[i];
  2154. }
  2155. }
  2156. return hz;
  2157. }
  2158. /// <summary>
  2159. /// zj61的连号组数
  2160. /// </summary>
  2161. /// <param name="num"></param>
  2162. /// <returns></returns>
  2163. public static int GetZj61LhCount(string num)
  2164. {
  2165. List<int> list = GetZj61NumList(num);
  2166. int c = 0;
  2167. if (list != null && list.Count > 0)
  2168. {
  2169. for (int i = 0; i < list.Count; i++)
  2170. {
  2171. if (i > 0 && (list[i] - list[i - 1]) == 1)
  2172. c++;
  2173. }
  2174. }
  2175. return c;
  2176. }
  2177. /// <summary>
  2178. /// zj61最大相同号码的个数
  2179. /// </summary>
  2180. /// <param name="num"></param>
  2181. /// <returns></returns>
  2182. public static int GetZj61ThCount(string num)
  2183. {
  2184. List<int> list = GetZj61NumList(num);
  2185. List<int> th = new List<int>();
  2186. int[] temp = new int[10];
  2187. for (int i = 0; i < temp.Length; i++)
  2188. temp[i] = 0;
  2189. foreach (int i in list)
  2190. {
  2191. temp[i]++;
  2192. }
  2193. List<int> max = new List<int>();
  2194. for (int i = 0; i < temp.Length; i++)
  2195. {
  2196. max.Add(temp[i]);
  2197. }
  2198. return max.Max();
  2199. }
  2200. #endregion
  2201. /// <summary>
  2202. /// 根据和值返回和尾
  2203. /// </summary>
  2204. /// <param name="hz"></param>
  2205. /// <returns></returns>
  2206. public static int GetHw(int hz)
  2207. {
  2208. int hw = 0;
  2209. string s = hz.ToString();
  2210. if (s.Length == 4)
  2211. return TypeConverter.StrToInt(s.Substring(3, 1));
  2212. if (s.Length == 3)
  2213. return TypeConverter.StrToInt(s.Substring(2, 1));
  2214. if (s.Length == 2)
  2215. return TypeConverter.StrToInt(s.Substring(1, 1));
  2216. if (s.Length == 1)
  2217. return hz;
  2218. return hw;
  2219. }
  2220. /// <summary>
  2221. /// 开奖号的尾数和值
  2222. /// </summary>
  2223. /// <param name="kjh"></param>
  2224. /// <returns></returns>
  2225. public static int GetWshz(List<int> kjh)
  2226. {
  2227. int wshz = 0;
  2228. if (kjh != null && kjh.Count > 0)
  2229. {
  2230. for (int i = 0; i < kjh.Count; i++)
  2231. {
  2232. wshz = wshz + GetHw(kjh[i]);
  2233. }
  2234. }
  2235. return wshz;
  2236. }
  2237. /// <summary>
  2238. /// 号码中的最大奇数
  2239. /// </summary>
  2240. /// <param name="kjh"></param>
  2241. /// <returns></returns>
  2242. public static int GetMaxJs(List<int> kjh)
  2243. {
  2244. List<int> temp = new List<int>();
  2245. foreach (int i in kjh)
  2246. {
  2247. if (i % 2 != 0)
  2248. temp.Add(i);
  2249. }
  2250. if (temp.Count > 0)
  2251. return temp.Max();
  2252. else
  2253. return -1;
  2254. }
  2255. /// <summary>
  2256. /// 号码中的最小奇数
  2257. /// </summary>
  2258. /// <param name="kjh"></param>
  2259. /// <returns></returns>
  2260. public static int GetMinJs(List<int> kjh)
  2261. {
  2262. List<int> temp = new List<int>();
  2263. foreach (int i in kjh)
  2264. {
  2265. if (i % 2 != 0)
  2266. temp.Add(i);
  2267. }
  2268. if (temp.Count > 0)
  2269. return temp.Min();
  2270. else
  2271. return -1;
  2272. }
  2273. /// <summary>
  2274. /// 号码中的最大偶数
  2275. /// </summary>
  2276. /// <param name="kjh"></param>
  2277. /// <returns></returns>
  2278. public static int GetMaxOs(List<int> kjh)
  2279. {
  2280. List<int> temp = new List<int>();
  2281. foreach (int i in kjh)
  2282. {
  2283. if (i % 2 == 0)
  2284. temp.Add(i);
  2285. }
  2286. if (temp.Count > 0)
  2287. return temp.Max();
  2288. else
  2289. return -1;
  2290. }
  2291. /// <summary>
  2292. /// 号码中的最小偶数
  2293. /// </summary>
  2294. /// <param name="kjh"></param>
  2295. /// <returns></returns>
  2296. public static int GetMinOs(List<int> kjh)
  2297. {
  2298. List<int> temp = new List<int>();
  2299. foreach (int i in kjh)
  2300. {
  2301. if (i % 2 == 0)
  2302. temp.Add(i);
  2303. }
  2304. if (temp.Count > 0)
  2305. return temp.Min();
  2306. else
  2307. return -1;
  2308. }
  2309. /// <summary>
  2310. /// 号码中的最大的质数
  2311. /// </summary>
  2312. /// <param name="kjh"></param>
  2313. /// <returns></returns>
  2314. public static int GetMaxZs(List<int> kjh)
  2315. {
  2316. List<int> temp = new List<int>();
  2317. List<int> data = new List<int> { 0, 4, 6, 8, 9 };
  2318. foreach (int i in kjh)
  2319. {
  2320. if (!data.Contains(i))
  2321. temp.Add(i);
  2322. }
  2323. if (temp.Count > 0)
  2324. return temp.Max();
  2325. else
  2326. return -1;
  2327. }
  2328. /// <summary>
  2329. /// 号码中的最大的质数
  2330. /// </summary>
  2331. /// <param name="kjh"></param>
  2332. /// <returns></returns>
  2333. public static int GetMinZs(List<int> kjh)
  2334. {
  2335. List<int> temp = new List<int>();
  2336. List<int> data = new List<int> { 0, 4, 6, 8, 9 };
  2337. foreach (int i in kjh)
  2338. {
  2339. if (!data.Contains(i))
  2340. temp.Add(i);
  2341. }
  2342. if (temp.Count > 0)
  2343. return temp.Min();
  2344. else
  2345. return -1;
  2346. }
  2347. /// <summary>
  2348. /// 号码中的最大的合数
  2349. /// </summary>
  2350. /// <param name="kjh"></param>
  2351. /// <returns></returns>
  2352. public static int GetMaxHs(List<int> kjh)
  2353. {
  2354. List<int> temp = new List<int>();
  2355. List<int> data = new List<int> { 0, 4, 6, 8, 9 };
  2356. foreach (int i in kjh)
  2357. {
  2358. if (data.Contains(i))
  2359. temp.Add(i);
  2360. }
  2361. if (temp.Count > 0)
  2362. return temp.Max();
  2363. else
  2364. return -1;
  2365. }
  2366. /// <summary>
  2367. /// 号码中的最小的合数
  2368. /// </summary>
  2369. /// <param name="kjh"></param>
  2370. /// <returns></returns>
  2371. public static int GetMinHs(List<int> kjh)
  2372. {
  2373. List<int> temp = new List<int>();
  2374. List<int> data = new List<int> { 0, 4, 6, 8, 9 };
  2375. foreach (int i in kjh)
  2376. {
  2377. if (data.Contains(i))
  2378. temp.Add(i);
  2379. }
  2380. if (temp.Count > 0)
  2381. return temp.Min();
  2382. else
  2383. return -1;
  2384. }
  2385. /// <summary>
  2386. /// 将string kjh转换成int kjh
  2387. /// </summary>
  2388. /// <param name="str"></param>
  2389. /// <returns></returns>
  2390. public static List<int> ConvertList(List<string> kjh)
  2391. {
  2392. List<int> list = new List<int>();
  2393. if (kjh == null || kjh.Count == 0)
  2394. return list;
  2395. foreach (string s in kjh)
  2396. {
  2397. list.Add(TypeConverter.ObjectToInt(s, -1));
  2398. }
  2399. return list;
  2400. }
  2401. #region 广东好彩1相关
  2402. /// <summary>
  2403. /// 返回好彩1季节说明
  2404. /// </summary>
  2405. /// <param name="n"></param>
  2406. /// <returns></returns>
  2407. public static string GetJiJie(int n)
  2408. {
  2409. string result = string.Empty;
  2410. if (n > 0 && n < 10)
  2411. result = "春";
  2412. if (n > 9 && n < 19)
  2413. result = "夏";
  2414. if (n > 18 && n < 28)
  2415. result = "秋";
  2416. if (n > 27)
  2417. result = "冬";
  2418. return result;
  2419. }
  2420. /// <summary>
  2421. /// 方位
  2422. /// </summary>
  2423. /// <param name="n"></param>
  2424. /// <returns></returns>
  2425. public static string GetFangWei(int n)
  2426. {
  2427. string result = string.Empty;
  2428. List<int> fd = new List<int> { 1, 3, 5, 7, 9, 11, 13, 15, 17 };
  2429. List<int> fn = new List<int> { 2, 4, 6, 8, 10, 12, 14, 16, 18 };
  2430. List<int> fx = new List<int> { 19, 21, 23, 25, 27, 29, 31, 33, 35 };
  2431. List<int> fb = new List<int> { 20, 22, 24, 26, 28, 30, 32, 34, 36 };
  2432. if (fd.Contains(n))
  2433. result = "东";
  2434. if (fn.Contains(n))
  2435. result = "南";
  2436. if (fx.Contains(n))
  2437. result = "西";
  2438. if (fb.Contains(n))
  2439. result = "北";
  2440. return result;
  2441. }
  2442. /// <summary>
  2443. /// 生肖
  2444. /// </summary>
  2445. /// <param name="n"></param>
  2446. public static string GetShengXiao(int n)
  2447. {
  2448. string result = string.Empty;
  2449. List<int> s1 = new List<int> { 1, 13, 25 };
  2450. List<int> s2 = new List<int> { 2, 14, 26 };
  2451. List<int> s3 = new List<int> { 3, 15, 27 };
  2452. List<int> s4 = new List<int> { 4, 16, 28 };
  2453. List<int> s5 = new List<int> { 5, 17, 29 };
  2454. List<int> s6 = new List<int> { 6, 18, 30 };
  2455. List<int> s7 = new List<int> { 7, 19, 31 };
  2456. List<int> s8 = new List<int> { 8, 20, 32 };
  2457. List<int> s9 = new List<int> { 9, 21, 33 };
  2458. List<int> s10 = new List<int> { 10, 22, 34 };
  2459. List<int> s11 = new List<int> { 11, 23, 35 };
  2460. List<int> s12 = new List<int> { 12, 24, 36 };
  2461. if (s1.Contains(n))
  2462. return "鼠";
  2463. if (s2.Contains(n))
  2464. return "牛";
  2465. if (s3.Contains(n))
  2466. return "虎";
  2467. if (s4.Contains(n))
  2468. return "兔";
  2469. if (s5.Contains(n))
  2470. return "龙";
  2471. if (s6.Contains(n))
  2472. return "蛇";
  2473. if (s7.Contains(n))
  2474. return "马";
  2475. if (s8.Contains(n))
  2476. return "羊";
  2477. if (s9.Contains(n))
  2478. return "猴";
  2479. if (s10.Contains(n))
  2480. return "鸡";
  2481. if (s11.Contains(n))
  2482. return "狗";
  2483. if (s12.Contains(n))
  2484. return "猪";
  2485. return result;
  2486. }
  2487. #endregion
  2488. #region 香港彩相关
  2489. static int[] Bs_red = { 1, 2, 7, 8, 12, 13, 18, 19, 23, 24, 29, 30, 34, 35, 40, 45, 46 };
  2490. static int[] Bs_blue = { 3, 4, 9, 10, 14, 15, 20, 25, 26, 31, 36, 37, 41, 42, 47, 48 };
  2491. static int[] Bs_green = { 5, 6, 11, 16, 17, 21, 22, 27, 28, 32, 33, 38, 39, 43, 44, 49 };
  2492. /// <summary>
  2493. /// 获取当前号码的波色
  2494. /// </summary>
  2495. /// <param name="n"></param>
  2496. /// <returns></returns>
  2497. public static int GetNumBoSe(int n)
  2498. {
  2499. if (Bs_red.Contains(n))
  2500. {
  2501. return 0;// "红";
  2502. }
  2503. else if (Bs_blue.Contains(n))
  2504. {
  2505. return 1;// "蓝";
  2506. }
  2507. else
  2508. {
  2509. return 2;// "绿";
  2510. }
  2511. }
  2512. /// <summary>
  2513. /// 获取当前号码的半波色
  2514. /// </summary>
  2515. /// <param name="n"></param>
  2516. /// <returns></returns>
  2517. public static int GetNumBBoSe(int n)
  2518. {
  2519. if (Bs_red.Contains(n) && n % 2 == 1)
  2520. {
  2521. return 0;// "红单";
  2522. }
  2523. else if (Bs_red.Contains(n) && n % 2 == 0)
  2524. {
  2525. return 3;// "红双";
  2526. }
  2527. else if (Bs_blue.Contains(n) && n % 2 == 1)
  2528. {
  2529. return 1;// "蓝单";
  2530. }
  2531. else if (Bs_blue.Contains(n) && n % 2 == 0)
  2532. {
  2533. return 4;// "蓝双";
  2534. }
  2535. else if (Bs_green.Contains(n) && n % 2 == 1)
  2536. {
  2537. return 2;// "绿单";
  2538. }
  2539. else
  2540. {
  2541. return 5;// "绿双";
  2542. }
  2543. }
  2544. /// <summary>
  2545. /// 特码单双
  2546. /// </summary>
  2547. /// <param name="n"></param>
  2548. /// <returns></returns>
  2549. public static int GetNumTmds(int n)
  2550. {
  2551. if (n % 2 == 1)
  2552. {
  2553. return 0;// "单";
  2554. }
  2555. else
  2556. {
  2557. return 1;// "双";
  2558. }
  2559. }
  2560. /// <summary>
  2561. /// 特头单双
  2562. /// </summary>
  2563. /// <param name="n"></param>
  2564. /// <returns></returns>
  2565. public static int GetNumTtds(int n)
  2566. {
  2567. if (n / 10 == 0 || n / 10 % 2 == 0)
  2568. {
  2569. return 1;// "双";
  2570. }
  2571. else
  2572. {
  2573. return 0;// "单";
  2574. }
  2575. }
  2576. /// <summary>
  2577. /// 特头单双(特码头数走势图)
  2578. /// </summary>
  2579. /// <param name="n"></param>
  2580. /// <returns></returns>
  2581. public static int GetNumtmttds(int n)
  2582. {
  2583. if (n / 10 == 0 || n / 10 % 2 == 0)
  2584. {
  2585. return 0;// "双";
  2586. }
  2587. else
  2588. {
  2589. return 1;// "单";
  2590. }
  2591. }
  2592. /// <summary>
  2593. /// 特尾大小
  2594. /// </summary>
  2595. /// <param name="n"></param>
  2596. /// <returns></returns>
  2597. public static int GetNumtmtwdx(int n)
  2598. {
  2599. if (n % 10 < 5)
  2600. {
  2601. return 0;// "小";
  2602. }
  2603. else
  2604. {
  2605. return 1;// "大";
  2606. }
  2607. }
  2608. /// <summary>
  2609. /// 合数单双
  2610. /// </summary>
  2611. /// <param name="n"></param>
  2612. /// <returns></returns>
  2613. public static int GetNumHsds(int n)
  2614. {
  2615. if (n / 10 == 0 || n / 10 % 2 == 0)
  2616. {
  2617. return 1;// "双";
  2618. }
  2619. else
  2620. {
  2621. return 0;// "单";
  2622. }
  2623. }
  2624. #endregion
  2625. }
  2626. }