예제 #1
0
        /// <summary>
        /// 日柱
        /// </summary>
        /// <returns></returns>
        private GanZhi GetLunarDay()
        {
            TianGan rg = GetDayGan(Value);
            DiZhi   rz = GetDayZhi(Value);

            return(new GanZhi(rg, rz));
        }
예제 #2
0
파일: HFDate.cs 프로젝트: Loong-Lee/VSDT
        private TianGan GetTimeGan(TianGanTypes rg, DiZhiTypes sc)
        {
            TianGanTypes jia;
            int          i = ((int)sc) - 1;

            if ((rg == TianGanTypes.Jia) || (rg == TianGanTypes.Ji))
            {
                jia = TianGanTypes.Jia;
            }
            else if ((rg == TianGanTypes.Yi) || (rg == TianGanTypes.Geng))
            {
                jia = TianGanTypes.Bing;
            }
            else if ((rg == TianGanTypes.Bing) || (rg == TianGanTypes.Xin))
            {
                jia = TianGanTypes.Wu;
            }
            else if ((rg == TianGanTypes.Ding) || (rg == TianGanTypes.Ren))
            {
                jia = TianGanTypes.Geng;
            }
            else
            {
                jia = TianGanTypes.Ren;
            }
            TianGan gan = new TianGan(jia);

            return(gan.Inc(i));
        }
예제 #3
0
파일: HFDate.cs 프로젝트: Loong-Lee/VSDT
        private TianGan GetMonthGanByYear(TianGanTypes ng, int m1)
        {
            TianGanTypes bing;
            int          num = Math.Abs(m1);

            if ((ng == TianGanTypes.Jia) || (ng == TianGanTypes.Ji))
            {
                bing = TianGanTypes.Bing;
            }
            else if ((ng == TianGanTypes.Yi) || (ng == TianGanTypes.Geng))
            {
                bing = TianGanTypes.Wu;
            }
            else if ((ng == TianGanTypes.Bing) || (ng == TianGanTypes.Xin))
            {
                bing = TianGanTypes.Geng;
            }
            else if ((ng == TianGanTypes.Ding) || (ng == TianGanTypes.Ren))
            {
                bing = TianGanTypes.Ren;
            }
            else
            {
                bing = TianGanTypes.Jia;
            }
            TianGan gan = new TianGan(bing);

            return(gan.Inc(num - 1));
        }
예제 #4
0
        /// <summary>
        /// 日上起时干
        /// </summary>
        /// <param name="rg">日干</param>
        /// <param name="sc">时辰</param>
        /// <returns>时干</returns>
        private TianGan GetTimeGan(TianGanTypes rg, DiZhiTypes sc)
        {
            int          sc1 = ((int)sc) - 1;
            TianGanTypes tg;

            if ((rg == TianGanTypes.Jia) || (rg == TianGanTypes.Ji))
            {
                tg = TianGanTypes.Jia;
            }
            else if ((rg == TianGanTypes.Yi) || (rg == TianGanTypes.Geng))
            {
                tg = TianGanTypes.Bing;
            }
            else if ((rg == TianGanTypes.Bing) || (rg == TianGanTypes.Xin))
            {
                tg = TianGanTypes.Wu;
            }
            else if ((rg == TianGanTypes.Ding) || (rg == TianGanTypes.Ren))
            {
                tg = TianGanTypes.Geng;
            }
            else
            {
                tg = TianGanTypes.Ren;
            }
            TianGan t = new TianGan(tg);

            return(t.Inc(sc1));
        }
예제 #5
0
        /// <summary>
        /// 年上取月干
        /// </summary>
        /// <param name="ng">年干</param>
        /// <param name="m1">农历月份</param>
        /// <returns>月干</returns>
        private TianGan GetMonthGanByYear(TianGanTypes ng, int m1) //年上取月干
        {
            int          m = Math.Abs(m1);
            TianGanTypes tg;

            if ((ng == TianGanTypes.Jia) || (ng == TianGanTypes.Ji))
            {
                tg = TianGanTypes.Bing;
            }
            else if ((ng == TianGanTypes.Yi) || (ng == TianGanTypes.Geng))
            {
                tg = TianGanTypes.Wu;
            }
            else if ((ng == TianGanTypes.Bing) || (ng == TianGanTypes.Xin))
            {
                tg = TianGanTypes.Geng;
            }
            else if ((ng == TianGanTypes.Ding) || (ng == TianGanTypes.Ren))
            {
                tg = TianGanTypes.Ren;
            }
            else
            {
                tg = TianGanTypes.Jia;
            }
            TianGan t = new TianGan(tg);

            return(t.Inc(m - 1));
        }
예제 #6
0
파일: ganzhi.cs 프로젝트: xuanximoming/key
        /// <summary>
        /// 获取增加指定的数值后的干支实例
        /// </summary>
        /// <param name="i">增加的数值</param>
        /// <returns>干支</returns>
        public GanZhi Inc(int i)
        {
            TianGan t = _tg.Inc(i);
            DiZhi   d = _dz.Inc(i);

            return(new GanZhi(t, d));
        }
예제 #7
0
        /// <summary>
        /// 取时柱
        /// </summary>
        /// <returns></returns>
        private GanZhi GetLunarTime()
        {
            GanZhi  rz = LunarDay;
            DiZhi   sz = HourToDiZhi(Value.Hour);
            TianGan sg = GetTimeGan(rz.Gan.ID, sz.ID);

            return(new GanZhi(sg, sz));
        }
예제 #8
0
파일: HFDate.cs 프로젝트: Loong-Lee/VSDT
        private GanZhi GetLunarMonth()
        {
            int     lunarCalendarMonth = this.LunarCalendarMonth;
            GanZhi  lunarYear          = this.LunarYear;
            TianGan monthGanByYear     = this.GetMonthGanByYear(lunarYear.Gan.ID, lunarCalendarMonth);

            return(new GanZhi(monthGanByYear, this.MonthToDiZhi(lunarCalendarMonth)));
        }
예제 #9
0
        /// <summary>
        /// 取某天的日干
        /// </summary>
        /// <param name="dt">日期</param>
        /// <returns>日干</returns>
        private TianGan GetDayGan(DateTime dt)
        {
            System.DateTime dt1 = new System.DateTime(2000, 2, 5, 12, 0, 0, 0);//以2000.2.5为基准
            System.DateTime dt2 = new System.DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0);
            int             n   = (dt2 - dt1).Days;
            TianGan         tg  = new TianGan(TianGanTypes.Gui);

            return(tg.Inc(n));
        }
예제 #10
0
        /// <summary>
        /// 取本日期的月柱
        /// </summary>
        /// <returns></returns>
        private GanZhi GetLunarMonth()
        {
            int     m  = LunarCalendarMonth;
            GanZhi  nz = LunarYear;
            TianGan tg = GetMonthGanByYear(nz.Gan.ID, m);
            DiZhi   dz = MonthToDiZhi(m);

            return(new GanZhi(tg, dz));
        }
예제 #11
0
파일: HFDate.cs 프로젝트: Loong-Lee/VSDT
        private TianGan GetDayGan(DateTime dt)
        {
            DateTime time  = new DateTime(0x7d0, 2, 5, 12, 0, 0, 0);
            DateTime time2 = new DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0);
            TimeSpan span  = (TimeSpan)(time2 - time);
            int      days  = span.Days;
            TianGan  gan   = new TianGan(TianGanTypes.Gui);

            return(gan.Inc(days));
        }
예제 #12
0
파일: HFDate.cs 프로젝트: Loong-Lee/VSDT
        private TianGan GetYearTianGan(int y)
        {
            int     i   = y - 0x7d0;
            TianGan gan = new TianGan(TianGanTypes.Geng);

            if (i == 0)
            {
                return(gan);
            }
            return(gan.Inc(i));
        }
예제 #13
0
파일: HFDate.cs 프로젝트: Loong-Lee/VSDT
        private GanZhi GetLunarYear()
        {
            int      year           = this.Value.Year;
            DateTime springFestival = GetSpringFestival(this.Value.Year);
            DateTime time2          = new DateTime(this.Value.Year, this.Value.Month, this.Value.Day, 0, 0, 0, 0);

            if (time2 < springFestival)
            {
                year--;
            }
            TianGan yearTianGan = this.GetYearTianGan(year);

            return(new GanZhi(yearTianGan, this.GetYearDiZhi(year)));
        }
예제 #14
0
        /// <summary>
        /// 取指定公历年的天干
        /// </summary>
        /// <param name="y">年份</param>
        /// <returns>天干</returns>
        private TianGan GetYearTianGan(int y)
        {
            int     i  = y - 2000;//以2000年为基准
            TianGan tg = new TianGan(TianGanTypes.Geng);

            if (i == 0)
            {
                return(tg);
            }
            else
            {
                return(tg.Inc(i));
            }
        }
예제 #15
0
        /// <summary>
        /// 获取本日期的年柱
        /// </summary>
        /// <returns></returns>
        private GanZhi GetLunarYear()
        {
            int      y  = Value.Year;
            DateTime d1 = GetSpringFestival(Value.Year);//获取该年的正月初一的公历日期
            DateTime d2 = new DateTime(Value.Year, Value.Month, Value.Day, 0, 0, 0, 0);

            if (d2 < d1)
            {
                y--;
            }
            TianGan tg = GetYearTianGan(y);
            DiZhi   dz = GetYearDiZhi(y);

            return(new GanZhi(tg, dz));
        }
예제 #16
0
파일: HFDate.cs 프로젝트: sunpander/VSDT
 private TianGan GetMonthGanByYear(TianGanTypes ng, int m1)
 {
     TianGanTypes bing;
     int num = Math.Abs(m1);
     if ((ng == TianGanTypes.Jia) || (ng == TianGanTypes.Ji))
     {
         bing = TianGanTypes.Bing;
     }
     else if ((ng == TianGanTypes.Yi) || (ng == TianGanTypes.Geng))
     {
         bing = TianGanTypes.Wu;
     }
     else if ((ng == TianGanTypes.Bing) || (ng == TianGanTypes.Xin))
     {
         bing = TianGanTypes.Geng;
     }
     else if ((ng == TianGanTypes.Ding) || (ng == TianGanTypes.Ren))
     {
         bing = TianGanTypes.Ren;
     }
     else
     {
         bing = TianGanTypes.Jia;
     }
     TianGan gan = new TianGan(bing);
     return gan.Inc(num - 1);
 }
예제 #17
0
파일: HFDate.cs 프로젝트: sunpander/VSDT
 private TianGan GetDayGan(DateTime dt)
 {
     DateTime time = new DateTime(0x7d0, 2, 5, 12, 0, 0, 0);
     DateTime time2 = new DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0);
     TimeSpan span = (TimeSpan) (time2 - time);
     int days = span.Days;
     TianGan gan = new TianGan(TianGanTypes.Gui);
     return gan.Inc(days);
 }
예제 #18
0
파일: GanZhi.cs 프로젝트: sunpander/VSDT
 public GanZhi(TianGanTypes atg, DiZhiTypes adz)
 {
     this._tg = new TianGan(atg);
     this._dz = new DiZhi(adz);
 }
예제 #19
0
파일: GanZhi.cs 프로젝트: sunpander/VSDT
 public GanZhi(TianGan atg, DiZhi adz)
 {
     this._tg = atg;
     this._dz = adz;
 }
예제 #20
0
파일: ganzhi.cs 프로젝트: xuanximoming/key
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="atg">天干</param>
 /// <param name="adz">地支</param>
 public GanZhi(TianGan atg, DiZhi adz)
 {
     _tg = atg;
     _dz = adz;
 }
예제 #21
0
파일: ganzhi.cs 프로젝트: xuanximoming/key
 /// <summary>
 /// 构造函数
 /// </summary>
 public GanZhi()
 {
     _tg = new TianGan(TianGanTypes.Jia);
     _dz = new DiZhi(DiZhiTypes.Zi);
 }
예제 #22
0
파일: GanZhi.cs 프로젝트: Loong-Lee/VSDT
 public GanZhi()
 {
     this._tg = new TianGan(TianGanTypes.Jia);
     this._dz = new DiZhi(DiZhiTypes.Zi);
 }
예제 #23
0
파일: HFDate.cs 프로젝트: sunpander/VSDT
 private TianGan GetTimeGan(TianGanTypes rg, DiZhiTypes sc)
 {
     TianGanTypes jia;
     int i = ((int) sc) - 1;
     if ((rg == TianGanTypes.Jia) || (rg == TianGanTypes.Ji))
     {
         jia = TianGanTypes.Jia;
     }
     else if ((rg == TianGanTypes.Yi) || (rg == TianGanTypes.Geng))
     {
         jia = TianGanTypes.Bing;
     }
     else if ((rg == TianGanTypes.Bing) || (rg == TianGanTypes.Xin))
     {
         jia = TianGanTypes.Wu;
     }
     else if ((rg == TianGanTypes.Ding) || (rg == TianGanTypes.Ren))
     {
         jia = TianGanTypes.Geng;
     }
     else
     {
         jia = TianGanTypes.Ren;
     }
     TianGan gan = new TianGan(jia);
     return gan.Inc(i);
 }
예제 #24
0
파일: HFDate.cs 프로젝트: sunpander/VSDT
 private TianGan GetYearTianGan(int y)
 {
     int i = y - 0x7d0;
     TianGan gan = new TianGan(TianGanTypes.Geng);
     if (i == 0)
     {
         return gan;
     }
     return gan.Inc(i);
 }
예제 #25
0
파일: GanZhi.cs 프로젝트: Loong-Lee/VSDT
 public GanZhi(TianGan atg, DiZhi adz)
 {
     this._tg = atg;
     this._dz = adz;
 }
예제 #26
0
파일: ganzhi.cs 프로젝트: xuanximoming/key
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="atg">天干枚举</param>
 /// <param name="adz">地支枚举</param>
 public GanZhi(TianGanTypes atg, DiZhiTypes adz)
 {
     _tg = new TianGan(atg);
     _dz = new DiZhi(adz);
 }
예제 #27
0
파일: GanZhi.cs 프로젝트: Loong-Lee/VSDT
        public GanZhi Inc(int i)
        {
            TianGan atg = this._tg.Inc(i);

            return(new GanZhi(atg, this._dz.Inc(i)));
        }
예제 #28
0
파일: HFDate.cs 프로젝트: Loong-Lee/VSDT
        private GanZhi GetLunarDay()
        {
            TianGan dayGan = this.GetDayGan(this.Value);

            return(new GanZhi(dayGan, this.GetDayZhi(this.Value)));
        }
예제 #29
0
파일: GanZhi.cs 프로젝트: sunpander/VSDT
 public GanZhi()
 {
     this._tg = new TianGan(TianGanTypes.Jia);
     this._dz = new DiZhi(DiZhiTypes.Zi);
 }