Пример #1
0
        /// <summary>
        /// get date text for today screen
        /// </summary>
        /// <param name="vc"></param>
        public static string getDateText(GPGregorianTime vc)
        {
            string str = string.Empty;

            getShared().TodayDate = new GPGregorianTime(vc);
            getShared().TodayDate.Today();

            int input = Convert.ToInt32(vc.getJulianLocalNoon());
            int today = Convert.ToInt32(getShared().TodayDate.getJulianLocalNoon());

            if ((vc.getDay() > 0) && (vc.getDay() < 32) && (vc.getMonth() > 0) && (vc.getMonth() < 13) && (vc.getYear() >= 1500) && (vc.getYear() < 4000))
            {
                if (input - today == 0)
                {
                    str = string.Format("{0} ({1}) - {2}", vc.ToString(), GPStrings.getString(43), GPStrings.getString(vc.getDayOfWeek()));
                }
                else if (input - today == 1)
                {
                    str = string.Format("{0} ({1}) - {2}", vc.ToString(), GPStrings.getString(854), GPStrings.getString(vc.getDayOfWeek()));
                }
                else if (input - today == -1)
                {
                    str = string.Format("{0} ({1}) - {2}", vc.ToString(), GPStrings.getString(853), GPStrings.getString(vc.getDayOfWeek()));
                }
                else
                {
                    str = string.Format("{0} - {1}", vc.ToString(), GPStrings.getString(vc.getDayOfWeek()));
                }
            }

            return(str);
        }
Пример #2
0
        public void calculateCoordinatesMethodC(GPGregorianTime vct, double DayHours)
        {
            double DG  = GPMath.pi / 180;
            double RAD = 180 / GPMath.pi;

            // mean ecliptic longitude of the sun
            double mel = SunGetMeanLong(vct.getYear(), vct.getMonth(), vct.getDay()) + (360 / 365.25) * DayHours / 360.0;
            // ecliptic longitude of perigee
            double elp = SunGetPerigee(vct.getYear(), vct.getMonth(), vct.getDay());

            // mean anomaly of the sun
            double M = mel - elp;

            // equation of center
            double C = 1.9148 * GPMath.sinDeg(M)
                       + 0.02 * GPMath.sinDeg(2 * M)
                       + 0.0003 * GPMath.sinDeg(3 * M);

            // ecliptic longitude of the sun
            double els = 0;

            eclipticalLongitude = els = mel + C;

            // declination of the sun
            declination = GPMath.arcsinDeg(0.397948 * GPMath.sinDeg(eclipticalLongitude));

            // right ascension of the sun
            rightAscession = els - RAD * Math.Atan2(Math.Sin(2 * els * DG), 23.2377 + Math.Cos(2 * DG * els));

            // equation of time
            equationOfTime = rightAscession - mel;
            //equationOfTime = GPAstroEngine.getEquationOfTime(julianDay, right_asc_deg);
            //Debugger.Log(0,"", String.Format("{1}: EoTdiff = {0}\n", vct.getShortDateString(), equationOfTime - (right_asc_deg - mel)));
        }
Пример #3
0
        public static int FormatEventsXML(GPCoreEventResults inEvents, StringBuilder strXml)
        {
            int i;

            strXml.AppendFormat("<xml>\r\n<program version=\"{0}\">\r\n<location longitude=\"{1}\" latitude=\"{2}\" timezone=\"{3}\"/>\n"
                                , GPFileHelper.FileVersion, inEvents.m_location.getLocation(0).GetLongitudeEastPositive(),
                                inEvents.m_location.getLocation(0).GetLatitudeNorthPositive()
                                , inEvents.m_location.getLocation(0).getTimeZoneName());
            GPGregorianTime prevd = new GPGregorianTime(inEvents.m_location);

            prevd.setDate(1800, 1, 1);
            for (i = 0; i < inEvents.getCount(); i++)
            {
                GPCoreEvent dnr = inEvents.get(i);

                if (inEvents.b_sorted)
                {
                    if (prevd.getDay() != dnr.Time.getDay() || prevd.getMonth() != dnr.Time.getMonth() || prevd.getYear() != dnr.Time.getYear())
                    {
                        strXml.AppendFormat("\t<day date=\"{0}\" />\n", dnr.Time);
                    }
                    prevd = dnr.Time;
                }

                strXml.AppendFormat("\t<event type=\"{0}\" time=\"{1}\" />\n", dnr.getEventTitle(), dnr.Time.getLongTimeString());
            }

            strXml.Append("</xml>\n");

            return(1);
        }
Пример #4
0
        /// <summary>
        /// Returns first day of gaurabda vaisnava calendar for given year
        /// </summary>
        /// <param name="loc"></param>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime GetFirstDayOfYear(GPLocationProvider loc, int year)
        {
            GPGregorianTime vcStart = GPGaurabdaYear.getFirstDayOfYear(loc, year);

            DateTime dt = new DateTime(vcStart.getYear(), vcStart.getMonth(), vcStart.getDay());

            return(dt);
        }
Пример #5
0
 public void Copy(GPGregorianTime vc)
 {
     p_year  = vc.getYear();
     p_month = vc.getMonth();
     p_day   = vc.getDay();
     setDayHours(vc.getDayHours());
     setLocationProvider(vc.getLocationProvider());
     recalculateJulianGreenwichTime();
 }
Пример #6
0
        // vracia -1, ak zadany den je den nasledujuci po THIS
        // vracia 1 ak THIS je nasledujuci den po zadanom dni
        public int CompareYMD(GPGregorianTime v)
        {
            if (v.getYear() < getYear())
            {
                return((getYear() - v.getYear()) * 365);
            }
            else if (v.getYear() > getYear())
            {
                return((getYear() - v.getYear()) * 365);
            }

            if (v.getMonth() < getMonth())
            {
                return((getMonth() - v.getMonth()) * 31);
            }
            else if (v.getMonth() > getMonth())
            {
                return((getMonth() - v.getMonth()) * 31);
            }

            return(getDay() - v.getDay());
        }
Пример #7
0
        /*********************************************************************/
        /*  Finds date of Pratipat, Krsna Paksa, Visnu Masa                  */
        /*                                                                   */
        /*  EARTHDATA earth - location                                       */
        /*  int nYear       - Gregorian year                                 */
        /*                                                                   */
        /*********************************************************************/

        public static GPGregorianTime getFirstDayOfYear(GPLocationProvider earth, int nYear)
        {
            int[]           a = new int[] { 2, 15, 3, 1, 3, 15, 4, 1, 4, 15 };
            GPGregorianTime d = new GPGregorianTime(earth);
            GPAstroData     day = new GPAstroData();
            int             gy, j, masa;
            int             step;
            uint            tmp;

            if (nYear >= 1950 && nYear < 2058)
            {
                tmp = gGaurBeg[(nYear - 1950) * 26 + 22];
                d.setDate(nYear, Convert.ToInt32(tmp & 0x3e0) >> 5, Convert.ToInt32(tmp & 0x1f));
                d.NextDay();
                a[0] = d.getMonth();
                a[1] = d.getDay();
            }

            for (int i = 0; i < 10; i += 2)
            {
                d.setDate(nYear, a[i], a[i + 1]);

                day.calculateDayData(d, earth);
                masa = day.determineMasa(d, out gy);

                if (masa == 11) // visnu masa
                {
                    do
                    {
                        // shifts date
                        step = day.nTithi / 2;
                        step = (step > 0) ? step : 1;
                        for (j = step; j > 0; j--)
                        {
                            d.PreviousDay();
                        }
                        // try new time
                        day.calculateDayData(d, earth);
                    }while (day.nTithi < 28);
                    d.NextDay();
                    d.setDayHours(day.sun.getSunriseDayHours());
                    return(d);
                }
            }

            d.Clear();
            d.setDayHours(day.sun.getSunriseDayHours());

            return(d);
        }
Пример #8
0
        public bool IsBeforeThis(GPGregorianTime date)
        {
            int y1, y2, m1, m2, d1, d2;

            d1 = this.getDay();
            d2 = date.getDay();
            m1 = this.getMonth();
            m2 = date.getMonth();
            y1 = this.getYear();
            y2 = date.getYear();

            if (y1 > y2)
            {
                return(false);
            }
            else if (y1 < y2)
            {
                return(true);
            }
            else if (m1 > m2)
            {
                return(false);
            }
            else if (m1 < m2)
            {
                return(true);
            }
            else if (d1 < d2)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #9
0
        /*********************************************************************/
        /*                                                                   */
        /*                                                                   */
        /*                                                                   */
        /*                                                                   */
        /*                                                                   */
        /*********************************************************************/

        public int determineMasa(GPGregorianTime aDate, out int nGaurabdaYear)
        {
            GPAstroData     day         = this;
            GPGregorianTime date        = new GPGregorianTime(aDate);
            const int       PREV_MONTHS = 6;

            double[]          L = new double[8];
            GPGregorianTime[] C = new GPGregorianTime[8];
            int[]             R = new int[8];
            int n, rasi;
            int masa       = 0;
            int ksaya_from = -1;
            int ksaya_to   = -1;

            date.setDayHours(day.sun.getSunriseDayHours());

            // STEP 1: calculate position of the sun and moon
            // it is done by previous call of DayCalc
            // and results are in argument DAYDATA day
            // *DayCalc(date, earth, day, moon, sun);*

            GPConjunction cit = new GPConjunction();

            cit.setStartDate(date);
            for (n = 1; n >= 0; n--)
            {
                cit.getNext();
                R[n] = cit.getCurrentPosition();
            }
            //L[1] = /*Long[0] =*/ GPConjunction.GetNextConjunction(date, ref C[1], false, earth);
            //L[0] = /*LongA   =*/ GPConjunction.GetNextConjunction(C[1], ref C[0], true, earth);

            cit = new GPConjunction();
            cit.setStartDate(date);
            for (n = 2; n < 8; n++)
            {
                cit.getPrev();
                R[n] = cit.getCurrentPosition();
            }
            // on Pratipat (nTithi == 15) we need to look for previous conjunction
            // but this conjunction can occur on this date before sunrise
            // so we need to include this very date into looking for conjunction
            // on other days we cannot include it
            // and exclude it from looking for next because otherwise that will cause
            // incorrect detection of Purusottama adhika masa

            /*L[2] = GPConjunction.GetPrevConjunction(date, ref C[2], false, earth);
             *
             * for (n = 3; n < PREV_MONTHS; n++)
             *  L[n] = GPConjunction.GetPrevConjunction(C[n - 1], ref C[n], true, earth);
             *
             * for (n = 0; n < PREV_MONTHS; n++)
             * {
             *  int nr = GPEngine.GetRasi(L[n], GPAyanamsa.GetAyanamsa(C[n].getJulianLocalNoon()));
             *  //if (nr != R[n])
             *  //    Debugger.Log(0, "", String.Format("Different rasi {0} <=> {1}  for input date: {2}", nr, R[n], date));
             *  R[n] = nr;
             * }*/

            /*	TRACE("TEST Date: %d %d %d\n", date.day, date.month, date.year);
             *  TRACE("FOUND CONJ Date: %d %d %d rasi: %d\n", C[1].day, C[1].month, C[1].year, R[1]);
             *  TRACE("FOUND CONJ Date: %d %d %d rasi: %d\n", C[2].day, C[2].month, C[2].year, R[2]);
             *  TRACE("FOUND CONJ Date: %d %d %d rasi: %d\n", C[3].day, C[3].month, C[3].year, R[3]);
             *  TRACE("FOUND CONJ Date: %d %d %d rasi: %d\n", C[4].day, C[4].month, C[4].year, R[4]);
             *  TRACE("---\n");
             */
            // test for Adhika-Ksaya sequence
            // this is like 1-2-2-4-5...
            // second (2) is replaced by rasi(3)

            /*	if ( ((Sank[1] + 2) % 12 == SankA) && ((Sank[1] == Sank[0]) || (Sank[0] == SankA)))
             *  {
             *      Sank[0] = (Sank[1] + 1) % 12;
             *  }
             *
             *  if ( ((Sank[2] + 2) % 12 == Sank[0]) && ((Sank[2] == Sank[1]) || (Sank[1] == Sank[0])))
             *  {
             *      Sank[1] = (Sank[2] + 1) % 12;
             *  }*/

            // look for ksaya month
            ksaya_from = -1;
            for (n = PREV_MONTHS - 2; n >= 0; n--)
            {
                if ((R[n + 1] + 2) % 12 == R[n])
                {
                    ksaya_from = n;
                    break;
                }
            }

            if (ksaya_from >= 0)
            {
                for (n = ksaya_from; n > 0; n--)
                {
                    if (R[n] == R[n - 1])
                    {
                        ksaya_to = n;
                        break;
                    }
                }

                if (ksaya_to >= 0)
                {
                    // adhika masa found
                    // now correct succession of rasis
                }
                else
                {
                    // adhika masa not found
                    // there will be some break in masa queue
                    ksaya_to = 0;
                }

                int current_rasi = R[ksaya_from + 1] + 1;
                for (n = ksaya_from; n >= ksaya_to; n--)
                {
                    R[n]         = current_rasi;
                    current_rasi = (current_rasi + 1) % 12;
                }
            }

            // STEP 3: test for adhika masa
            // test for adhika masa
            if (R[1] == R[2])
            {
                // it is adhika masa
                masa = 12;
                rasi = R[1];
            }
            else
            {
                // STEP 2. select nearest Conjunction
                if (day.nPaksa == 0)
                {
                    masa = R[1];
                }
                else if (day.nPaksa == 1)
                {
                    masa = R[2];
                }
                rasi = masa;
            }

            // calculation of Gaurabda year
            nGaurabdaYear = date.getYear() - 1486;

            if ((rasi > 7) && (rasi < 11)) // Visnu
            {
                if (date.getMonth() < 6)
                {
                    nGaurabdaYear--;
                }
            }


            return(masa);
        }
Пример #10
0
        /*********************************************************************/
        /*  Calculates Date of given Tithi                                   */
        /*********************************************************************/

        public static GPGregorianTime CalcTithiDate(int nGYear, int nMasa, int nPaksa, int nTithi, GPLocationProvider earth)
        {
            int             i = 0, gy = 0;
            GPGregorianTime d       = new GPGregorianTime(earth);
            GPAstroData     day     = new GPAstroData();
            int             tithi   = 0;
            int             counter = 0;
            uint            tmp     = 0;

            if (nGYear >= 464 && nGYear < 572)
            {
                tmp = GPGaurabdaYear.gGaurBeg[(nGYear - 464) * 26 + nMasa * 2 + nPaksa];
                d.setDate(Convert.ToInt32(tmp & 0xfffc00) >> 10,
                          Convert.ToInt32(tmp & 0x3e0) >> 5,
                          Convert.ToInt32(tmp & 0x1f));
                d.NextDay();

                day.calculateDayData(d, earth);
                day.nMasa         = day.determineMasa(d, out gy);
                day.nGaurabdaYear = gy;
            }
            else
            {
                //d = GetFirstDayOfYear(earth, nGYear + 1486);
                d.setDate(nGYear + 1486, 2 + nMasa, 15);
                if (d.getMonth() > 12)
                {
                    d.setDate(d.getYear() + 1, d.getMonth() - 12, 0);
                }
                d.setDayHours(0.5);

                i = 0;
                do
                {
                    d.AddDays(13);
                    day.calculateDayData(d, earth);
                    day.nMasa         = day.determineMasa(d, out gy);
                    day.nGaurabdaYear = gy;
                    i++;
                }while (((day.nPaksa != nPaksa) || (day.nMasa != nMasa)) && (i <= 30));
            }

            if (i >= 30)
            {
                d.Clear();
                return(d);
            }

            // we found masa and paksa
            // now we have to find tithi
            tithi = nTithi + nPaksa * 15;

            if (day.nTithi == tithi)
            {
                // loc1
                // find tithi juncts in this day and according to that times,
                // look in previous or next day for end and start of this tithi
                d.PreviousDay();
                day.calculateDayData(d, earth);
                if ((day.nTithi > tithi) && (day.nPaksa != nPaksa))
                {
                    d.NextDay();
                }
                return(d);
            }

            if (day.nTithi < tithi)
            {
                // do increment of date until nTithi == tithi
                //   but if nTithi > tithi
                //       then do decrement of date
                counter = 0;
                while (counter < 16)
                {
                    d.NextDay();
                    day.calculateDayData(d, earth);
                    if (day.nTithi == tithi)
                    {
                        return(d);
                    }
                    if ((day.nTithi < tithi) && (day.nPaksa != nPaksa))
                    {
                        return(d);
                    }
                    if (day.nTithi > tithi)
                    {
                        return(d);
                    }
                    counter++;
                }
                // somewhere is error
                d.Clear();
                return(d);
            }
            else
            {
                // do decrement of date until nTithi <= tithi
                counter = 0;
                while (counter < 16)
                {
                    d.PreviousDay();
                    day.calculateDayData(d, earth);
                    if (day.nTithi == tithi)
                    {
                        return(d);
                    }
                    if ((day.nTithi > tithi) && (day.nPaksa != nPaksa))
                    {
                        d.NextDay();
                        return(d);
                    }
                    if (day.nTithi < tithi)
                    {
                        d.NextDay();
                        return(d);
                    }
                    counter++;
                }
                // somewhere is error
                d.Clear();
                return(d);
            }

            // now we know the type of day-accurancy
            // nType = 0 means, that we dont found a day
            // nType = 1 means, we find day, when tithi was present at sunrise
            // nType = 2 means, we found day, when tithi started after sunrise
            //                  but ended before next sunrise
            //
        }
Пример #11
0
        public static int FormatCalendarICAL(GPCalendarResults daybuff, StringBuilder m_text)
        {
            int             k;
            int             initialLength = 0;
            int             lastmasa = -1;
            int             tzoffset = 0, tzoff;
            string          str, str2;
            StringBuilder   dayText = new StringBuilder();
            GPCalendarDay   pvd, prevd, nextd;
            string          SPACE_BEFORE_LINE = " , ";
            GPGregorianTime vc  = new GPGregorianTime(daybuff.m_vcStart);
            GPLocation      loc = daybuff.CurrentLocation.getLocation(0);

            DateTime st = new DateTime();

            m_text.Remove(0, m_text.Length);
            m_text.Append("BEGIN:VCALENDAR\nVERSION:2.0\nX-WR-CALNAME:VAISNAVA\nPRODID:-//GBC Calendar Comitee//GCAL//EN\n");
            m_text.Append("X-WR-RELCALID:");
            str2 = string.Format("{0:00000000}-{1:0000}-{2:0000}-{3:0000}-{4:0000}{5:00000000}", st.Year + st.Millisecond, st.Day, st.Month,
                                 st.Hour, st.Minute + st.Millisecond);
            m_text.Append(str2);
            m_text.Append("\nX-WR-TIMEZONE:");

            m_text.Append(loc.getTimeZoneName());
            m_text.Append("\n");

            m_text.Append("CALSCALE:GREGORIAN\nMETHOD:PUBLISH\n");
            m_text.Append("BEGIN:VTIMEZONE\nTZID:");
            m_text.Append(loc.getTimeZoneName());
            str2 = string.Format("\nLAST-MODIFIED:{0:0000}{1:00}{2:00}T{3:00}{4:00}{5:00}Z", st.Year, st.Month, st.Day, st.Hour, st.Minute, st.Second);
            m_text.Append(str2);

            tzoffset = Convert.ToInt32(loc.getTimeZone().OffsetSeconds / 60);
            tzoff    = Convert.ToInt32(loc.getTimeZone().getMaximumOffsetSeconds() / 60);

            if (loc.getTimeZone().hasDstInYear(st.Year))
            {
                DateTime dta = loc.getTimeZone().StartDateInYear(st.Year);
                str2 = string.Format("\nBEGIN:DAYLIGHT\nDTSTART:{0:0000}{1:00}{2:00}T{3:00}0000", dta.Year, dta.Month, dta.Day, dta.Hour);
                m_text.Append(str2);

                str2 = string.Format("\nTZOFFSETTO:{0}{1:00}{2:00}", (tzoff > 0 ? '+' : '-'), Math.Abs(tzoff) / 60, Math.Abs(tzoff) % 60);
                m_text.Append(str2);

                str2 = string.Format("\nTZOFFSETFROM:{0}{1:00}{2:00}", '+', 0, 0);
                m_text.Append(str2);

                dta = loc.getTimeZone().EndDateInYear(st.Year);
                m_text.Append("\nEND:DAYLIGHT\nBEGIN:STANDARD\nDTSTART:");
                str2 = string.Format("{0:0000}{1:00}{2:00}T{3:00}0000", dta.Year, dta.Month, dta.Day, dta.Hour);
                m_text.Append(str2);

                str2 = string.Format("\nTZOFFSETTO:{0}{1:00}{2:00}", (tzoffset > 0 ? '+' : '-'), Math.Abs(tzoffset) / 60, Math.Abs(tzoffset) % 60);
                m_text.Append(str2);
                str2 = string.Format("\nTZOFFSETFROM:{0}{1:00}{2:00}", (tzoff > 0 ? '+' : '-'), Math.Abs(tzoff) / 60, Math.Abs(tzoff) % 60);
                m_text.Append(str2);
                m_text.Append("\nEND:STANDARD\n");
            }
            else
            {
                m_text.Append("\nBEGIN:STANDARD\nDTSTART:");
                str2 = string.Format("{0:0000}0101T000000", vc.getYear(), vc.getMonth(), vc.getDay(), vc.getHour());
                m_text.Append(str2);

                str2 = string.Format("\nTZOFFSETTO:%+02d{0:00}", Math.Abs(tzoffset) / 60, Math.Abs(tzoffset) % 60);
                m_text.Append(str2);
                str2 = string.Format("\nTZOFFSETFROM:+0000");
                m_text.Append(str2);
                m_text.Append("\nEND:STANDARD\n");
            }

            m_text.Append("END:VTIMEZONE\n");

            for (k = 0; k < daybuff.m_PureCount; k++)
            {
                //		date.shour = 0.0;
                //		date.TimeZone = earth.tzone;

                prevd = daybuff.get(k - 1);
                pvd   = daybuff.get(k);
                nextd = daybuff.get(k + 1);

                if (pvd != null)
                {
                    dayText.Remove(0, dayText.Length);

                    if (pvd.astrodata.nMasa != lastmasa)
                    {
                        str = string.Format("{0} {1}, Gaurabda {2}", GPMasa.GetName(pvd.astrodata.nMasa), getSharedStringHtml(22), pvd.astrodata.nGaurabdaYear);
                        dayText.Append(str);
                        dayText.Append("\n");
                        if ((pvd.astrodata.nMasa == GPMasa.ADHIKA_MASA) && ((lastmasa >= GPMasa.SRIDHARA_MASA) && (lastmasa <= GPMasa.DAMODARA_MASA)))
                        {
                            if (dayText.Length > 0)
                            {
                                dayText.Append(SPACE_BEFORE_LINE);
                            }
                            dayText.Append(getSharedStringHtml(128));
                            dayText.Append("\n");
                        }

                        lastmasa      = pvd.astrodata.nMasa;
                        initialLength = -1;
                    }
                    else
                    {
                        initialLength = 0;
                    }

                    if (dayText.Length > 0)
                    {
                        dayText.Append(SPACE_BEFORE_LINE);
                    }
                    dayText.Append(GPTithi.getName(pvd.astrodata.nTithi));

                    if ((pvd.astrodata.nTithi == 10) || (pvd.astrodata.nTithi == 25) || (pvd.astrodata.nTithi == 11) || (pvd.astrodata.nTithi == 26))
                    {
                        if (pvd.hasEkadasiParana() == false)
                        {
                            dayText.Append(" ");
                            if (pvd.nMahadvadasiType == GPConstants.EV_NULL)
                            {
                                dayText.Append(getSharedStringHtml(58));
                            }
                            else
                            {
                                dayText.Append(getSharedStringHtml(59));
                            }
                        }
                    }
                    dayText.Append("\n");
                    initialLength += dayText.Length;

                    if (pvd.astrodata.sun.eclipticalLongitude < 0.0)
                    {
                        goto _resolve_text;
                    }

                    //			if (0 != GetShowSetVal(17) == 1)
                    {
                        //				double h1, m1;
                        if (pvd.hasEkadasiParana())
                        {
                            str = pvd.getEkadasiParanaString();

                            dayText.Append(SPACE_BEFORE_LINE);
                            dayText.Append(str);
                            dayText.Append("\n");
                        }
                    }

                    //			if (0 != GetShowSetVal(6) == 1)
                    {
                        foreach (GPCalendarDay.Festival fest in pvd.Festivals)
                        {
                            if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true))
                            {
                                dayText.Append(SPACE_BEFORE_LINE);
                                dayText.Append(fest.Text);
                                dayText.Append("\n");
                            }
                        }
                    }

                    if (/*GetShowSetVal(16) == 1 &&*/ pvd.sankranti_zodiac >= 0)
                    {
                        str = string.Format(" {0} {1}", GPSankranti.getName(pvd.sankranti_zodiac), getSharedStringHtml(56));
                        dayText.Append(SPACE_BEFORE_LINE);
                        dayText.Append(str);
                        dayText.Append("\n");
                    }



                    //"Sunrise Time",//2
                    //"Sunset Time",//3
                    if (GPDisplays.Calendar.TimeSunriseVisible())
                    {
                        str = string.Format("{0} {1}", getSharedStringHtml(51), pvd.astrodata.sun.rise.getShortTimeString());
                        dayText.Append(SPACE_BEFORE_LINE);
                        dayText.Append(str);
                        dayText.Append("\n");
                    }
                    if (GPDisplays.Calendar.TimeSunsetVisible())
                    {
                        str = string.Format("{0} {1}", getSharedStringHtml(52), pvd.astrodata.sun.set.getShortTimeString());
                        dayText.Append(SPACE_BEFORE_LINE);
                        dayText.Append(str);
                        dayText.Append("\n");
                    }

                    {
                        if (prevd != null)
                        {
                            if (prevd.astrodata.nMasa != pvd.astrodata.nMasa)
                            {
                                str = string.Format("{0} {1} {2}", getSharedStringHtml(780), GPMasa.GetName(pvd.astrodata.nMasa), getSharedStringHtml(22));
                                dayText.Append(SPACE_BEFORE_LINE);
                                dayText.Append(str);
                                dayText.Append("\n");
                            }
                        }
                        if (nextd != null)
                        {
                            if (nextd.astrodata.nMasa != pvd.astrodata.nMasa)
                            {
                                str = string.Format("{0} {1} {2}", getSharedStringHtml(781), GPMasa.GetName(pvd.astrodata.nMasa), getSharedStringHtml(22));
                                dayText.Append(SPACE_BEFORE_LINE);
                                dayText.Append(str);
                                dayText.Append("\n");
                            }
                        }
                    }

_resolve_text:
                    if (dayText.Length > initialLength)
                    {
                        m_text.Append("BEGIN:VEVENT\n");
                        str2 = string.Format("DTSTART;VALUE=DATE:{0:0000}{1:00}{2:00}\n", pvd.date.getYear(), pvd.date.getMonth(), pvd.date.getDay());
                        m_text.Append(str2);

                        /*str2 = string.Format("DTEND;VALUE=DATE:{0:0000}{0:00}{0:00}T{0:00}{0:00}{0:00}\n", pvd.date.year, pvd.date.month, pvd.date.day,
                         *  pvd.astrodata.sun.set.hour, pvd.astrodata.sun.set.min, pvd.astrodata.sun.set.sec);
                         * m_text.Append(str2);*/
                        str2 = string.Format("LOCATION:{0}\n", loc.getFullName());
                        str2.Replace(",", "\\,");
                        m_text.Append(str2);
                        m_text.Append("SUMMARY:");
                        dayText.Replace(",", "\\,");
                        m_text.Append(dayText.ToString().TrimStart());
                        str2 = string.Format("UID:{0:00000000}-{1:0000}-{2:0000}-{3:0000}-{4:00000000}{5:0000}\n", st.Year, st.Month * 30 + st.Day, st.Hour * 60 + st.Minute, st.Second, st.Millisecond, k);
                        m_text.Append(str2);
                        m_text.Append("DURATION:P1D\nSEQUENCE:1\nEND:VEVENT\n");
                    }
                }
            }

            m_text.Append("END:VCALENDAR\n");
            return(1);
        }