Пример #1
0
 public override string ToString()
 {
     return(string.Format("{0} {1}, {2} {3}, {4} {5}, {6} {7}", GPTithi.getName(tithi), GPStrings.getString(13),
                          GPPaksa.getName(tithi / 15), GPStrings.getString(20),
                          GPMasa.GetName(masa), GPStrings.getString(22),
                          GPStrings.getString(994), gyear));
 }
Пример #2
0
        public static int FormatMasaListText(GPMasaListResults mlist, StringBuilder str)
        {
            string stt;

            str.Remove(0, str.Length);
            str.AppendLine(GPAppHelper.CenterString(getSharedStringPlain(39), 60));
            str.AppendLine();
            str.AppendLine();
            str.AppendLine(GPAppHelper.CenterString(mlist.m_location.getLocation(0).getFullName(), 60));
            str.AppendFormat(getSharedStringPlain(41), mlist.vc_start, mlist.vc_end);
            str.AppendLine();
            str.AppendLine(string.Empty.PadRight(60, '='));
            str.AppendLine();

            int i;

            for (i = 0; i < mlist.n_countMasa; i++)
            {
                stt = string.Format("{0} {1}", GPMasa.GetName(mlist.arr[i].masa), mlist.arr[i].year);
                str.Append(stt.PadRight(30));
                stt = string.Format("{0} - ", mlist.arr[i].vc_start);
                str.Append(stt.PadLeft(16));
                stt = string.Format("{0}", mlist.arr[i].vc_end);
                str.Append(stt.PadLeft(13));
                str.AppendLine();
            }

            return(1);
        }
Пример #3
0
        public static int FormatMasaListRtf(GPMasaListResults mlist, StringBuilder str)
        {
            string stt;
            string stt2;

            str.Remove(0, str.Length);
            AppendRtfHeader(str);

            stt = string.Format("{{\\fs{0}\\f2 {1}}\\par\\tx{2}\\tx{3}\\f2\\fs{4}\r\n\\par\r\n{5}: {6}\\par\r\n"
                                , g_HeaderSize
                                , getSharedStringRtf(39), 1000 * g_TextSize / 24, 4000 * g_TextSize / 24
                                , g_TextSize, getSharedStringRtf(40), mlist.m_location.getFullName());
            str.Append(stt);
            str.AppendFormat(getSharedStringRtf(41), mlist.vc_start, mlist.vc_end);
            str.AppendLine("\\par");
            str.AppendLine("==================================================================");
            str.AppendLine("\\par");
            str.AppendLine("\\par");

            int i;

            for (i = 0; i < mlist.n_countMasa; i++)
            {
                stt2 = string.Format("\\tab {0} {1}\\tab ", GPMasa.GetName(mlist.arr[i].masa), mlist.arr[i].year);
                str.Append(stt2);
                stt2 = string.Format("{0} - ", mlist.arr[i].vc_start);
                str.Append(stt2);
                str.AppendFormat("{0}\\par", mlist.arr[i].vc_end);
                str.AppendLine();
            }

            AddNoteRtf(str);

            str.Append("}");

            return(1);
        }
Пример #4
0
 public string getMasaLongName()
 {
     return(string.Format("{0} {1}", GPMasa.GetName(astrodata.nMasa), GPStrings.getString(22)));
 }
Пример #5
0
        public List <Festival> CompleteFestivalList(GPCalendarDay prevDay, GPCalendarDay nextDay)
        {
            List <Festival> fests = new List <Festival>();

            if (hasEkadasiParana())
            {
                fests.Add(new Festival(10, getEkadasiParanaString()));
            }


            foreach (Festival fest in Festivals)
            {
                fests.Add(fest);
            }

            if (sankranti_zodiac >= 0)
            {
                fests.Add(new Festival(300, GPDisplays.Keys.CalendarSankranti, string.Format(GPStrings.getString(975), GPSankranti.getName(sankranti_zodiac), sankranti_day.ToString(), sankranti_day.getLongTimeString())));
            }

            if (hasKsayaTithi())
            {
                fests.Add(new Festival(301, GPDisplays.Keys.CalendarKsaya, string.Format(GPStrings.getString(976), ksayaTithi.getName(), getKsayaTimeString(0), getKsayaTimeString(1))));
            }

            if (IsSecondDayTithi)
            {
                fests.Add(new Festival(302, GPDisplays.Keys.CalendarVriddhi, GPStrings.getString(977)));
            }

            // tithi at arunodaya
            if (GPDisplays.Calendar.TithiArunodayaVisible())
            {
                fests.Add(new Festival(303, GPDisplays.Keys.CalArunodayaTithi, string.Format("{0}: {1}", GPStrings.getString(98), GPTithi.getName(astrodata.getTithiAtArunodaya()))));
            }

            //"Arunodaya Time",//1
            if (GPDisplays.Calendar.TimeArunodayaVisible())
            {
                fests.Add(new Festival(304, GPDisplays.Keys.CalArunodayaTime, string.Format(GPStrings.getString(99), astrodata.sun.arunodaya.getShortTimeString())));
            }

            //List<string> gstr = GPStrings.getSharedStrings().gstr;

            if (GPDisplays.Calendar.TimeSunriseVisible())
            {
                fests.Add(new Festival(305, GPDisplays.Keys.CalSunriseTime, string.Format("{0} {1}", GPStrings.getString(51), astrodata.sun.rise.getShortTimeString())));
            }

            if (GPDisplays.Calendar.NoonTime())
            {
                fests.Add(new Festival(306, GPDisplays.Keys.CalNoonTime, string.Format("{0} {1}", GPStrings.getString(857), astrodata.sun.noon.getShortTimeString())));
            }

            if (GPDisplays.Calendar.TimeSunsetVisible())
            {
                fests.Add(new Festival(307, GPDisplays.Keys.CalSunsetTime, string.Format("{0} {1}", GPStrings.getString(52), astrodata.sun.set.getShortTimeString())));
            }

            if (GPDisplays.Calendar.TimeMoonriseVisible())
            {
                if (moonrise != null)
                {
                    fests.Add(new Festival(308, GPDisplays.Keys.CalMoonriseTime, string.Format("{0} {1}", GPStrings.getString(53), moonrise.getShortTimeString())));
                }
            }

            if (GPDisplays.Calendar.TimeMoonsetVisible())
            {
                if (moonset != null)
                {
                    fests.Add(new Festival(309, GPDisplays.Keys.CalMoonsetTime, string.Format("{0} {1}", GPStrings.getString(54), moonset.getShortTimeString())));
                }
            }

            if (GPDisplays.Calendar.SunLongitudeVisible())
            {
                fests.Add(new Festival(310, GPDisplays.Keys.CalSunLong, string.Format("{0}: {1} (*)", GPStrings.getString(100), astrodata.sun.eclipticalLongitude)));
            }

            if (GPDisplays.Calendar.MoonLongitudeVisible())
            {
                fests.Add(new Festival(311, GPDisplays.Keys.CalMoonLong, string.Format("{0}: {1} (*)", GPStrings.getString(101), astrodata.moon.longitude_deg)));
            }

            if (GPDisplays.Calendar.AyanamsaValueVisible())
            {
                fests.Add(new Festival(312, GPDisplays.Keys.CalAyanamsa, string.Format("{0} {1} ({2}) (*)", GPStrings.getString(102), astrodata.msAyanamsa, GPAyanamsa.CurrentName)));
            }

            if (GPDisplays.Calendar.JulianDayVisible())
            {
                fests.Add(new Festival(313, GPDisplays.Keys.CalJulian, string.Format("{0} {1} (*)", GPStrings.getString(103), astrodata.jdate)));
            }

            if (GPDisplays.Calendar.StartMasaVisible())
            {
                if (prevDay != null)
                {
                    if (prevDay.astrodata.nMasa != this.astrodata.nMasa)
                    {
                        fests.Add(new Festival(314, GPDisplays.Keys.CalMasaChange, string.Format("{0} {1} {2}", GPStrings.getString(780), GPMasa.GetName(astrodata.nMasa), GPStrings.getString(22))));
                    }
                }
                if (nextDay != null)
                {
                    if (nextDay.astrodata.nMasa != this.astrodata.nMasa)
                    {
                        fests.Add(new Festival(315, GPDisplays.Keys.CalDstChange, string.Format("{0} {1} {2}", GPStrings.getString(781), GPMasa.GetName(astrodata.nMasa), GPStrings.getString(22))));
                    }
                }
            }

            if (GPDisplays.Calendar.DSTNotice())
            {
                if (prevDay != null && prevDay.isDaylightInEffect() == 0 && this.isDaylightInEffect() == 1)
                {
                    fests.Add(new Festival(316, GPDisplays.Keys.CalDstChange, GPStrings.getString(855)));
                }

                if (nextDay != null && this.isDaylightInEffect() == 1 && nextDay.isDaylightInEffect() == 0)
                {
                    fests.Add(new Festival(316, GPDisplays.Keys.CalDstChange, GPStrings.getString(856)));
                }
            }
            return(fests);
        }
Пример #6
0
        public void calculateAppearanceDayData(GPLocationProvider aLocation, GPGregorianTime aEvente)
        {
            //MOONDATA moon;
            //SUNDATA sun;
            location = aLocation;
            evente   = new GPGregorianTime(aEvente);
            double          dd;
            GPAstroData     d     = details;
            GPGregorianTime vc    = evente;
            GPGregorianTime vcsun = evente;

            b_adhika = false;

            d.calculateDayData(aEvente, aLocation);
            //d.nTithi = GetPrevTithiStart(m_earth, vc, dprev);
            //GetNextTithiStart(m_earth, vc, dnext);
            //vcsun.setDayHours(vcsun.getDayHours() - vcsun.getTimeZoneOffsetHours() / 24.0);
            vcsun.normalizeValues();
            d.sun.calculateCoordinatesMethodC(vcsun, -1);
            d.moon.MoonCalc(vcsun.getJulianGreenwichTime());
            d.msDistance = GPMath.putIn360(d.moon.longitude_deg - d.sun.eclipticalLongitude - 180.0);
            d.msAyanamsa = GPAyanamsa.GetAyanamsa(vc.getJulianGreenwichTime());

            // tithi
            dd             = d.msDistance / 12.0;
            d.nTithi       = Convert.ToInt32(Math.Floor(dd));
            d.nTithiElapse = GPMath.frac(dd) * 100.0;
            d.nPaksa       = (d.nTithi >= 15) ? 1 : 0;


            // naksatra
            dd                = GPMath.putIn360(d.moon.longitude_deg - d.msAyanamsa);
            dd                = (dd * 3.0) / 40.0;
            d.nNaksatra       = Convert.ToInt32(Math.Floor(dd));
            d.nNaksatraElapse = GPMath.frac(dd) * 100.0;
            d.nMasa           = d.determineMasa(vc, out d.nGaurabdaYear);
            d.nMoonRasi       = GPEngine.GetRasi(d.moon.longitude_deg, d.msAyanamsa);
            d.nSunRasi        = GPEngine.GetRasi(d.sun.eclipticalLongitude, d.msAyanamsa);

            if (d.nMasa == GPMasa.ADHIKA_MASA)
            {
                d.nMasa  = GPEngine.GetRasi(d.sun.eclipticalLongitude, d.msAyanamsa);
                b_adhika = true;
            }
            string dstApplicable = "";

            //List<string> gstr = GPStrings.getSharedStrings().gstr;
            output.Add(new GPStringPair(GPStrings.getString(25), "", true));
            output.Add(new GPStringPair(GPStrings.getString(7), vc.ToString()));
            output.Add(new GPStringPair(GPStrings.getString(8), vc.getShortTimeString(true, ref dstApplicable)));
            output.Add(new GPStringPair(GPStrings.getString(9), vc.getLocation().getFullName()));
            //output.Add(new GPStringPair(gstr[10], vc.getLocation().getLatitudeString()));
            //output.Add(new GPStringPair(gstr[11], vc.getLocation().getLongitudeString()));
            //output.Add(new GPStringPair(gstr[12], vc.getLocation().getTimeZoneName()));
            //output.Add(new GPStringPair(gstr[1001], dstApplicable));
            output.Add(new GPStringPair(GPStrings.getString(13), GPTithi.getName(d.nTithi)));
            output.Add(new GPStringPair(GPStrings.getString(14), string.Format("{0:0.###} %", d.nTithiElapse)));
            output.Add(new GPStringPair(GPStrings.getString(15), GPNaksatra.getName(d.nNaksatra)));
            output.Add(new GPStringPair(GPStrings.getString(16), string.Format("{0:0.###} % ({1})", d.nNaksatraElapse, GPStrings.getString(811 + Convert.ToInt32(d.nNaksatraElapse / 25.0)))));
            output.Add(new GPStringPair(GPStrings.getString(991), GPSankranti.getName(d.nMoonRasi)));
            output.Add(new GPStringPair(GPStrings.getString(992), GPSankranti.getName(d.nSunRasi)));
            output.Add(new GPStringPair(GPStrings.getString(20), GPPaksa.getName(d.nPaksa)));
            if (b_adhika == true)
            {
                output.Add(new GPStringPair(GPStrings.getString(22), string.Format("{0} {1}", GPMasa.GetName(d.nMasa), GPStrings.getString(21))));
            }
            else
            {
                output.Add(new GPStringPair(GPStrings.getString(22), GPMasa.GetName(d.nMasa)));
            }
            output.Add(new GPStringPair(GPStrings.getString(23), d.nGaurabdaYear.ToString()));

            if (GPDisplays.AppDay.childNameSuggestions())
            {
                output.Add(new GPStringPair());
                output.Add(new GPStringPair(GPStrings.getString(17), "", true));
                output.Add(new GPStringPair());
                output.Add(new GPStringPair(GPStrings.getString(18), string.Format("{0}...", GPAppHelper.GetNaksatraChildSylable(d.nNaksatra, Convert.ToInt32(d.nNaksatraElapse / 25.0)))));
                output.Add(new GPStringPair(GPStrings.getString(19), string.Format("{0}...", GPAppHelper.GetRasiChildSylable(d.nMoonRasi))));
            }

            vc.Today();
            GPVedicTime     va = new GPVedicTime();
            GPGregorianTime vctemp;

            va.tithi = d.nTithi;
            va.masa  = d.nMasa;
            va.gyear = GPGaurabdaYear.getGaurabdaYear(vc, location);
            if (va.gyear < d.nGaurabdaYear)
            {
                va.gyear = d.nGaurabdaYear;
            }


            int countC = GPUserDefaults.IntForKey("appday.celebs", 3);

            if (countC > 0)
            {
                output.Add(new GPStringPair());
                output.Add(new GPStringPair(GPStrings.getString(24), "", true));
                output.Add(new GPStringPair());
            }

            int m = 0;

            for (int i = 0; i < 6; i++)
            {
                GPEngine.VATIMEtoVCTIME(va, out vctemp, location);
                if (va.gyear > d.nGaurabdaYear)
                {
                    if (m < countC)
                    {
                        output.Add(new GPStringPair(string.Format("{0} {1}", GPStrings.getString(994), va.gyear), vctemp.ToString()));
                        m++;
                    }
                }
                va.gyear++;
            }
        }
Пример #7
0
 public string getName()
 {
     return(GPMasa.GetName(masa));
 }
Пример #8
0
        public static int FormatCalendarCSV(GPCalendarResults daybuff, StringBuilder m_text)
        {
            int           k;
            int           initialLength = 0;
            int           lastmasa = -1;
            string        str, str2;
            StringBuilder dayText = new StringBuilder();
            GPCalendarDay pvd, prevd, nextd;
            string        SPACE_BEFORE_LINE = " , ";

            m_text.Remove(0, m_text.Length);
            m_text.Append("\"Subject\",\"Begin Date\",\"Start\",\"End Date\",\"End\",\"WholeDay\",\"Alarm\"\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)
                    {
                        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("; ");
                    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(str);
                            dayText.Append("; ");
                        }
                    }

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

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


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


                    {
                        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(str);
                                dayText.Append("; ");
                            }
                        }
                        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(str);
                                dayText.Append("; ");
                            }
                        }
                    }

_resolve_text:
                    if (dayText.Length > initialLength || !GPDisplays.Calendar.HideEmptyDays())
                    {
                        m_text.Append("\"");
                        m_text.Append(dayText);
                        m_text.Append("\",");

                        str2 = string.Format("\"{0}.{1}.{2}\",\"0:00:00\",\"{3}.{4}.{5}\",\"0:00:00\",\"True\",\"False\"\n",
                                             pvd.date.getDay(), pvd.date.getMonth(), pvd.date.getYear(), nextd.date.getDay(),
                                             nextd.date.getMonth(), nextd.date.getYear());
                        m_text.Append(str2);
                    }
                }
            }

            return(1);
        }
Пример #9
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);
        }
Пример #10
0
        public static int WriteXML_GaurabdaNextTithi(StringBuilder doc, GPLocationProvider loc, GPGregorianTime vcStart, GPVedicTime vaStart)
        {
            int gmasa, gpaksa, gtithi;


            gmasa  = vaStart.masa;
            gpaksa = vaStart.tithi / 15;
            gtithi = vaStart.tithi % 15;

            doc.Append("<xml>\n");
            doc.Append("\t<request name=\"Tithi\" version=\"" + GPFileHelper.FileVersion + "\">\n");
            doc.Append("\t\t<arg name=\"longitude\" val=\"" + loc.GetLongitudeEastPositive() + "\" />\n");
            doc.Append("\t\t<arg name=\"latitude\" val=\"" + loc.GetLatitudeNorthPositive() + "\" />\n");
            doc.Append("\t\t<arg name=\"timezone\" val=\"" + loc.getTimeZone().OffsetSeconds / 60 + "\" />\n");
            doc.Append("\t\t<arg name=\"start date\" val=\"" + vcStart + "\" />\n");
            doc.Append("\t\t<arg name=\"masa\" val=\"" + gmasa + "\" />\n");
            doc.Append("\t\t<arg name=\"paksa\" val=\"" + gpaksa + "\" />\n");
            doc.Append("\t\t<arg name=\"tithi\" val=\"" + gtithi + "\" />\n");
            doc.Append("\t</request>\n");
            doc.Append("\t<result name=\"Tithi\">\n");

            GPGregorianTime vcs   = new GPGregorianTime(loc);
            GPGregorianTime vce   = new GPGregorianTime(loc);
            GPGregorianTime today = new GPGregorianTime(loc);
            GPSun           sun   = new GPSun();
            int             A;
            double          sunrise;
            GPAstroData     day = new GPAstroData();
            int             oTithi, oPaksa, oMasa, oYear;

            today.Copy(vcStart);
            today.PreviousDay();
            vcStart.SubDays(15);
            for (A = 0; A <= 3; A++)
            {
                vcs = GPTithi.CalcTithiEndEx(vcStart, 0, gmasa, gpaksa, gtithi, loc, out vce);
                if (!vcs.IsBeforeThis(today))
                {
                    oTithi = gpaksa * 15 + gtithi;
                    oMasa  = gmasa;
                    oPaksa = gpaksa;
                    oYear  = 0;
                    doc.Append("\t<celebration\n");
                    //		doc.Append( "\t\t<tithi\n");
                    doc.Append("\t\trtithi=\"" + GPTithi.getName(oTithi) + "\"\n");
                    doc.Append("\t\trmasa=\"" + GPMasa.GetName(oMasa) + "\"\n");
                    doc.Append("\t\trpaksa=\"" + GPPaksa.getName(oPaksa) + "\"\n");
                    // test ci je ksaya
                    today.Copy(vcs);
                    today.setDayHours(0.5);
                    sun.SunCalc(today, loc);
                    sunrise = sun.getSunriseDayHours();
                    if (sunrise < vcs.getDayHours())
                    {
                        today.Copy(vce);
                        sun.SunCalc(today, loc);
                        sunrise = sun.getSunriseDayHours();
                        if (sunrise < vce.getDayHours())
                        {
                            // normal type
                            vcs.NextDay();
                            doc.Append("\t\ttype=\"normal\"\n");
                        }
                        else
                        {
                            // ksaya
                            vcs.NextDay();
                            day.calculateDayData(vcs, loc);
                            oTithi = day.nTithi;
                            oPaksa = day.nPaksa;
                            oMasa  = day.determineMasa(vcs, out oYear);
                            doc.Append("\t\ttype=\"ksaya\"\n");
                        }
                    }
                    else
                    {
                        // normal, alebo prvy den vriddhi
                        today.Copy(vce);
                        sun.SunCalc(today, loc);
                        if (sun.getSunriseDayHours() < vce.getDayHours())
                        {
                            // first day of vriddhi type
                            doc.Append("\t\ttype=\"vriddhi\"\n");
                        }
                        else
                        {
                            // normal
                            doc.Append("\t\ttype=\"normal\"\n");
                        }
                    }
                    doc.Append("\t\tdate=\"" + vcs + "\"\n");
                    doc.Append("\t\totithi=\"" + GPTithi.getName(oTithi) + "\"\n");
                    doc.Append("\t\tomasa=\"" + GPMasa.GetName(oMasa) + "\"\n");
                    doc.Append("\t\topaksa=\"" + GPPaksa.getName(oPaksa) + "\"\n");
                    doc.Append("\t/>\n");
                    break;
                }
                else
                {
                    vcStart.Copy(vcs);
                    vcs.NextDay();
                }
            }

            doc.Append("\t</result>\n");
            doc.Append("</xml>\n");


            return(1);
        }
Пример #11
0
        public static void FormatAppDayXML(GPAppDayResults app, StringBuilder strResult)
        {
            GPAstroData     d = app.details;
            string          str;
            GPGregorianTime vc      = app.evente;
            StringBuilder   strText = strResult;
            int             npada;
            bool            bDuringAdhika = false;

            strText.AppendFormat(
                "<xml>\n" +
                "\t<request name=\"AppDay\" version=\"{0}\">\n" +
                "\t\t<arg name=\"longitude\" value=\"{1}\" />\n" +
                "\t\t<arg name=\"latitude\" value=\"{2}\" />\n" +
                "\t\t<arg name=\"timezone\" value=\"{3}\" />\n" +
                "\t\t<arg name=\"year\" value=\"{4}\" />\n" +
                "\t\t<arg name=\"month\" value=\"{5}\" />\n" +
                "\t\t<arg name=\"day\" value=\"{6}\" />\n" +
                "\t\t<arg name=\"hour\" value=\"{7}\" />\n" +
                "\t\t<arg name=\"minute\" value=\"{8}\" />\n" +
                "\t</request>\n", GPFileHelper.FileVersion,
                app.evente.getLocation().GetLongitudeEastPositive(), app.evente.getLocation().GetLatitudeNorthPositive(),
                app.evente.getLocation().getTimeZoneName(),
                app.evente.getYear(), app.evente.getMonth(), app.evente.getDay(), app.evente.getHour(), app.evente.getMinuteRound()
                );


            npada = Convert.ToInt32(d.nNaksatraElapse / 25.0) + 1;
            if (npada > 4)
            {
                npada = 4;
            }

            str = string.Format("\t<result name=\"AppDay\" >\n" +
                                "\t\t<tithi name=\"{0}\" elapse=\"{1}\" />\n" +
                                "\t\t<naksatra name=\"{2}\" elapse=\"{3}\" pada=\"{4}\"/>\n" +
                                "\t\t<paksa name=\"{5}\" />\n" +
                                "\t\t<masa name=\"{6}\" adhikamasa=\"{7}\"/>\n" +
                                "\t\t<gaurabda value=\"{8}\" />\n"

                                , GPTithi.getName(d.nTithi), d.nTithiElapse
                                , GPNaksatra.getName(d.nNaksatra), d.nNaksatraElapse, npada
                                , GPPaksa.getName(d.nPaksa)
                                , GPMasa.GetName(d.nMasa), (bDuringAdhika ? "yes" : "no")
                                , d.nGaurabdaYear
                                );

            strText.Append(str);;
            string prefix = string.Format("{0} ", getSharedStringHtml(994));

            strText.Append("\t\t<celebrations>\n");
            foreach (GPStringPair rec in app.output)
            {
                if (rec.Name.StartsWith(prefix))
                {
                    str = string.Format("\t\t\t<celebration gaurabda=\"{0}\" date=\"{1}\" />\n", rec.Name, rec.Value);
                    strText.Append(str);
                }
            }

            strText.Append("\t\t</celebrations>\n\t</result>\n</xml>\n");
        }
Пример #12
0
        public static int WriteXML_GaurabdaTithi(StringBuilder doc, GPLocationProvider loc, GPVedicTime vaStart, GPVedicTime vaEnd)
        {
            int gyearA = vaStart.gyear;
            int gyearB = vaEnd.gyear;
            int gmasa  = vaStart.masa;
            int gpaksa = vaStart.tithi / 15;
            int gtithi = vaStart.tithi % 15;

            if (gyearB < gyearA)
            {
                gyearB = gyearA;
            }



            doc.Append("<xml>\n");
            doc.Append("\t<request name=\"Tithi\" version=\"" + GPFileHelper.FileVersion + "\">\n");
            doc.Append("\t\t<arg name=\"longitude\" val=\"" + loc.getLocation(0).GetLongitudeEastPositive() + "\" />\n");
            doc.Append("\t\t<arg name=\"latitude\" val=\"" + loc.getLocation(0).GetLatitudeNorthPositive() + "\" />\n");
            doc.Append("\t\t<arg name=\"timezone\" val=\"" + loc.getLocation(0).getTimeZone().OffsetSeconds / 60 + "\" />\n");
            if (gyearA > 1500)
            {
                doc.Append("\t\t<arg name=\"year-start\" val=\"" + gyearA + "\" />\n");
                doc.Append("\t\t<arg name=\"year-end\" val=\"" + gyearB + "\" />\n");
            }
            else
            {
                doc.Append("\t\t<arg name=\"gaurabdayear-start\" val=\"" + gyearA + "\" />\n");
                doc.Append("\t\t<arg name=\"gaurabdayear-end\" val=\"" + gyearB + "\" />\n");
            }
            doc.Append("\t\t<arg name=\"masa\" val=\"" + gmasa + "\" />\n");
            doc.Append("\t\t<arg name=\"paksa\" val=\"" + gpaksa + "\" />\n");
            doc.Append("\t\t<arg name=\"tithi\" val=\"" + gtithi + "\" />\n");
            doc.Append("\t</request>\n");
            doc.Append("\t<result name=\"Tithi\">\n");


            GPGregorianTime vcs = new GPGregorianTime(loc), vce = new GPGregorianTime(loc), today = new GPGregorianTime(loc);
            GPSun           sun = new GPSun();
            int             A, B;
            double          sunrise;
            GPAstroData     day = new GPAstroData();
            int             oTithi, oPaksa, oMasa, oYear;

            if (gyearA > 1500)
            {
                A = gyearA - 1487;
                B = gyearB - 1485;
            }
            else
            {
                A = gyearA;
                B = gyearB;
            }

            for (; A <= B; A++)
            {
                vcs = GPTithi.CalcTithiEnd(A, gmasa, gpaksa, gtithi, loc, out vce);
                if (gyearA > 1500)
                {
                    if ((vcs.getYear() < gyearA) || (vcs.getYear() > gyearB))
                    {
                        continue;
                    }
                }
                oTithi = gpaksa * 15 + gtithi;
                oMasa  = gmasa;
                oPaksa = gpaksa;
                oYear  = 0;
                doc.Append("\t<celebration\n");
                doc.Append("\t\trtithi=\"" + GPTithi.getName(oTithi) + "\"\n");
                doc.Append("\t\trmasa=\"" + GPMasa.GetName(oMasa) + "\"\n");
                doc.Append("\t\trpaksa=\"" + GPPaksa.getName(oPaksa) + "\"\n");
                // test ci je ksaya
                today.Copy(vcs);
                today.setDayHours(0.5);
                sun.SunCalc(today, loc);
                sunrise = sun.getSunriseDayHours();
                if (sunrise < vcs.getDayHours())
                {
                    today.Copy(vce);
                    sun.SunCalc(today, loc);
                    sunrise = sun.getSunriseDayHours();
                    if (sunrise < vce.getDayHours())
                    {
                        // normal type
                        vcs.NextDay();
                        doc.Append("\t\ttype=\"normal\"\n");
                    }
                    else
                    {
                        // ksaya
                        vcs.NextDay();
                        day.calculateDayData(vcs, loc);
                        oTithi = day.nTithi;
                        oPaksa = day.nPaksa;
                        oMasa  = day.determineMasa(vcs, out oYear);
                        doc.Append("\t\ttype=\"ksaya\"\n");
                    }
                }
                else
                {
                    // normal, alebo prvy den vriddhi
                    today.Copy(vce);
                    sun.SunCalc(today, loc);
                    if (sun.getSunriseDayHours() < vce.getDayHours())
                    {
                        // first day of vriddhi type
                        doc.Append("\t\ttype=\"vriddhi\"\n");
                    }
                    else
                    {
                        // normal
                        doc.Append("\t\ttype=\"normal\"\n");
                    }
                }
                doc.Append("\t\tdate=\"" + vcs + "\"\n");
                doc.Append("\t\totithi=\"" + GPTithi.getName(oTithi) + "\"\n");
                doc.Append("\t\tomasa=\"" + GPMasa.GetName(oMasa) + "\"\n");
                doc.Append("\t\topaksa=\"" + GPPaksa.getName(oPaksa) + "\"\n");
                doc.Append("\t/>\n");
                //		doc.Append( "\t\t</celebration>\n");
            }


            doc.Append("\t</result>\n");
            doc.Append("</xml>\n");

            return(1);
        }
Пример #13
0
        public static XmlDocument GetCalendarXmlDocument(GPCalendarResults daybuff)
        {
            XmlDocument doc = new XmlDocument();
            XmlElement  e1, e2, e3, eday, e5, e6;
            int         k;
            string      str, st;

            GPCalendarDay pvd;
            int           nPrevMasa = -1;

            e1 = doc.CreateElement("xml");
            doc.AppendChild(e1);

            e2 = doc.CreateElement("request");
            e1.AppendChild(e2);
            e2.SetAttribute("name", "Calendar");
            e2.SetAttribute("version", GPFileHelper.FileVersion);

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "longitude");
            e3.SetAttribute("val", daybuff.CurrentLocation.getLocation(0).GetLongitudeEastPositive().ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "latitude");
            e3.SetAttribute("val", daybuff.CurrentLocation.getLocation(0).GetLatitudeNorthPositive().ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "timezone");
            e3.SetAttribute("val", (daybuff.CurrentLocation.getLocation(0).getTimeZone().OffsetSeconds / 60).ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "startdate");
            e3.SetAttribute("val", daybuff.m_vcStart.ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "daycount");
            e3.SetAttribute("val", daybuff.m_vcCount.ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "dst");
            e3.SetAttribute("val", daybuff.CurrentLocation.getLocation(0).getTimeZoneName());

            e2 = doc.CreateElement("result");
            e1.AppendChild(e2);
            e2.SetAttribute("name", "Calendar");

            e3 = doc.CreateElement("dstsystem");
            e2.AppendChild(e3);
            e3.SetAttribute("name", daybuff.CurrentLocation.getLocation(0).getTimeZoneName());

            for (k = 0; k < daybuff.m_vcCount; k++)
            {
                pvd = daybuff.get(k);
                if (pvd != null)
                {
                    if (nPrevMasa != pvd.astrodata.nMasa)
                    {
                        e3 = doc.CreateElement("masa");
                        e2.AppendChild(e3);
                        e3.SetAttribute("name", GPMasa.GetName(pvd.astrodata.nMasa) + " Masa" + (nPrevMasa == GPMasa.ADHIKA_MASA ? " " + getSharedStringHtml(109) : ""));
                        e3.SetAttribute("gyear", pvd.getGaurabdaYearLongString());
                    }

                    nPrevMasa = pvd.astrodata.nMasa;

                    eday = doc.CreateElement("day");
                    e3.AppendChild(eday);
                    eday.SetAttribute("date", pvd.date.ToString());
                    eday.SetAttribute("dayweekid", pvd.date.getDayOfWeek().ToString());
                    eday.SetAttribute("dayweek", getSharedStringHtml(150 + pvd.date.getDayOfWeek()));

                    // sunrise data
                    e5 = doc.CreateElement("sunrise");
                    eday.AppendChild(e5);
                    e5.SetAttribute("time", pvd.astrodata.sun.rise.getLongTimeString());

                    e6 = doc.CreateElement("tithi");
                    e5.AppendChild(e6);
                    e6.SetAttribute("name", pvd.getTithiNameExtended());
                    e6.SetAttribute("elapse", pvd.astrodata.nTithiElapse.ToString());
                    e6.SetAttribute("index", (pvd.astrodata.nTithi % 30 + 1).ToString());

                    e6 = doc.CreateElement("naksatra");
                    e5.AppendChild(e6);
                    e6.SetAttribute("name", pvd.getNaksatraName());
                    e6.SetAttribute("elapse", pvd.astrodata.nNaksatraElapse.ToString());

                    e6 = doc.CreateElement("yoga");
                    e5.AppendChild(e6);
                    e6.SetAttribute("name", pvd.getYogaName());

                    e6 = doc.CreateElement("paksa");
                    e5.AppendChild(e6);
                    e6.SetAttribute("id", GPPaksa.getAbbreviation(pvd.astrodata.nPaksa));
                    e6.SetAttribute("name", GPPaksa.getName(pvd.astrodata.nPaksa));

                    e5 = doc.CreateElement("dst");
                    eday.AppendChild(e5);
                    e5.SetAttribute("offset", pvd.date.getDaylightTimeBias().ToString());


                    // arunodaya data
                    e5 = doc.CreateElement("arunodaya");
                    eday.AppendChild(e5);
                    e5.SetAttribute("time", pvd.astrodata.sun.arunodaya.getLongTimeString());

                    e6 = doc.CreateElement("tithi");
                    e5.AppendChild(e6);
                    e6.SetAttribute("name", GPTithi.getName(pvd.astrodata.getTithiAtArunodaya()));

                    e5 = doc.CreateElement("noon");
                    eday.AppendChild(e5);
                    e5.SetAttribute("time", pvd.astrodata.sun.noon.getLongTimeString());

                    e5 = doc.CreateElement("sunset");
                    eday.AppendChild(e5);
                    e5.SetAttribute("time", pvd.astrodata.sun.set.getLongTimeString());

                    if (pvd.hasEkadasiParana() && pvd.ekadasiParanaStart != null)
                    {
                        e5 = doc.CreateElement("parana");
                        eday.AppendChild(e5);
                        if (pvd.ekadasiParanaEnd != null)
                        {
                            e5.SetAttribute("from", pvd.ekadasiParanaStart.getShortTimeString());
                            e5.SetAttribute("to", pvd.ekadasiParanaEnd.getShortTimeString());
                        }
                        else
                        {
                            e5.SetAttribute("after", pvd.ekadasiParanaStart.getShortTimeString());
                        }
                    }
                    str = string.Empty;

                    foreach (GPCalendarDay.Festival fest in pvd.Festivals)
                    {
                        e5 = doc.CreateElement("festival");
                        eday.AppendChild(e5);
                        e5.SetAttribute("name", fest.Text);
                        e5.SetAttribute("class", fest.ShowSettingItem);
                    }

                    if (pvd.nFastType != GPConstants.FAST_NULL)
                    {
                        e5 = doc.CreateElement("fast");
                        eday.AppendChild(e5);

                        e5.SetAttribute("type", pvd.nFastType.ToString());
                        e5.SetAttribute("mark", "*");
                    }

                    if (pvd.sankranti_zodiac >= 0)
                    {
                        e5 = doc.CreateElement("sankranti");
                        eday.AppendChild(e5);
                        e5.SetAttribute("rasi", GPSankranti.getName(pvd.sankranti_zodiac));
                        e5.SetAttribute("time", pvd.sankranti_day.getLongTimeString());
                    }

                    if (pvd.hasKsayaTithi())
                    {
                        GPGregorianTime vcStart = pvd.ksayaTithi.getStartTime();
                        GPGregorianTime vcEnd   = pvd.ksayaTithi.getEndTime();

                        e5 = doc.CreateElement("ksaya");
                        eday.AppendChild(e5);
                        e5.SetAttribute("from", vcStart.ToString() + " " + vcStart.getShortTimeString());
                        e5.SetAttribute("to", vcEnd.ToString() + " " + vcEnd.getShortTimeString());
                    }


                    if (pvd.IsSecondDayTithi)
                    {
                        e5 = doc.CreateElement("vriddhi");
                        eday.AppendChild(e5);
                        e5.SetAttribute("sd", "yes");
                    }
                }
            }

            return(doc);
        }