Exemplo n.º 1
0
 public override string ToString()
 {
     return(string.Format("{0}: {1}  {2}: {3}  {4}: {5}",
                          GCStrings.getString(10), GCEarthData.GetTextLatitude(latitudeDeg),
                          GCStrings.getString(11), GCEarthData.GetTextLongitude(longitudeDeg),
                          GCStrings.Localized("Timezone"), TTimeZone.GetTimeZoneOffsetText(OffsetUtcHours)));
 }
Exemplo n.º 2
0
        public static string GetParanaReasonText(int eparana_type)
        {
            switch (eparana_type)
            {
            case CoreEventType.CCTYPE_THIRD_OF_DAY:
                return(GCStrings.Localized("1/3 of daylight"));

            case CoreEventType.CCTYPE_TITHI_QUARTER:
                return(GCStrings.Localized("1/4 of tithi"));

            case CoreEventType.CCTYPE_S_RISE:
                return(GCStrings.Localized("sunrise"));

            case CoreEventType.CCTYPE_TITHI_END:
                return(GCStrings.Localized("end of tithi"));

            case CoreEventType.CCTYPE_NAKS_END:
                return(GCStrings.Localized("end of naksatra"));

            default:
                break;
            }

            return("");
        }
Exemplo n.º 3
0
 public string GetFullName()
 {
     return(string.Format("{0} ({1}, {2}, {3}: {4})"
                          , Title
                          , GCEarthData.GetTextLatitude(Latitude)
                          , GCEarthData.GetTextLongitude(Longitude)
                          , GCStrings.Localized("Timezone")
                          , TimeZoneName));
 }
Exemplo n.º 4
0
        protected void CalculateSankrantis()
        {
            VAISNAVADAY targetDay = null;

            foreach (VAISNAVADAY today in m_pData)
            {
                targetDay = null;
                int n = 0;
                foreach (TCoreEvent ce in today.coreEvents)
                {
                    switch (ce.nType)
                    {
                    case CoreEventType.CCTYPE_SANK:
                        switch (GCSankranti.GetSankrantiType())
                        {
                        case 0: targetDay = today; break;

                        case 1: targetDay = (n >= 1 ? today : today.Previous); break;

                        case 2: targetDay = (n >= 2 ? today.Next : today); break;

                        case 3: targetDay = (n >= 3 ? today.Next : today); break;
                        }
                        if (targetDay != null)
                        {
                            targetDay.sankranti_day    = today.GetGregorianDateTime(ce);
                            targetDay.sankranti_zodiac = ce.nData;
                        }
                        break;

                    case CoreEventType.CCTYPE_S_RISE: n = 1; break;

                    case CoreEventType.CCTYPE_S_NOON: n = 2; break;

                    case CoreEventType.CCTYPE_S_SET:  n = 3; break;
                    }

                    if (targetDay != null)
                    {
                        string        str = targetDay.Format(GCStrings.Localized("  {sankranti.rasiName} Sankranti (Sun enters {sankranti.rasiNameEn} on {sankranti.day} {sankranti.monthAbr}, {sankranti.hour}:{sankranti.minRound}) ({dstSig})"));
                        VAISNAVAEVENT dc  = targetDay.AddEvent(DisplayPriorities.PRIO_SANKRANTI, GCDS.CAL_SANKRANTI, str);
                        dc.spec = "sankranti";
                        break;
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dow">from range 0..6</param>
        /// <returns></returns>
        public static string GetWeekdayAbbr(int dow)
        {
            switch (dow)
            {
            case 0: return(GCStrings.Localized("Su"));

            case 1: return(GCStrings.Localized("Mo"));

            case 2: return(GCStrings.Localized("Tu"));

            case 3: return(GCStrings.Localized("We"));

            case 4: return(GCStrings.Localized("Th"));

            case 5: return(GCStrings.Localized("Fr"));

            case 6: return(GCStrings.Localized("Sa"));
            }
            return("");
        }
Exemplo n.º 6
0
        public static string GetWeekdayName(int dow)
        {
            switch (dow)
            {
            case 0: return(GCStrings.Localized("Sunday"));

            case 1: return(GCStrings.Localized("Monday"));

            case 2: return(GCStrings.Localized("Tuesday"));

            case 3: return(GCStrings.Localized("Wednesday"));

            case 4: return(GCStrings.Localized("Thursday"));

            case 5: return(GCStrings.Localized("Friday"));

            case 6: return(GCStrings.Localized("Saturday"));
            }
            return("");
        }
Exemplo n.º 7
0
        private void CalculateKsayaVriddhiTithis()
        {
            GCEarthData earth = m_Location.GetEarthData();

            foreach (VAISNAVADAY t in m_pData)
            {
                VAISNAVADAY s = t.Previous;

                if (s == null)
                {
                    continue;
                }

                if (t.astrodata.sunRise.Tithi == s.astrodata.sunRise.Tithi)
                {
                    t.vriddhiDayNo = 2;
                    if (GCDisplaySettings.Current.getValue(GCDS.CAL_VRDDHI) != 0)
                    {
                        t.AddEvent(DisplayPriorities.PRIO_KSAYA, GCDS.CAL_VRDDHI, GCStrings.getString(90));
                    }
                }
                else if (t.astrodata.sunRise.Tithi != GCTithi.NEXT_TITHI(s.astrodata.sunRise.Tithi))
                {
                    s.ksayaTithi = GCTithi.NEXT_TITHI(s.astrodata.sunRise.Tithi);
                    s.ksayaMasa  = (s.ksayaTithi == 0 ? t.astrodata.Masa : s.astrodata.Masa);
                    int    idx = 0;
                    String str;

                    List <VAISNAVADAY.CoreEventFindRec> tithiTimes = t.GetRecentCoreTimes(CoreEventType.CCTYPE_S_RISE, CoreEventType.CCTYPE_TITHI, 2);

                    if (tithiTimes.Count == 2)
                    {
                        str = t.Format(GCStrings.Localized("Kshaya tithi: {prevTithiName} — {0} to {1} ({dstSig})"),
                                       tithiTimes[0].dateTimeOfEvent.Format("{day} {monthAbr} {hour}:{minRound}"),
                                       tithiTimes[1].dateTimeOfEvent.Format("{day} {monthAbr} {hour}:{minRound}"));

                        t.AddEvent(DisplayPriorities.PRIO_KSAYA, GCDS.CAL_KSAYA, str);
                    }
                }
            }
        }
Exemplo n.º 8
0
        public static string GetMahadvadasiName(int i)
        {
            switch (i)
            {
            case MahadvadasiType.EV_NULL:
            case MahadvadasiType.EV_SUDDHA:
                return(null);

            case MahadvadasiType.EV_UNMILANI:
                return(GCStrings.Localized("Unmilani Mahadvadasi"));

            case MahadvadasiType.EV_TRISPRSA:
            case MahadvadasiType.EV_UNMILANI_TRISPRSA:
                return(GCStrings.Localized("Trisprsa Mahadvadasi"));

            case MahadvadasiType.EV_PAKSAVARDHINI:
                return(GCStrings.Localized("Paksa vardhini Mahadvadasi"));

            case MahadvadasiType.EV_JAYA:
                return(GCStrings.Localized("Jaya Mahadvadasi"));

            case MahadvadasiType.EV_VIJAYA:
                return(GCStrings.Localized("Vijaya Mahadvadasi"));

            case MahadvadasiType.EV_PAPA_NASINI:
                return(GCStrings.Localized("Papa Nasini Mahadvadasi"));

            case MahadvadasiType.EV_JAYANTI:
                return(GCStrings.Localized("Jayanti Mahadvadasi"));

            case MahadvadasiType.EV_VYANJULI:
                return(GCStrings.Localized("Vyanjuli Mahadvadasi"));

            default:
                return("(Unknown Mahadvadasi)");
            }
        }
Exemplo n.º 9
0
 public static string GetMuhurtaName(int i)
 {
     return(GCStrings.Localized(p_muhurtaName[i % 30]));
 }
Exemplo n.º 10
0
        /// <summary>
        /// Main function for CALENDAR calculations
        /// </summary>
        /// <param name="loc"></param>
        /// <param name="begDate"></param>
        /// <param name="iCount"></param>
        /// <returns></returns>
        public int CalculateCalendar(GCLocation loc, GregorianDateTime begDate, int iCount)
        {
            int i, weekday;
            int nTotalCount = BEFORE_DAYS + iCount + BEFORE_DAYS;
            GregorianDateTime date;
            GCEarthData       earth;
            int    lastMasa  = 0;
            int    lastGYear = 0;
            String tempStr;
            bool   bCalcMoon = (GCDisplaySettings.Current.getValue(4) > 0 || GCDisplaySettings.Current.getValue(5) > 0);

            m_nCount   = 0;
            m_Location = loc;
            m_vcStart  = new GregorianDateTime(begDate);
            m_vcCount  = iCount;
            earth      = loc.GetEarthData();

            // alokacia pola
            m_pData = new VAISNAVADAY[nTotalCount];

            // inicializacia poctovych premennych
            m_nCount    = nTotalCount;
            m_PureCount = iCount;

            date = new GregorianDateTime();
            date.Set(begDate);
            date.shour         = 0.0;
            date.TimezoneHours = loc.OffsetUtcHours;
            date.SubtractDays(BEFORE_DAYS);
            date.InitWeekDay();

            weekday = date.dayOfWeek;

            GCFestivalSpecialExecutor exec = new GCFestivalSpecialExecutor(this);

            long utcDayStart = -1;
            long utcDayEnd   = -1;

            // 1
            // initialization of days
            for (i = 0; i < nTotalCount; i++)
            {
                m_pData[i]                = new VAISNAVADAY();
                m_pData[i].date           = new GregorianDateTime(date);
                m_pData[i].date.dayOfWeek = weekday;
                date.NextDay();
                weekday = (weekday + 1) % 7;
                m_pData[i].moonrise.SetValue(-1);
                m_pData[i].moonset.SetValue(-1);

                if (utcDayStart < 0)
                {
                    utcDayStart = Convert.ToInt64(m_pData[i].date.GetJulianComplete() * 86400);
                }
                m_pData[i].UtcDayStart = utcDayStart;
                utcDayStart           += 86400;
            }

            for (i = 0; i < nTotalCount; i++)
            {
                m_pData[i].Previous = i > 0 ? m_pData[i - 1] : null;
                m_pData[i].Next     = i < nTotalCount - 1 ? m_pData[i + 1] : null;
            }

            TResultCoreEvents recentEvents = null;

            // 2
            // calculating DST data and core events
            foreach (VAISNAVADAY t in m_pData)
            {
                t.BiasMinutes = loc.TimeZone.GetBiasMinutesForDay(t.date);
                if (t.Previous != null)
                {
                    t.DstDayType = (t.BiasMinutes == 0
                        ? (t.Previous.BiasMinutes == 0 ? DstTypeChange.DstOff : DstTypeChange.DstEnd)
                        : (t.Previous.BiasMinutes == 0 ? DstTypeChange.DstStart : DstTypeChange.DstOn));
                }

                utcDayStart = t.UtcDayStart - (t.Previous != null ? t.Previous.BiasMinutes * 60 : 0);
                utcDayEnd   = t.UtcDayStart + 86400 - t.BiasMinutes * 60;

                if (recentEvents == null || recentEvents.p_events.Count == 0 || recentEvents.Year != t.date.year)
                {
                    recentEvents = GCCoreAstronomy.GetCoreEventsYear(loc, t.date.year);
                }
                recentEvents.GetCoreEvents(t.coreEvents, utcDayStart, utcDayEnd);


                utcDayStart = utcDayEnd;
            }

            // 3
            if (bCalcMoon)
            {
                foreach (VAISNAVADAY t in m_pData)
                {
                    GCMoonData.CalcMoonTimes(earth, t.date, Convert.ToDouble(t.BiasMinutes / 60.0), out t.moonrise, out t.moonset);

                    if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_MOON_RISE) != 0 && t.moonrise.hour >= 0)
                    {
                        tempStr = t.Format(GCStrings.Localized("Moonrise {moonRiseTime} ({dstSig})"));
                        t.AddEvent(DisplayPriorities.PRIO_MOON, GCDS.CAL_MOON_RISE, tempStr);
                    }

                    if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_MOON_SET) != 0 && t.moonset.hour >= 0)
                    {
                        tempStr = t.Format(GCStrings.Localized("Moonset {moonSetTime} ({dstSig})"));
                        t.AddEvent(DisplayPriorities.PRIO_MOON, GCDS.CAL_MOON_SET, tempStr);
                    }
                }
            }

            // 4
            // init of astro data
            foreach (VAISNAVADAY t in m_pData)
            {
                t.astrodata = new GCAstroData();
                t.astrodata.DayCalc(t.date, earth);

                t.coreEvents.InsertByTime(new TCoreEvent()
                {
                    Time  = t.UtcDayStart + (long)t.astrodata.sunArunodaya.TotalSeconds,
                    nType = CoreEventType.CCTYPE_S_ARUN
                });
                t.coreEvents.InsertByTime(new TCoreEvent()
                {
                    Time  = t.UtcDayStart + (long)t.astrodata.sunRise.TotalSeconds,
                    nType = CoreEventType.CCTYPE_S_RISE
                });
                t.coreEvents.InsertByTime(new TCoreEvent()
                {
                    Time  = t.UtcDayStart + (long)t.astrodata.sunNoon.TotalSeconds,
                    nType = CoreEventType.CCTYPE_S_NOON
                });
                t.coreEvents.InsertByTime(new TCoreEvent()
                {
                    Time  = t.UtcDayStart + (long)t.astrodata.sunSet.TotalSeconds,
                    nType = CoreEventType.CCTYPE_S_SET
                });
            }

            // 5
            // init of masa
            foreach (VAISNAVADAY t in m_pData)
            {
                if (t.Previous == null ||
                    t.astrodata.sunRise.Paksa != t.Previous.astrodata.sunRise.Paksa)
                {
                    t.astrodata.MasaCalc(t.date, earth);
                    lastMasa  = t.astrodata.Masa;
                    lastGYear = t.astrodata.GaurabdaYear;
                }
                t.astrodata.Masa         = lastMasa;
                t.astrodata.GaurabdaYear = lastGYear;

                if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_SUN_LONG) != 0)
                {
                    tempStr = string.Format("{0}: {1} (*)", GCStrings.Localized("Sun Longitude")
                                            , t.astrodata.sunRise.longitude);
                    t.AddEvent(DisplayPriorities.PRIO_ASTRO, GCDS.CAL_SUN_LONG, tempStr);
                }

                if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_MOON_LONG) != 0)
                {
                    tempStr = string.Format("{0}: {1} (*)", GCStrings.Localized("Moon Longitude")
                                            , t.astrodata.sunRise.longitudeMoon);
                    t.AddEvent(DisplayPriorities.PRIO_ASTRO, GCDS.CAL_MOON_LONG, tempStr);
                }

                if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_AYANAMSHA) != 0)
                {
                    tempStr = string.Format("{0} {1} ({2}) (*)", GCStrings.Localized("Ayanamsha")
                                            , t.astrodata.Ayanamsa
                                            , GCAyanamsha.GetAyanamsaName(GCAyanamsha.GetAyanamsaType()));
                    t.AddEvent(DisplayPriorities.PRIO_ASTRO, GCDS.CAL_AYANAMSHA, tempStr);
                }

                if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_JULIAN) != 0)
                {
                    tempStr = string.Format("{0} {1} (*)", GCStrings.Localized("Julian Time")
                                            , t.astrodata.JulianDay);
                    t.AddEvent(DisplayPriorities.PRIO_ASTRO, GCDS.CAL_JULIAN, tempStr);
                }
            }


            if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_MASA_CHANGE) != 0)
            {
                String str;

                foreach (VAISNAVADAY t in m_pData)
                {
                    if (t.Previous != null && t.Previous.astrodata.Masa != t.astrodata.Masa)
                    {
                        str = t.Format(GCStrings.Localized("First day of {masaName} Masa"));
                        t.AddEvent(DisplayPriorities.PRIO_MASA_CHANGE, GCDS.CAL_MASA_CHANGE, str);
                    }

                    if (t.Next != null && t.Next.astrodata.Masa != t.astrodata.Masa)
                    {
                        str = t.Format(GCStrings.Localized("Last day of {masaName} Masa"));
                        t.AddEvent(DisplayPriorities.PRIO_MASA_CHANGE, GCDS.CAL_MASA_CHANGE, str);
                    }
                }
            }

            if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_DST_CHANGE) != 0)
            {
                foreach (VAISNAVADAY t in m_pData)
                {
                    if (t.Previous != null && t.Previous.BiasMinutes == 0 && t.BiasMinutes != 0)
                    {
                        t.AddEvent(DisplayPriorities.PRIO_DST_CHANGE, GCDS.CAL_DST_CHANGE, GCStrings.Localized("First day of Daylight Saving Time"));
                    }
                    else if (t.Next != null && t.BiasMinutes != 0 && t.Next.BiasMinutes == 0)
                    {
                        t.AddEvent(DisplayPriorities.PRIO_DST_CHANGE, GCDS.CAL_DST_CHANGE, GCStrings.Localized("Last day of Daylight Saving Time"));
                    }
                }
            }

            // 6
            // init of mahadvadasis
            foreach (VAISNAVADAY t in m_pData)
            {
                t.MahadvadasiCalc(earth);
            }

            //
            // init for Ekadasis
            foreach (VAISNAVADAY t in m_pData)
            {
                if (t.Previous == null)
                {
                    continue;
                }
                t.EkadasiCalc(earth);
                if (t.Previous.nFastID == FastType.FAST_EKADASI)
                {
                    t.CalculateEParana(earth);
                }
            }

            if (EkadasiOnly)
            {
                return(1);
            }

            // init ksaya data
            // init of second day of vriddhi
            CalculateKsayaVriddhiTithis();

            //
            // calculate sankrantis
            CalculateSankrantis();

            // 7
            // init of festivals
            AddMatchedFestivals(exec);

            //
            // apply daylight saving time
            ApplyDaylightSavingHours();

            //
            // resolve festivals fasting
            for (i = BEFORE_DAYS; i < m_PureCount + BEFORE_DAYS; i++)
            {
                ResolveFestivalsFasting(i);

                if (GCDisplaySettings.Current.getValue(GCDS.CAL_SUN_RISE) != 0)
                {
                    tempStr = string.Format("{0}-{1}-{2}  {3} - {4} - {5} ({6})",
                                            GCStrings.Localized("Sunrise"),
                                            GCStrings.Localized("Noon"),
                                            GCStrings.Localized("Sunset"),
                                            m_pData[i].astrodata.sunRise.ToShortTimeString(),
                                            m_pData[i].astrodata.sunNoon.ToShortTimeString(),
                                            m_pData[i].astrodata.sunSet.ToShortTimeString(),
                                            GCStrings.GetDSTSignature(m_pData[i].BiasMinutes));
                    m_pData[i].AddEvent(DisplayPriorities.PRIO_SUN, GCDS.CAL_SUN_RISE, tempStr);
                }

                if (GCDisplaySettings.Current.getValue(GCDS.CAL_SUN_SANDHYA) != 0)
                {
                    tempStr = string.Format("{0}: {1} | {2} | {3}   ({4})",
                                            GCStrings.Localized("Sandhyas"),
                                            m_pData[i].astrodata.sunRise.ShortSandhyaString(),
                                            m_pData[i].astrodata.sunNoon.ShortSandhyaString(),
                                            m_pData[i].astrodata.sunSet.ShortSandhyaString(),
                                            GCStrings.GetDSTSignature(m_pData[i].BiasMinutes));
                    m_pData[i].AddEvent(DisplayPriorities.PRIO_SUN, GCDS.CAL_SUN_SANDHYA, tempStr);
                }

                if (GCDisplaySettings.Current.getValue(GCDS.CAL_BRAHMA_MUHURTA) != 0)
                {
                    tempStr = string.Format("{0}: {1}   ({2})",
                                            GCStrings.Localized("Brahma Muhurta"),
                                            m_pData[i].astrodata.sunRise.ShortMuhurtaString(-2),
                                            GCStrings.GetDSTSignature(m_pData[i].BiasMinutes));
                    m_pData[i].AddEvent(DisplayPriorities.PRIO_SUN, GCDS.CAL_BRAHMA_MUHURTA, tempStr);
                }
            }

            if (GCDisplaySettings.Current.getValue(GCDS.CAL_COREEVENTS) != 0)
            {
                int number = 1;
                foreach (VAISNAVADAY today in m_pData)
                {
                    foreach (TCoreEvent tde in today.coreEvents)
                    {
                        m_pData[i].AddEvent(DisplayPriorities.PRIO_ASTRO + number, GCDS.CAL_COREEVENTS,
                                            tde.TypeString + "   " + today.GetCoreEventTime(tde));
                        number++;
                    }
                }
            }


            // sorting day events according priority
            VAISNAVAEVENTComparer vec = new VAISNAVAEVENTComparer();

            foreach (VAISNAVADAY t in m_pData)
            {
                t.dayEvents.Sort(vec);
            }


            return(1);
        }
Exemplo n.º 11
0
 public static string GetPadaText(int i)
 {
     return(GCStrings.Localized(p_padaText[i % 4]));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Retrieves name of tithi
 /// </summary>
 /// <param name="nTithi">Values 0..29, where 0 is for Pratipat in Krsna Paksa</param>
 /// <returns></returns>
 public static string GetName(int nTithi)
 {
     return(GCStrings.Localized(p_tithiName[nTithi % 30]));
 }
Exemplo n.º 13
0
 public static string GetSankMethodName(int i)
 {
     return(GCStrings.Localized(snam[i]));
 }
Exemplo n.º 14
0
 public static string GetName(int nNaksatra)
 {
     return(GCStrings.Localized(p_naksatraName[nNaksatra % 27]));
 }
Exemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="month">Month from range 1..12</param>
 /// <returns></returns>
 public static string GetMonthName(int month)
 {
     return(GCStrings.Localized(p_monthName[(month - 1) % 12]));
 }
Exemplo n.º 16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="month">Month from range 1..12</param>
 /// <returns></returns>
 public static string GetMonthAbreviation(int month)
 {
     return(GCStrings.Localized(p_monthNameAbbr[(month - 1) % 12]));
 }
Exemplo n.º 17
0
 /// <summary>
 /// Returns Vedic style of name of the month
 /// </summary>
 /// <param name="masaID"></param>
 /// <returns></returns>
 private static string GetVedicName(int masaID)
 {
     return(GCStrings.Localized(p_masaNameVedic[masaID % 13]));
 }
Exemplo n.º 18
0
 public static string GetDateTextWithTodayExt(GregorianDateTime vc)
 {
     if ((vc.day > 0) && (vc.day < 32) && (vc.month > 0) && (vc.month < 13) && (vc.year >= 1500) && (vc.year < 4000))
     {
         GregorianDateTime today = new GregorianDateTime();
         int diff = today.GetJulianInteger() - vc.GetJulianInteger();
         if (diff == 0)
         {
             return(string.Format("{0} {1} {2} ({3})", vc.day, GregorianDateTime.GetMonthAbreviation(vc.month), vc.year, GCStrings.Localized("Today")));
         }
         else if (diff == -1)
         {
             return(string.Format("{0} {1} {2} ({3})", vc.day, GregorianDateTime.GetMonthAbreviation(vc.month), vc.year, GCStrings.Localized("Tomorrow")));
         }
         else if (diff == 1)
         {
             return(string.Format("{0} {1} {2} ({3})", vc.day, GregorianDateTime.GetMonthAbreviation(vc.month), vc.year, GCStrings.Localized("Yesterday")));
         }
     }
     return(string.Format("{0} {1} {2}", vc.day, GregorianDateTime.GetMonthAbreviation(vc.month), vc.year));
 }
Exemplo n.º 19
0
 public static string GetName(int i)
 {
     return(i == 1
         ? GCStrings.Localized("Gaura")
         : GCStrings.Localized("Krsna"));
 }
Exemplo n.º 20
0
        public void calculateAppDay(GCLocation location, GregorianDateTime eventDate)
        {
            //MOONDATA moon;
            //SUNDATA sun;
            GCAstroData       d       = this.details = new GCAstroData();
            GregorianDateTime vc      = new GregorianDateTime();
            GregorianDateTime vcsun   = new GregorianDateTime();
            GCEarthData       m_earth = location.GetEarthData();

            vc.Set(eventDate);
            vcsun.Set(eventDate);

            this.b_adhika  = false;
            this.eventTime = new GregorianDateTime(eventDate);
            Location       = location;

            //d.nTithi = GetPrevTithiStart(m_earth, vc, dprev);
            //GetNextTithiStart(m_earth, vc, dnext);
            vcsun.shour -= vcsun.TimezoneHours / 24.0;
            vcsun.NormalizeValues();
            vcsun.TimezoneHours     = 0.0;
            d.sunRise               = new GCHourTime();
            d.sunRise.TotalDays     = vc.shour;
            d.sunRise.longitude     = GCCoreAstronomy.GetSunLongitude(vcsun, m_earth);
            d.sunRise.longitudeMoon = GCCoreAstronomy.GetMoonLongitude(vcsun, m_earth);
            d.Ayanamsa              = GCAyanamsha.GetAyanamsa(vc.GetJulianComplete());
            d.sunRise.Ayanamsa      = d.Ayanamsa;

            // tithi


            d.Masa = d.MasaCalc(vc, m_earth);
            if (d.Masa == (int)MasaId.ADHIKA_MASA)
            {
                d.Masa        = d.sunRise.RasiOfSun;
                this.b_adhika = true;
            }

            vc.Today();
            vc.TimezoneHours = m_earth.OffsetUtcHours;
            int               m  = 0;
            GaurabdaDate      va = new GaurabdaDate();
            GregorianDateTime vctemp;

            va.tithi = d.sunRise.Tithi;
            va.masa  = d.Masa;
            va.gyear = GCCalendar.GetGaurabdaYear(vc, m_earth);
            if (va.gyear < d.GaurabdaYear)
            {
                va.gyear = d.GaurabdaYear;
            }

            MainInfo.Add(new AppDayInfo(GCStrings.getString(7), eventDate.ToString()));
            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDayInfo(GCStrings.getString(8), eventDate.ShortTimeString()));
            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDayInfo(GCStrings.getString(9), location.Title));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(10), location.GetLatitudeString()));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(11), location.GetLongitudeString()));
            MainInfo.Add(new AppDayInfo(GCStrings.Localized("Timezone"), location.TimeZoneName));
            MainInfo.Add(new AppDayInfo("DST", "N/A"));
            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDayInfo(GCStrings.getString(13), GCTithi.GetName(d.sunRise.Tithi)));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(14), string.Format("{0:00.000}%", d.sunRise.TithiElapse)));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(15), GCNaksatra.GetName(d.sunRise.Naksatra)));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(16), string.Format("{0:00.000}% ({1} pada)", d.sunRise.NaksatraElapse, GCStrings.getString(811 + d.sunRise.NaksatraPada))));
            MainInfo.Add(new AppDayInfo(GCStrings.Localized("Moon Rasi"), GCRasi.GetName(d.sunRise.RasiOfMoon)));
            MainInfo.Add(new AppDayInfo(GCStrings.Localized("Sun Rasi"), GCRasi.GetName(d.sunRise.RasiOfSun)));
            MainInfo.Add(new AppDayInfo(GCStrings.getString(20), GCPaksa.GetName(d.sunRise.Paksa)));

            if (b_adhika == true)
            {
                MainInfo.Add(new AppDayInfo(GCStrings.getString(22), string.Format("{0} {1}", GCMasa.GetName(d.Masa), GCStrings.getString(21))));
            }
            else
            {
                MainInfo.Add(new AppDayInfo(GCStrings.getString(22), GCMasa.GetName(d.Masa)));
            }
            MainInfo.Add(new AppDayInfo(GCStrings.getString(23), d.GaurabdaYear.ToString()));

            if (GCDisplaySettings.Current.getValue(48) == 1)
            {
                MainInfo.Add(new AppDayBase(GCDS.APP_CHILDNAMES));
                MainInfo.Add(new AppDaySeparator(GCStrings.getString(17)));
                MainInfo.Add(new AppDayBase(GCDS.APP_CHILDNAMES));

                MainInfo.Add(new AppDayInfo(GCDS.APP_CHILDNAMES, GCStrings.getString(18), GCStrings.GetNaksatraChildSylable(d.sunRise.Naksatra, d.sunRise.NaksatraPada) + "..."));
                MainInfo.Add(new AppDayInfo(GCDS.APP_CHILDNAMES, GCStrings.getString(19), GCStrings.GetRasiChildSylable(d.sunRise.RasiOfMoon) + "..."));
            }

            MainInfo.Add(new AppDayBase());
            MainInfo.Add(new AppDaySeparator(GCStrings.getString(24)));
            MainInfo.Add(new AppDayBase());


            celeb_date = new GregorianDateTime[TRESULT_APP_CELEBS];
            celeb_gy   = new int[TRESULT_APP_CELEBS];

            for (int i = 0; i < TRESULT_APP_CELEBS + 3; i++)
            {
                GCCalendar.VATIMEtoVCTIME(va, out vctemp, m_earth);
                if (va.gyear > d.GaurabdaYear)
                {
                    if (m < TRESULT_APP_CELEBS)
                    {
                        MainInfo.Add(new AppDayInfo(string.Format("Gaurabda {0}", va.gyear), vctemp.ToString()));
                        this.celeb_date[m] = new GregorianDateTime(vctemp);
                        this.celeb_gy[m]   = va.gyear;
                        m++;
                    }
                }
                va.gyear++;
            }
        }
Exemplo n.º 21
0
 public static string GetEkadasiName(int nMasa, int nPaksa)
 {
     return(GCStrings.Localized(p_ekadasiName[(nMasa * 2 + nPaksa) % 26]));
 }
Exemplo n.º 22
0
 public static string GetNameEn(int i)
 {
     return(GCStrings.Localized(p_rasiNameEn[i % 12]));
 }
Exemplo n.º 23
0
 public static string GetName(int nYoga)
 {
     return(GCStrings.Localized(p_yogaName[nYoga % 27]));
 }
Exemplo n.º 24
0
        public void ResolveFestivalsFasting(int nIndex)
        {
            VAISNAVADAY s = m_pData[nIndex - 1];
            VAISNAVADAY t = m_pData[nIndex];
            VAISNAVADAY u = m_pData[nIndex + 1];

            String        str;
            String        subject      = string.Empty;
            int           fastForDay   = 0;
            int           fastForEvent = 0;
            string        ch;
            VAISNAVAEVENT md;

            if (t.nMahadvadasiID != MahadvadasiType.EV_NULL)
            {
                str = string.Format(GCStrings.Localized("Fasting for {0}"), t.ekadasi_vrata_name);
                t.AddEvent(DisplayPriorities.PRIO_EKADASI, GCDS.CAL_EKADASI_PARANA, str);
            }

            ch = GCEkadasi.GetMahadvadasiName((int)t.nMahadvadasiID);
            if (ch != null)
            {
                t.AddEvent(DisplayPriorities.PRIO_MAHADVADASI, GCDS.CAL_EKADASI_PARANA, ch);
            }

            if (t.ekadasi_parana)
            {
                str = t.GetTextEP();
                t.AddEvent(DisplayPriorities.PRIO_EKADASI_PARANA, GCDS.CAL_EKADASI_PARANA, str);
            }

            for (int h = 0; h < t.dayEvents.Count(); h++)
            {
                md           = t.dayEvents[h];
                fastForEvent = FastType.FAST_NULL;
                if (md.fasttype != FastType.FAST_NULL)
                {
                    fastForEvent = md.fasttype;
                    subject      = md.fastsubject;
                }

                if (fastForEvent != FastType.FAST_NULL)
                {
                    if (s.nFastID == FastType.FAST_EKADASI)
                    {
                        if (GCDisplaySettings.Current.getValue(42) == 0)
                        {
                            str = string.Format(GCStrings.Localized("(Fast today for {0})"), subject);
                            s.AddEvent(DisplayPriorities.PRIO_FASTING, GCDS.DISP_ALWAYS, str);
                            t.AddEvent(md.prio + 1, md.dispItem, GCStrings.Localized("(Fasting is done yesterday)"));
                            //"(Fasting is done yesterday)"
                        }
                        else
                        {
                            str = string.Format(GCStrings.Localized("(Fast till noon for {0}, with feast tomorrow)"), subject);
                            s.AddEvent(DisplayPriorities.PRIO_FASTING, GCDS.DISP_ALWAYS, str);
                            t.AddEvent(md.prio + 1, md.dispItem, GCStrings.Localized("(Fasting is done yesterday, today is feast)"));
                            //"(Fasting is done yesterday, today is feast)";
                        }
                    }
                    else if (t.nFastID == FastType.FAST_EKADASI)
                    {
                        if (GCDisplaySettings.Current.getValue(42) != 0)
                        {
                            t.AddEvent(md.prio + 1, md.dispItem, GCStrings.Localized("(Fasting till noon, with feast tomorrow)"));
                        }
                        //"(Fasting till noon, with feast tomorrow)";
                        else
                        {
                            t.AddEvent(md.prio + 1, md.dispItem, GCStrings.Localized("(Fast today)"));
                        }
                        //"(Fast today)"
                    }
                    else
                    {
                        /* OLD STYLE FASTING
                         * if (GCDisplaySettings.Current.getValue(42) == 0)
                         * {
                         *  if (nftype > 1)
                         *      nftype = 7;
                         *  else nftype = 0;
                         * }*/
                        if (fastForEvent != FastType.FAST_NULL)
                        {
                            t.AddEvent(md.prio + 1, md.dispItem,
                                       GCStrings.GetFastingName(fastForEvent));
                        }
                    }
                }
                if (fastForDay < fastForEvent)
                {
                    fastForDay = fastForEvent;
                }
            }

            if (fastForDay != FastType.FAST_NULL)
            {
                if (s.nFastID == FastType.FAST_EKADASI)
                {
                    t.nFeasting = FeastType.FEAST_TODAY_FAST_YESTERDAY;
                    s.nFeasting = FeastType.FEAST_TOMMOROW_FAST_TODAY;
                }
                else if (t.nFastID == FastType.FAST_EKADASI)
                {
                    u.nFeasting = FeastType.FEAST_TODAY_FAST_YESTERDAY;
                    t.nFeasting = FeastType.FEAST_TOMMOROW_FAST_TODAY;
                }
                else
                {
                    t.nFastID = fastForDay;
                }
            }
        }
Exemplo n.º 25
0
 /// <summary>
 /// Returns Gaudiya style of name of the month
 /// </summary>
 /// <param name="masaID">0..Madhusudana, 12..Purusottama-adhika</param>
 /// <returns></returns>
 private static string GetGaudiyaName(int masaID)
 {
     return(GCStrings.Localized(p_masaNameGaudiya[masaID % 13]));
 }