Exemple #1
0
 public LiuNian(DaYun daYun, int index)
 {
     this.daYun = daYun;
     this.lunar = daYun.getLunar();
     this.index = index;
     this.year  = daYun.getStartYear() + index;
     this.age   = daYun.getStartAge() + index;
 }
Exemple #2
0
 public XiaoYun(DaYun daYun, int index, bool forward)
 {
     this.daYun   = daYun;
     this.lunar   = daYun.getLunar();
     this.index   = index;
     this.year    = daYun.getStartYear() + index;
     this.age     = daYun.getStartAge() + index;
     this.forward = forward;
 }
Exemple #3
0
        /// <summary>
        /// 获取干支
        /// </summary>
        /// <returns>干支</returns>
        public string getGanZhi()
        {
            int offset = LunarUtil.getJiaZiIndex(lunar.getYearInGanZhiExact()) + this.index;

            if (daYun.getIndex() > 0)
            {
                offset += daYun.getStartAge() - 1;
            }
            offset %= LunarUtil.JIA_ZI.Length;
            return(LunarUtil.JIA_ZI[offset]);
        }
Exemple #4
0
        /// <summary>
        /// 获取干支
        /// </summary>
        /// <returns>干支</returns>
        public string getGanZhi()
        {
            int offset = LunarUtil.getJiaZiIndex(lunar.getTimeInGanZhi());
            int add    = this.index + 1;

            if (daYun.getIndex() > 0)
            {
                add += daYun.getStartAge() - 1;
            }
            offset += forward ? add : -add;
            int size = LunarUtil.JIA_ZI.Length;

            while (offset < 0)
            {
                offset += size;
            }
            offset %= size;
            return(LunarUtil.JIA_ZI[offset]);
        }