using System; using System.Collections.Generic; using System.Linq; using CP.Cache; using CP.Common; using CP.Model; namespace CP.Business { /// /// 福彩3d的逻辑操作类 /// 包括cache等 /// public class Fcsd { /// /// 缓存 /// static WMCache cache = WMCache.GetCacheService(); #region 最近n期形态=x的列表 /// /// 最近n期和值=x的列表 /// /// xt /// public static List GetFcsdListBy012(ref List list, string xt) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (ToolUtils.Get012Xt(list[i].kjh.ToString("000")).Equals(xt)) { rlist.Add(list[i]); } } } return rlist; } /// /// 最近n期和值=x的列表 /// /// xt /// public static List GetFcsdListByZh(ref List list, string xt) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (ToolUtils.GetZh(list[i].kjh.ToString("000")).Equals(xt)) { rlist.Add(list[i]); } } } return rlist; } /// /// 最近n期和值=x的列表 /// /// xt /// public static List GetFcsdListByDx(ref List list, string xt) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (ToolUtils.GetDx(list[i].kjh.ToString("000")).Equals(xt)) { rlist.Add(list[i]); } } } return rlist; } /// /// 最近n期和值=x的列表 /// /// xt /// public static List GetFcsdListByJo(ref List list, string xt) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (ToolUtils.GetJo(list[i].kjh.ToString("000")).Equals(xt)) { rlist.Add(list[i]); } } } return rlist; } /// /// 最近n期定位号码的列表 /// /// /// public static List GetFcsdListByDwNum(ref List list, int num,int site) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (list[i].n1==num&&site==1) { rlist.Add(list[i]); } if (list[i].n2 == num && site == 2) { rlist.Add(list[i]); } if (list[i].n3 == num && site == 3) { rlist.Add(list[i]); } } } return rlist; } /// /// 最近n期号码=x的列表 /// /// 号码 /// public static List GetFcsdListByNum(ref List list, int num) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (ToolUtils.GetNumList(list[i].kjh.ToString("000")).Contains(num)) { rlist.Add(list[i]); } } } return rlist; } /// /// 最近n期和尾=x的列表 /// /// 和尾 /// public static List GetFcsdListByHw(ref List list, int hw) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (list[i].hw == hw) { rlist.Add(list[i]); } } } return rlist; } /// /// 最近n期和值=x的列表 /// /// 和值 /// public static List GetFcsdListByHz(ref List list, int hz) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (list[i].hz == hz) { rlist.Add(list[i]); } } } return rlist; } /// /// 最近n期跨度=x的列表 /// /// 跨度值 /// public static List GetFcsdListByKd(ref List list, int kd) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (list[i].kd == kd) { rlist.Add(list[i]); } } } return rlist; } #endregion #region 跟随号码列表 /// /// 返回某个号码的所有跟随号码数据 /// /// /// public static List GetGsList(ref List list, string num) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { List nums = ToolUtils.GetZxNumList(num); //load 被查询开奖号的下一期开奖号.. if (nums.Contains(list[i].kjh.ToString("000")) && (i + 1) < size) { rlist.Add(list[i + 1]); } } } return rlist; } #endregion #region 可能只有开机号/试机号的3D数据 /// /// 可能只有开机号/试机号的3D数据 /// /// public static List GetFcsdAllList() { string key = string.Format(CacheKeys.FCSD_DATALIST_ALL); List list = new List(); if (cache.IsExist(key)) { list = cache.GetObject>(key) as List; } else { list = FcsdData.GetFcsdAllList(); cache.AddObject(key, list, (int)CacheTime.Data); } return list; } /// /// 最近n条3D所有数据 /// 包括试机号 /// /// /// public static List GetFcsdAllList(ref List list, int pagesize) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = (size - pagesize); i < size; i++) { if(list[i].sjh!=-1) rlist.Add(list[i]); } } return rlist; } /// /// 试机号走势图上专用的数据源 /// 包括最新一期的试机号数据 /// /// 最近n条 /// 年份 /// 开始期 /// 结束期 /// public static List GetFcsdAllList(ref List list, int pagesize, int year, int sqi, int eqi) { List tlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < list.Count; i++) { if (list[i].sjh != -1) tlist.Add(list[i]); } } List rlist = new List(); if (tlist != null && tlist.Count > 0) { int size = tlist.Count; if (pagesize > 0) { for (int i = (size - pagesize); i < size; i++) { rlist.Add(tlist[i]); } return rlist; } if (year > 0) { rlist.Clear(); for (int i = 0; i < size; i++) { if (TypeConverter.StrToInt(tlist[i].qi.ToString().Substring(0, 4), 0) == year) rlist.Add(tlist[i]); } return rlist; } if (sqi > 0 && eqi > 0) { rlist.Clear(); int srank = GetFcsdInfo(ref list,sqi).rank; int erank = GetFcsdInfo(ref list,eqi).rank; if (erank != 0 && srank != 0 && erank > srank) { for (int i = srank - 1; i < erank && i < size; i++) { rlist.Add(tlist[i]); } } return rlist; } } return rlist; } /// /// 与某个试机号相同的列表 /// 组选相同 /// /// /// public static List GetSameZxSjhAllList(ref List list, string sjh,out List lastList) { List rlist = new List(); lastList = new List(); if (TypeConverter.StrToInt(sjh,-1)==-1) return rlist; if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (list[i].sjh != -1) { List sn = ToolUtils.GetNumList(sjh); sn.Sort(); List sjhs = ToolUtils.GetNumList(list[i].sjh.ToString("000")); sjhs.Sort(); if (sn[0] == sjhs[0] && sn[1] == sjhs[1] && sn[2] == sjhs[2]) { rlist.Add(list[i]); //返回本期号码的上一期数据.. if (i > 0) lastList.Add(list[i - 1]); } } } } return rlist; } /// /// 与某个试机号相同的列表,最近10条 /// /// /// /// public static List GetSameSjhAllList(ref List list, int sjh) { List rlist = new List(); if (list != null && list.Count > 0) { List temp = new List(); int size = list.Count; for (int i = 0; i < size; i++) { if (list[i].sjh == sjh) temp.Add(list[i]); } size = temp.Count; int start = 0; if (size > 10) start = size - 10; for (int i = start; i < size; i++) { rlist.Add(temp[i]); } } return rlist; } /// /// 3D号码历史上的今天. /// /// 期数 /// public static List GetHistoryTodayFcsdList(ref List list, string qi) { DateTime now = System.DateTime.Now; List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = 0; i < size; i++) { if (list[i].qi.ToString().Substring(4).Equals(qi)&&list[i].sjh!=-1) rlist.Add(list[i]); } } return rlist; } /// /// 上一期的开奖信息. /// /// public static FcsdInfo GetLastFcsdInfo(ref List list) { FcsdInfo info = new FcsdInfo(); if (list != null && list.Count > 0) { int size = list.Count; for (int i =(size-1); i>=0; i--) { if (list[i].n1 != -1) return list[i]; } } return info; } /// /// 获取当前期的数据 /// /// /// public static FcsdInfo GetTodayQiFcsdInfo(ref List list, int qi) { FcsdInfo info = new FcsdInfo(); if (list != null && list.Count > 0) { for(int i=0;i /// 取出当前期的3D数据 /// 可能只有开机号或试机号 /// /// public static FcsdInfo GetCurrentFcsdInfo(ref List list) { FcsdInfo info = new FcsdInfo(); if(list!=null&&list.Count>0) return list[list.Count - 1]; return info; } #endregion #region 包括完整开奖号的3D数据 /// /// cache中的所有数据. /// /// public static List GetFcsdList() { string key = CacheKeys.FCSD_DATALIST; List list = new List(); if (cache.IsExist(key)) { list = cache.GetObject>(key) as List; } else { list = FcsdData.GetFcsdList(); cache.AddObject(key, list, (int)CacheTime.Data); } return list; } /// /// 3D遗漏表上用到的3D列表数据.. /// /// /// public static List GetMissFcsdList(ref List list, int eqi) { List rlist = new List(); if (eqi > 0) { int size = list.Count; int erank = GetFcsdInfo(ref list,eqi).rank; if (erank > 0) { for (int i = 0; i < erank && i < size; i++) { rlist.Add(list[i]); } } else { for (int i = 0;i < size; i++) { rlist.Add(list[i]); } } } else { rlist = list; } return rlist; } /// /// 福彩3D最近n期的未出号数据.. /// pagesize=0时为所有的 /// /// /// public static List GetWchFcsdList(ref List list, int pagesize) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; List nlist = Utils.GetAllNumber(); int begin = 0; if (pagesize > 0) begin = size - pagesize; else begin = 0; if (pagesize >= size) begin = 0; for (int i = begin; i < size; i++) { if (nlist.Contains(list[i].kjh)) nlist.Remove(list[i].kjh); } rlist = nlist; } return rlist; } /// /// 按形态取3D数据列表 /// 组三/组六 /// /// /// public static List GetFcsdList(ref List list, int xt) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; int j = 0; for (int i = 0; i < size; i++) { if (list[i].zxxt == xt) { list[i].z3rank = j; rlist.Add(list[i]); j++; } } } return rlist; } /// /// 取形如: /// 最近120期~最近90期这种区间的数据列表 /// /// 较大的size /// 较小的size /// public static List GetFcsdList(ref List list, int maxsize, int minisize) { List rlist = new List(); if (list != null && list.Count > 0) { int size = list.Count; for (int i = (size - maxsize); i < (size - minisize); i++) { rlist.Add(list[i]); } } return rlist; } /// /// 福彩3D最近n期的开奖号int list /// /// /// /// /// /// public static List GetFcsdKjhList(ref List datalist, int pagesize, int year, int sqi, int eqi) { List list = GetFcsdList(ref datalist,pagesize, year, sqi, eqi); List kjhs = new List(); for (int i = 0; i < list.Count; i++) { kjhs.Add(list[i].kjh); } return kjhs; } /// /// 所有的开奖号数据int list /// /// public static List GetFcsdKjhList(ref List list) { List kjhs = new List(); for (int i = 0; i < list.Count; i++) { kjhs.Add(list[i].kjh); } return kjhs; } /// /// 最近n期数据 /// /// 最近n期 /// 某一年 /// 开始期数 /// 结束期数 /// 周几 /// 形态0为豹子 3为组三 6为组六 /// 单双期数 /// public static List GetFcsdList(ref List datalist, int pagesize, int year, int sqi, int eqi, int week = 0, int xt = -1,int ds=0) { List list = new List(); if (xt != -1) list = GetFcsdList(ref datalist,xt); else list = datalist; List rlist = new List(); int size = list.Count; if (pagesize > 0) { for (int i = (size - pagesize); i < size; i++) { rlist.Add(list[i]); } return rlist; } if (year > 0) { rlist.Clear(); for (int i = 0; i < size; i++) { if (TypeConverter.StrToInt(list[i].qi.ToString().Substring(0, 4), 0) == year) rlist.Add(list[i]); } return rlist; } if (week > 0) { rlist.Clear(); List temp = new List(); for (int i = 0; i < size; i++) { if (list[i].week == week) temp.Add(list[i]); } for (int i = (temp.Count - 60); i < temp.Count; i++) { rlist.Add(temp[i]); } return rlist; } //单双期数 if (ds > 0) { rlist.Clear(); List temp = new List(); for (int i = 0; i < size; i++) { if (ds == 1) { if (list[i].qi % 2 != 0) temp.Add(list[i]); } else if (ds == 2) { if (list[i].qi % 2 == 0) temp.Add(list[i]); } } for (int i = (temp.Count - 60); i < temp.Count; i++) { rlist.Add(temp[i]); } return rlist; } if (sqi > 0 && eqi > 0) { rlist.Clear(); int srank = GetFcsdInfo(ref datalist,sqi).rank; int erank = GetFcsdInfo(ref datalist,eqi).rank; if (erank != 0 && srank != 0 && erank > srank) { for (int i = srank - 1; i < erank && i < size; i++) { rlist.Add(list[i]); } } return rlist; } ///无参数条件时,返回2002001到现在的所有数据.. if (pagesize == 0 && year == 0 && sqi == 0 && eqi == 0 && week == 0) return list; return rlist; } /// /// 取出开奖数据中最后一期的开奖数据 /// /// public static FcsdInfo GetEndFcsdInfo(ref List list) { FcsdInfo info = new FcsdInfo(); if (list != null && list.Count > 0) return list[list.Count - 1]; return info; } /// /// 根据期数获取期一期的数据... /// /// /// public static FcsdInfo GetFcsdInfo(ref List list, int qi) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = 0; i < size; i++) { if (list[i].qi == qi) { info = list[i]; break; } } return info; } #endregion #region 根据当前数据和排名,查询出上一次的数据 #region 组选形态的上一次情况 /// /// 某个号码组选 012形态的上一次数据. /// /// /// public static FcsdInfo GetLast012Info(ref List list, string xt) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = (size - 1); i >= 0; i--) { string zh = ToolUtils.Get012Xt(list[i].kjh.ToString("000")); List xts = ToolUtils.Get012List(xt); if (xts.Contains(zh)) { return list[i]; } } return info; } /// /// 某个号码组选 质合形态的上一次数据. /// /// /// public static FcsdInfo GetLastZhInfo(ref List list, string xt) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = (size - 1); i >= 0; i--) { string zh = ToolUtils.GetZh(list[i].kjh.ToString("000")); List xts = ToolUtils.GetZhList(xt); if (xts.Contains(zh)) { return list[i]; } } return info; } /// /// 某个号码组选 奇偶形态的上一次数据. /// /// /// public static FcsdInfo GetLastJoInfo(ref List list, string xt) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = (size - 1); i >= 0; i--) { string jo = ToolUtils.GetJo(list[i].kjh.ToString("000")); List xts = ToolUtils.GetJoList(xt); if (xts.Contains(jo)) { return list[i]; } } return info; } /// /// 某个号码组选 大小形态的上一次数据. /// /// /// public static FcsdInfo GetLastDxInfo(ref List list, string xt) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = (size - 1); i >= 0; i--) { string dx = ToolUtils.GetDx(list[i].kjh.ToString("000")); List xts = ToolUtils.GetDxList(xt); if (xts.Contains(dx)) { return list[i]; } } return info; } /// /// 某个号码组选形态的上一次数据 /// /// /// public static FcsdInfo GetLastZxNumInfo(ref List list, string num) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = (size-1); i>=0; i--) { List nums = ToolUtils.GetZxNumList(num); if (nums.Contains(list[i].kjh.ToString("000"))) { return list[i]; } } return info; } #endregion #region 某个二码组合的上一次数据 /// /// 某个二码组合的上一次数据 /// /// /// public static FcsdInfo GetLastZx2MaInfo(ref List list, string num) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = (size-1); i>=0; i--) { List nums = ToolUtils.GetNumList(num); if (list[i].kjh.ToString("000").Contains(num)) { return list[i]; } } return info; } #endregion #region 和尾振幅的上一次数据 /// /// 和尾振幅的上一次数据 /// /// /// /// public static FcsdInfo GetLastHwZfInfo(ref List list, int zf, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (i > 0) { if (Math.Abs(list[i].hw - list[i - 1].hw) == zf) { info = list[i]; return info; } } } return info; } #endregion #region 总跨度振幅的上一次数据 /// /// 总跨度振幅的上一次数据 /// /// /// /// public static FcsdInfo GetLastKdZfInfo(ref List list, int zf, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (i > 0) { if (Math.Abs(list[i].kd - list[i-1].kd) == zf) { info = list[i]; return info; } } } return info; } #endregion #region 百十个位号码振幅的上一次 /// /// 百十个位号码振幅的上一次数据 /// /// /// /// 0=百位 1=十位 2=个位 /// public static FcsdInfo GetLastNZfInfo(ref List list, int zf, int rank, int type) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (i > 0) { if (type == 0) { if (Math.Abs(list[i].n1 - list[i - 1].n1) == zf) { info = list[i]; return info; } } if (type == 1) { if (Math.Abs(list[i].n2 - list[i - 1].n2) == zf) { info = list[i]; return info; } } if (type == 2) { if (Math.Abs(list[i].n3 - list[i - 1].n3) == zf) { info = list[i]; return info; } } if (type == 3) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Max(); int lastn = new List { list[i-1].n1, list[i-1].n2, list[i-1].n3 }.Max(); if (Math.Abs(n - lastn) == zf) return list[i]; } if (type == 4) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); int lastn = new List { list[i - 1].n1, list[i - 1].n2, list[i - 1].n3 }.Min(); if (Math.Abs(n - lastn) == zf) return list[i]; } } } return info; } #endregion #region 012路组选除0/1/2个数的上一次数据 /// /// 012路余0/1/2个数比值的上一次数据 /// /// /// /// public static FcsdInfo GetLastYnBzInfo(ref List list, string bz, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3 }; string val = ZstUtils.Get012Count(0, kjh).ToString() + ":" + ZstUtils.Get012Count(1, kjh).ToString() + ":" + ZstUtils.Get012Count(2, kjh); if (val.Equals(bz)) { info = list[i]; return info; } } return info; } /// /// 012路余0/1/2个数的上一次数据 /// /// /// /// /// public static FcsdInfo GetLastYnInfo(ref List list, int n,int j,int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3 }; if (ZstUtils.Get012Count(n, kjh) == j) { info = list[i]; return info; } } return info; } #endregion #region 质合形态的上一次数据 /// /// 开奖号某位上的上一次质合数据.. /// /// /// /// /// public static FcsdInfo GetLastNzhInfo(ref List list, int zh, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (site == 0) { if (ZstUtils.GetZh(list[i].n1) == zh) { info = list[i]; return info; } } if (site == 1) { if (ZstUtils.GetZh(list[i].n2) == zh) { info = list[i]; return info; } } if (site == 2) { if (ZstUtils.GetZh(list[i].n3) == zh) { info = list[i]; return info; } } if (site == 3) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Max(); if (ZstUtils.GetZh(n) == zh) { info = list[i]; return info; } } if (site == 4) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); if (ZstUtils.GetZh(n) == zh) { info = list[i]; return info; } } } return info; } /// /// 奇偶比的上一次数据 /// /// /// /// public static FcsdInfo GetLastZhbInfo(ref List list, string bz, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3 }; if (ZstUtils.GetZhb(kjh).Equals(bz)) { info = list[i]; return info; } } return info; } /// /// 质合形态的上一次数据 /// /// /// public static FcsdInfo GetLastZhxtInfo(ref List list, string xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3 }; if (ZstUtils.GetZhxt(kjh, false).Equals(xt)) { info = list[i]; return info; } } return info; } #endregion #region 奇偶形态的上一次数据 /// /// 开奖号某位上的上一次奇偶数据.. /// /// /// /// /// public static FcsdInfo GetLastNjoInfo(ref List list, int jo, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (site == 0) { if (ZstUtils.GetJo(list[i].n1) == jo) { info = list[i]; return info; } } if (site == 1) { if (ZstUtils.GetJo(list[i].n2) == jo) { info = list[i]; return info; } } if (site == 2) { if (ZstUtils.GetJo(list[i].n3) == jo) { info = list[i]; return info; } } if (site ==3) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Max(); if (ZstUtils.GetJo(n) == jo) { info = list[i]; return info; } } if (site == 4) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); if (ZstUtils.GetJo(n) == jo) { info = list[i]; return info; } } } return info; } /// /// 奇偶比的上一次数据 /// /// /// /// public static FcsdInfo GetLastJobInfo(ref List list, string bz, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List {list[i].n1,list[i].n2,list[i].n3 }; if (ZstUtils.GetJob(kjh).Equals(bz)) { info = list[i]; return info; } } return info; } /// /// 奇偶形态的上一次数据 /// /// /// public static FcsdInfo GetLastJoxtInfo(ref List list, string xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3}; if (ZstUtils.GetJoxt(kjh, false).Equals(xt)) { info = list[i]; return info; } } return info; } #endregion #region 大小形态的上一次数据 /// /// 某个开奖号的上一次大小数据.. /// /// /// /// /// public static FcsdInfo GetLastNdxInfo(ref List list, int dx, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (site == 0) { if (ZstUtils.GetDx(list[i].n1) == dx) { info = list[i]; return info; } } if (site == 1) { if (ZstUtils.GetDx(list[i].n2) == dx) { info = list[i]; return info; } } if (site == 2) { if (ZstUtils.GetDx(list[i].n3) == dx) { info = list[i]; return info; } } if (site == 3) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Max(); if (ZstUtils.GetDx(n) == dx) { info = list[i]; return info; } } if (site == 4) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); if (ZstUtils.GetDx(n) == dx) { info = list[i]; return info; } } } return info; } /// /// 大小比的上一次数据 /// /// /// /// public static FcsdInfo GetLastDxbInfo(ref List list, string bz, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3 }; if (ZstUtils.GetDxb(kjh, 5).Equals(bz)) { info = list[i]; return info; } } return info; } /// /// 大小形态的上一次数据 /// /// /// public static FcsdInfo GetLastDxxtInfo(ref List list, string xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3 }; if (ZstUtils.GetDxxt(kjh, false).Equals(xt)) { info = list[i]; return info; } } return info; } #endregion #region 组三走势图相关的上一次数据 /// /// 一上次组三的数据. /// /// /// public static FcsdInfo GetLastZ3Info(ref List list, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (list[i].zxxt == 3) { info = list[i]; return info; } } return info; } /// /// 组三形态的上一次数据 /// AAB /// /// /// /// public static FcsdInfo GetLastZ3XtInfo(ref List datalist, string xt, int rank) { FcsdInfo info = new FcsdInfo(); List list = GetFcsdList(ref datalist,3); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.GetZ3Xt(list[i].kjh).Equals(xt)) { info = list[i]; return info; } } return info; } /// /// 组三号码N的奇偶上一次数据 /// /// /// /// public static FcsdInfo GetLastZ3NJoFcsdInfo(ref List datalist, int jo, int rank) { FcsdInfo info = new FcsdInfo(); List list = GetFcsdList(ref datalist,3); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.GetJo(ZstUtils.GetZ3Num(list[i].kjh)) == jo) { info = list[i]; return info; } } return info; } /// /// 组三号码N的大小上一次数据 /// /// /// /// public static FcsdInfo GetLastZ3NDxFcsdInfo(ref List datalist, int dx, int rank) { FcsdInfo info = new FcsdInfo(); List list = GetFcsdList(ref datalist,3); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.GetDx(ZstUtils.GetZ3Num(list[i].kjh)) == dx) { info = list[i]; return info; } } return info; } /// /// 组三号码N的质合上一次数据 /// /// /// /// public static FcsdInfo GetLastZ3NZhFcsdInfo(ref List datalist, int zh, int rank) { FcsdInfo info = new FcsdInfo(); List list = GetFcsdList(ref datalist,3); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.GetZh(ZstUtils.GetZ3Num(list[i].kjh)) == zh) { info = list[i]; return info; } } return info; } /// /// 组三号码N的012上一次数据 /// /// /// /// public static FcsdInfo GetLastZ3N012FcsdInfo(ref List datalist, int val, int rank) { FcsdInfo info = new FcsdInfo(); List list = GetFcsdList(ref datalist,3); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.Get012(ZstUtils.GetZ3Num(list[i].kjh)) == val) { info = list[i]; return info; } } return info; } #endregion #region 012路相关的上一次形态 /// /// 返回某个开奖号码,012形态对应的上一次数据.. /// /// /// /// public static FcsdInfo GetLastXt012FcsdInfo(ref List list, string xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3 }; if (ZstUtils.Get012Xt(kjh).Equals(xt)) { info = list[i]; return info; } } return info; } /// /// 百十个位号码012路形态的上一次情况 /// /// 形态 /// 排名 /// 位置 /// public static FcsdInfo GetLastNum012FcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (site == 0) { if (ZstUtils.Get012(list[i].n1) == xt) { info = list[i]; return info; } } if (site == 1) { if (ZstUtils.Get012(list[i].n2) == xt) { info = list[i]; return info; } } if (site == 2) { if (ZstUtils.Get012(list[i].n3) == xt) { info = list[i]; return info; } } if (site == 3) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Max(); if (ZstUtils.Get012(n) == xt) { info = list[i]; return info; } } if (site == 4) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); if (ZstUtils.Get012(n) == xt) { info = list[i]; return info; } } } return info; } #endregion #region 试机号与开奖号同号/同位的上一次数据 /// /// 组选同号 /// /// 当前排名 /// 值 /// public static FcsdInfo GetLastThFcsdInfo(ref List list, int rank, int val) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List th = ZstUtils.GetZxtw(list[i].sjh, list[i].kjh); if (ZstUtils.GetZxth(list[i].sjh, list[i].kjh) == val) { info = list[i]; return info; } } return info; } /// /// 试机号与开奖号直选同位的上一次数据 /// /// 当前排名 /// 位置 /// public static FcsdInfo GetLastTwFcsdInfo(ref List list, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List th = ZstUtils.GetZxtw(list[i].sjh, list[i].kjh); if (site == 0 && th[0]) { info = list[i]; return info; } if (site == 1 && th[1]) { info = list[i]; return info; } if (site == 2 && th[2]) { info = list[i]; return info; } } return info; } #endregion #region 升降序/号码区段的上一次数据/连号 /// /// 连号的上一次数据 /// /// /// /// public static FcsdInfo GetLastLhFcsdInfo(ref List list, string lh, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.GetLh(list[i].kjh).Equals(lh)) { info = list[i]; return info; } } return info; } /// /// 顺子的上一次数据 /// /// /// /// public static FcsdInfo GetLastSzFcsdInfo(ref List list, string sz, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.GetSZ(list[i].kjh).Equals(sz)) { info = list[i]; return info; } } return info; } /// /// 重号的上一次数据 /// /// /// /// public static FcsdInfo GetLastChFcsdInfo(ref List list, string ch, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.GetCh(list[i].kjh, Fcsd.GetLastQiFcsdInfo(ref list,list[i].rank).kjh).Equals(ch)) { info = list[i]; return info; } } return info; } /// /// 号码区段的上一次数据 /// /// /// /// public static FcsdInfo GetLastQdFcsdInfo(ref List list, string qd, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (ZstUtils.GetQd(list[i].kjh).Equals(qd)) { info = list[i]; return info; } } return info; } /// /// 升降序的上一次数据 /// /// /// /// public static FcsdInfo GetLastSjxFcsdInfo(ref List list, string sjx, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { List kjh = new List { list[i].n1, list[i].n2, list[i].n3 }; if (ZstUtils.GetSjxzh(kjh).Equals(sjx)) { info = list[i]; return info; } } return info; } #endregion #region 跨度的上一次情况 <未定位> /// /// 最大跨度的一上次数据 /// /// /// /// public static FcsdInfo GetLastKdFcsdInfo(ref List list, int kd, int rank,int type = 0) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (type == 0) { if (list[i].kd == kd) { info = list[i]; return info; } } else if(type == 1) { int kd1 = Math.Abs(list[i].n1 - list[i].n2); if(kd1 == kd) { info = list[i]; return info; } } else if (type == 2) { int kd2 = Math.Abs(list[i].n2 - list[i].n3); if (kd2 == kd) { info = list[i]; return info; } } else if (type == 3) { int kd3 = Math.Abs(list[i].n1 - list[i].n3); if (kd3 == kd) { info = list[i]; return info; } } } return info; } /// /// 跨度012路形态的上一次情况 /// /// 形态 0 1 2 路 /// 当前排名 /// 0=总跨 1=1跨 2=2跨 /// public static FcsdInfo GetLastKd012FcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //最大跨度 if (site == 0) { if (xt == 0) { if (list[i].kd % 3 == 0) { info = list[i]; return info; } } if (xt == 1) { if (list[i].kd % 3 == 1) { info = list[i]; return info; } } if (xt == 2) { if (list[i].kd % 3 == 2) { info = list[i]; return info; } } } //一跨 if (site == 0) { if (xt == 0) { if (ZstUtils.GetKdList(kjh)[1] % 3 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetKdList(kjh)[1] % 3 == 1) { info = list[i]; return info; } } if (xt == 2) { if (ZstUtils.GetKdList(kjh)[1] % 3 == 2) { info = list[i]; return info; } } } //二跨 if (site == 2) { if (xt == 0) { if (ZstUtils.GetKdList(kjh)[2] % 3 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetKdList(kjh)[2] % 3 == 1) { info = list[i]; return info; } } if (xt == 2) { if (ZstUtils.GetKdList(kjh)[2] % 3 == 2) { info = list[i]; return info; } } } } return info; } /// /// 跨度质合形态的上一次情况 /// /// 0为合 1为质 /// /// 0最大跨度 1为一跨 2为二跨 /// public static FcsdInfo GetLastKdZhFcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; List z = new List { 1, 2, 3, 5, 7 }; List h = new List { 0, 4, 6, 8, 9 }; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //最大跨度 if (site == 0) { if (xt == 0) { if (h.Contains(ZstUtils.GetKdList(kjh)[0])) { info = list[i]; return info; } } if (xt == 1) { if (z.Contains(ZstUtils.GetKdList(kjh)[0])) { info = list[i]; return info; } } } //一跨 if (site == 0) { if (xt == 0) { if (h.Contains(ZstUtils.GetKdList(kjh)[1])) { info = list[i]; return info; } } if (xt == 1) { if (z.Contains(ZstUtils.GetKdList(kjh)[1])) { info = list[i]; return info; } } } //二跨 if (site == 2) { if (xt == 0) { if (h.Contains(ZstUtils.GetKdList(kjh)[2])) { info = list[i]; return info; } } if (xt == 1) { if (z.Contains(ZstUtils.GetKdList(kjh)[2])) { info = list[i]; return info; } } } } return info; } /// /// 跨度大小形态的上一次情况 /// /// 0为小 1为大 /// /// 0最大跨度 1为一跨 2为二跨 /// public static FcsdInfo GetLastKdDxFcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //最大跨度 if (site == 0) { if (xt == 0) { if (ZstUtils.GetKdList(kjh)[0] < 5) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetKdList(kjh)[0] > 4) { info = list[i]; return info; } } } //一跨 if (site == 0) { if (xt == 0) { if (ZstUtils.GetKdList(kjh)[1] < 5) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetKdList(kjh)[1] > 4) { info = list[i]; return info; } } } //二跨 if (site == 2) { if (xt == 0) { if (ZstUtils.GetKdList(kjh)[2] < 5) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetKdList(kjh)[2] > 4) { info = list[i]; return info; } } } } return info; } /// /// 跨度奇偶形态的上一次情况 /// xt=0偶 /// xt=1奇 /// /// /// /// 0最大跨度 1为一跨 2为二跨 /// public static FcsdInfo GetLastKdJoFcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //最大跨度 if (site == 0) { if (xt == 0) { if (ZstUtils.GetKdList(kjh)[0] % 2 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetKdList(kjh)[0] % 2 != 0) { info = list[i]; return info; } } } //一跨 if (site == 0) { if (xt == 0) { if (ZstUtils.GetKdList(kjh)[1] % 2 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetKdList(kjh)[1] % 2 != 0) { info = list[i]; return info; } } } //二跨 if (site == 2) { if (xt == 0) { if (ZstUtils.GetKdList(kjh)[2] % 2 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetKdList(kjh)[2] % 2 != 0) { info = list[i]; return info; } } } } return info; } #endregion #region 定位跨度的上一次情况 <百十位[0,1,2]> /// /// 定位跨度的一上次数据<百十位[0,1,2]> /// /// /// /// 0=百十,1=十个,2=百个 /// public static FcsdInfo GetLastZxKdFcsdInfo(ref List list, int kd, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //百十 if (site == 0) { if (ZstUtils.GetBSGKdList(kjh)[0] == kd) { info = list[i]; return info; } } //十个 if (site == 1) { if (ZstUtils.GetBSGKdList(kjh)[1] == kd) { info = list[i]; return info; } } //百个 if (site == 2) { if (ZstUtils.GetBSGKdList(kjh)[2] == kd) { info = list[i]; return info; } } } return info; } /// /// 定位跨度012路形态的上一次情况 /// /// 形态 0 1 2 路 /// 当前排名 /// 0=百十 1=十个 2=百个 /// public static FcsdInfo GetLastZxKd012FcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //百十 if (site == 0) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[0] % 3 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[0] % 3 == 1) { info = list[i]; return info; } } if (xt == 2) { if (ZstUtils.GetBSGKdList(kjh)[0] % 3 == 2) { info = list[i]; return info; } } } //十个 if (site == 1) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[1] % 3 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[1] % 3 == 1) { info = list[i]; return info; } } if (xt == 2) { if (ZstUtils.GetBSGKdList(kjh)[1] % 3 == 2) { info = list[i]; return info; } } } //百个 if (site == 2) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[2] % 3 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[2] % 3 == 1) { info = list[i]; return info; } } if (xt == 2) { if (ZstUtils.GetBSGKdList(kjh)[2] % 3 == 2) { info = list[i]; return info; } } } } return info; } /// /// 定位跨度质合形态的上一次情况 /// /// 0为合 1为质 /// /// 0=百十,1=十个,2=百个 /// public static FcsdInfo GetLastZxKdZhFcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; List z = new List { 1, 2, 3, 5, 7 }; List h = new List { 0, 4, 6, 8, 9 }; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //百十跨度 if (site == 0) { if (xt == 0) { if (h.Contains(ZstUtils.GetBSGKdList(kjh)[0])) { info = list[i]; return info; } } if (xt == 1) { if (z.Contains(ZstUtils.GetBSGKdList(kjh)[0])) { info = list[i]; return info; } } } //十个跨度 if (site == 1) { if (xt == 0) { if (h.Contains(ZstUtils.GetBSGKdList(kjh)[1])) { info = list[i]; return info; } } if (xt == 1) { if (z.Contains(ZstUtils.GetBSGKdList(kjh)[1])) { info = list[i]; return info; } } } //百个跨度 if (site == 2) { if (xt == 0) { if (h.Contains(ZstUtils.GetBSGKdList(kjh)[2])) { info = list[i]; return info; } } if (xt == 1) { if (z.Contains(ZstUtils.GetBSGKdList(kjh)[2])) { info = list[i]; return info; } } } } return info; } /// /// 定位跨度大小形态的上一次情况 /// /// 0为小 1为大 /// /// 0=百十 1=十个 2=百个 /// public static FcsdInfo GetLastZxKdDxFcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //百十跨度 if (site == 0) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[0] < 5) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[0] > 4) { info = list[i]; return info; } } } //十个跨度 if (site == 1) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[1] < 5) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[1] > 4) { info = list[i]; return info; } } } //百个跨度 if (site == 2) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[2] < 5) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[2] > 4) { info = list[i]; return info; } } } } return info; } /// /// 定位跨度奇偶形态的上一次情况 /// xt=0偶 /// xt=1奇 /// /// /// /// 0百十 1十个 2百个 /// public static FcsdInfo GetLastZxKdJoFcsdInfo(ref List list, int xt, int rank, int site) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { int kjh = list[i].kjh; //百十跨度 if (site == 0) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[0] % 2 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[0] % 2 != 0) { info = list[i]; return info; } } } //十个跨度 if (site == 1) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[1] % 2 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[1] % 2 != 0) { info = list[i]; return info; } } } //百个跨度 if (site == 2) { if (xt == 0) { if (ZstUtils.GetBSGKdList(kjh)[2] % 2 == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetBSGKdList(kjh)[2] % 2 != 0) { info = list[i]; return info; } } } } return info; } #endregion #region 和尾的上一次情况 /// /// 和尾的上一次数据 /// /// /// /// public static FcsdInfo GetLastHwFcsdInfo(ref List list, int hw, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (list[i].hw == hw) { info = list[i]; return info; } } return info; } /// /// 上一次和尾为012路形态的数据 /// /// 0=0路;1=1路;2=2路 /// /// public static FcsdInfo GetLastHw012FcsdInfo(ref List list, int xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (xt == 0) { if (list[i].hw % 3 == 0) { info = list[i]; return info; } } if (xt == 1) { if (list[i].hw % 3 == 1) { info = list[i]; return info; } } if (xt == 2) { if (list[i].hw % 3 == 2) { info = list[i]; return info; } } } return info; } /// /// 上一次和尾为大/小形态的数据 /// /// 0=小;1=大 /// /// public static FcsdInfo GetLastHwDxFcsdInfo(ref List list, int xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (xt == 0) { if (list[i].hw < 5) { info = list[i]; return info; } } if (xt == 1) { if (list[i].hw > 4) { info = list[i]; return info; } } } return info; } /// /// 上一次和尾为奇/偶形态的数据 /// /// 0=偶;1=奇 /// /// public static FcsdInfo GetLastHwJoFcsdInfo(ref List list, int xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (xt == 0) { if (list[i].hw % 2 == 0) { info = list[i]; return info; } } if (xt == 1) { if (list[i].hw % 2 != 0) { info = list[i]; return info; } } } return info; } /// /// 和尾求质合形态的上一次情况 /// /// 0为合 1为质 /// /// public static FcsdInfo GetLastHwZhFcsdInfo(ref List list, int xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; List z = new List { 1, 2, 3, 5, 7 }; List h = new List { 0, 4, 6, 8, 9 }; for (int i = rank - 2; i >= 0; i--) { if (xt == 0) { if (h.Contains(list[i].hw)) { info = list[i]; return info; } } if (xt == 1) { if (z.Contains(list[i].hw)) { info = list[i]; return info; } } } return info; } #endregion #region 和值的上一次情况 /// /// 012路 /// /// /// /// public static FcsdInfo GetLastHz012FcsdInfo(ref List list, int xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (xt == 0) { if (list[i].hz % 3 == 0) { info = list[i]; return info; } } if (xt == 1) { if (list[i].hz % 3 == 1) { info = list[i]; return info; } } if (xt == 2) { if (list[i].hz % 3 == 2) { info = list[i]; return info; } } } return info; } /// /// 上一次和值大小的情况 /// /// /// /// public static FcsdInfo GetLastHzDxFcsdInfo(ref List list, int xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (xt == 0) { if (list[i].hz < 14) { info = list[i]; return info; } } if (xt == 1) { if (list[i].hz > 13) { info = list[i]; return info; } } } return info; } /// /// 上一次和值奇偶的情况 /// /// /// /// public static FcsdInfo GetLastHzJoFcsdInfo(ref List list, int xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (xt == 0) { if (list[i].hz % 2 == 0) { info = list[i]; return info; } } if (xt == 1) { if (list[i].hz % 2 != 0) { info = list[i]; return info; } } } return info; } /// /// 上一次和值质合的情况 /// /// /// /// public static FcsdInfo GetLastHzZhFcsdInfo(ref List list, int xt, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (xt == 0) { if (ZstUtils.GetZh(list[i].hz) == 0) { info = list[i]; return info; } } if (xt == 1) { if (ZstUtils.GetZh(list[i].hz) != 0) { info = list[i]; return info; } } } return info; } #endregion /// /// 根据当前排名,取出上一个排名,即上一期的数据. /// /// /// public static FcsdInfo GetLastQiFcsdInfo(ref List list, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (list[i].rank == rank - 1) { info = list[i]; return info; } } return info; } /// /// 根据当前排名,取出下一个排名,即下一期的数据.用于开奖公告 /// /// /// public static FcsdInfo GetNextQiFcsdInfo(ref List list, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 1; i < list.Count; i++) { if (list[i].rank == rank + 1) { info = list[i]; return info; } } return info; } /// /// 和值的上一次数据 /// /// /// /// public static FcsdInfo GetLastHzFcsdInfo(ref List list, int shz,int ehz, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (shz<=list[i].hz&&ehz>=list[i].hz) { info = list[i]; return info; } } return info; } /// /// 和值的上一次数据 /// /// /// /// public static FcsdInfo GetLastHzFcsdInfo(ref List list, int hz, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (list[i].hz == hz) { info = list[i]; return info; } } return info; } /// /// 根据当前期的组选形态和排名,查询出上一次出现此形态时的数据 /// 遗漏计划时 /// /// /// /// public static FcsdInfo GetLastZxxtFcsdInfo(ref List list, int zx, int rank) { FcsdInfo info = new FcsdInfo(); int size = list.Count; ///升序的情况 ///未实现走势图倒序的情况.. for (int i = rank - 2; i >= 0; i--) { //组三 if (zx == 3) { if (list[i].n1 == list[i].n2 || list[i].n2 == list[i].n3 || list[i].n1 == list[i].n3) { info = list[i]; return info; } } //组六 if (zx == 6) { if (list[i].n1 != list[i].n2 && list[i].n1 != list[i].n3) { info = list[i]; return info; } } //豹子 if (zx == 0) { if (list[i].n1 == list[i].n2 && list[i].n2 == list[i].n3) { info = list[i]; return info; } } } return info; } /// /// 根据当前出号和排名,查询出上一次出此号时的数据 /// 主要用在算遗漏时 /// /// 值 /// 当前排名 /// 类型 0=百位号;1=十位号;2=个位号;3=组选;4=组选大号;5=组选小号 /// public static FcsdInfo GetLastFcsdInfo(ref List list, int val, int rank, int type) { FcsdInfo info = new FcsdInfo(); int size = list.Count; ///升序的情况 ///未实现走势图倒序的情况.. for (int i = rank - 2; i >= 0; i--) { if (type == 0) { if (list[i].n1 == val) { info = list[i]; return info; } } if (type == 1) { if (list[i].n2 == val) { info = list[i]; return info; } } if (type == 2) { if (list[i].n3 == val) { info = list[i]; return info; } } if (type == 3) { if (list[i].n1 == val || list[i].n2 == val || list[i].n3 == val) { info = list[i]; return info; } } if (type == 4) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Max(); if (n == val) { info = list[i]; return info; } } if (type == 5) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); if (n == val) { info = list[i]; return info; } } } return info; } public static FcsdInfo GetLast2mFcsdInfo(ref List list, int rank, string f2m) { FcsdInfo info = new FcsdInfo(); if (list != null && list.Count > 0) { for (int i = rank - 2; i >= 0; i--) { List kjh = new List{ list[i].n1, list[i].n2, list[i].n3 }; if (ZstUtils.Get2m(kjh).Contains(f2m)) { info = list[i]; return info; } } } return info; } /// /// 上一次某位号码重号的数据 /// /// public static FcsdInfo GetLastNChFcsdInfo(ref List list, int rank,int type) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (type == 0) { if (i > 0) { if ((list[i].n1 - list[i - 1].n1) == 0) return list[i]; } } if (type == 1) { if (i > 0) { if ((list[i].n2 - list[i - 1].n2) == 0) return list[i]; } } if (type == 2) { if (i > 0) { if ((list[i].n3 - list[i - 1].n3) == 0) return list[i]; } } if (type == 3) { if (i > 0) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Max(); int lastn = new List { list[i - 1].n1, list[i - 1].n2, list[i - 1].n3 }.Max(); if ((n - lastn) == 0) return list[i]; } } if (type == 4) { if (i > 0) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); int lastn = new List { list[i - 1].n1, list[i - 1].n2, list[i - 1].n3 }.Min(); if ((n - lastn) == 0) return list[i]; } } } return info; } /// /// 非重号的数据 /// /// /// /// public static FcsdInfo GetLastNNotChFcsdInfo(ref List list, int rank, int type) { FcsdInfo info = new FcsdInfo(); int size = list.Count; for (int i = rank - 2; i >= 0; i--) { if (type == 0) { if (i > 0) { if ((list[i].n1 - list[i - 1].n1) != 0) return list[i]; } } if (type == 1) { if (i > 0) { if ((list[i].n2 - list[i - 1].n2) != 0) return list[i]; } } if (type == 2) { if (i > 0) { if ((list[i].n3 - list[i - 1].n3) != 0) return list[i]; } } if (type == 3) { if (i > 0) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Max(); int lastn = new List { list[i-1].n1, list[i-1].n2, list[i-1].n3 }.Max(); if ((n-lastn) != 0) return list[i]; } } if (type == 4) { if (i > 0) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); int lastn = new List { list[i - 1].n1, list[i - 1].n2, list[i - 1].n3 }.Min(); if ((n - lastn) != 0) return list[i]; } } } return info; } #endregion #region 3D号码冷热 /// /// 百十个位上的某个号码最近size期是否有出现过. /// 出现过为热,否则为冷号 /// /// /// /// /// public static bool GetFcsdHmLrInfo(ref List list, int val, int type, int size,int rank) { FcsdInfo info = new FcsdInfo(); info = GetLastFcsdInfo(ref list,val, rank, type); if ((rank - info.rank) <= size) return true; return false; } /// /// 上一次某位号码是冷/热号的情况.. /// /// /// /// public static FcsdInfo GetFcsdLastHmHrInfo(ref List list, int type,int size, int rank,bool iscool) { FcsdInfo info = new FcsdInfo(); if (list != null && list.Count > 0) { for (int i = rank - 2; i >= 0; i--) { if (iscool) { if (type == 0) { if (!GetFcsdHmLrInfo(ref list,list[i].n1, type, size, list[i].rank)) return list[i]; } if (type == 1) { if (!GetFcsdHmLrInfo(ref list,list[i].n2, type, size, list[i].rank)) return list[i]; } if (type == 2) { if (!GetFcsdHmLrInfo(ref list,list[i].n3, type, size, list[i].rank)) return list[i]; } if (type == 4) { int n = new List {list[i].n1,list[i].n2,list[i].n3 }.Max(); if (!GetFcsdHmLrInfo(ref list,n, type, size, list[i].rank)) return list[i]; } if (type == 5) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); if (!GetFcsdHmLrInfo(ref list,n, type, size, list[i].rank)) return list[i]; } } if (!iscool) { if (type == 0) { if (GetFcsdHmLrInfo(ref list,list[i].n1, type, size, list[i].rank)) return list[i]; } if (type == 1) { if (GetFcsdHmLrInfo(ref list,list[i].n2, type, size, list[i].rank)) return list[i]; } if (type == 2) { if (GetFcsdHmLrInfo(ref list,list[i].n3, type, size, list[i].rank)) return list[i]; } if (type == 4) { int n = new List {list[i].n1,list[i].n2,list[i].n3 }.Max(); if (GetFcsdHmLrInfo(ref list,n, type, size, list[i].rank)) return list[i]; } if (type == 5) { int n = new List { list[i].n1, list[i].n2, list[i].n3 }.Min(); if (GetFcsdHmLrInfo(ref list,n, type, size, list[i].rank)) return list[i]; } } } } return info; } #endregion /// /// 返回最新10条期数 /// /// public static List GetFcsdQiListTop10() { string key = string.Format(CacheKeys.FCSD_DC_DATA + "/qilisttop10"); List list = cache.GetObject>(key) as List; if (list == null) { list = FcsdData.GetQiListTop10(); cache.AddObject(key, list, (int)CacheTime.Kjh); } return list; } #region 开奖公告相关方法 /// /// 福彩3D最近30期开奖数据,完整开奖信息,有缓存 /// /// public static List GetFcsdKjihListTop30(int pagesize=30) { string key = string.Format(CacheKeys.FCSD_KJH_DATA+"-{0}",pagesize); List list = cache.GetObject>(key) as List; if (list == null) { list = FcsdData.GetFcsdTop30(pagesize); cache.AddObject(key, list, (int)CacheTime.Kjh); } return list; } public static List GetFcsdListTop30(int pagesize=30) { List list = GetFcsdKjihListTop30(pagesize); List rlist = new List(); for (int i = 0; i < list.Count; i++) { if (list[i].sjh >= 0) rlist.Add(list[i]); } return rlist; } /// /// 获取最新一期开奖信息,完整开奖信息,有缓存 /// /// public static FcsdlongInfo GetFcsdInfoTop1(ref List list) { FcsdlongInfo info = new FcsdlongInfo(); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { if (list[i].n1 >= 0) { info = list[i]; return info; } } } return info; } /// /// 获取最新一期试机号信息,有缓存 /// /// public static FcsdlongInfo GetFcsdSjhTop1() { FcsdlongInfo info = new FcsdlongInfo(); List list = GetFcsdListTop30(); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { if (list[i].sjh >= 0) { info = list[i]; return info; } } } return info; } /// /// 获取最新一期试机号信息,有缓存 /// /// public static FcsdlongInfo GetFcsdkjihTop1() { FcsdlongInfo info = new FcsdlongInfo(); List list = GetFcsdKjihListTop30(); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { if (list[i].kjih >= 0) { info = list[i]; return info; } } } return info; } /// /// 根据期数返回某期完整开奖信息,无缓存 /// /// /// public static FcsdlongInfo GetFcsdInfoByqi(int qi) { return FcsdData.GetFcsdInfoByQi(qi); } /// /// 返回福彩3D某年对应的期数列表,有缓存 /// /// /// public static List GetFcsdQiListByYear(int year) { string key = string.Format(CacheKeys.FCSD_KJH_DATA + "/qilistbyyear/{0}", year); List list = cache.GetObject>(key) as List; if (list == null) { list = FcsdData.GetFcsdQiListByYear(year); cache.AddObject(key, list, (int)CacheTime.System); } return list; } #endregion } }