示例#1
0
        public static string GetTextRtf(GPCalendarDay pvd)
        {
            String str;

            str = string.Format("\\par {0} {1} {2} {3}\\tab {4}\\tab {5} ", pvd.date.getDay().ToString().PadLeft(2), GPAppHelper.getMonthAbr(pvd.date.getMonth()), pvd.date.getYear()
                                , pvd.getWeekdayAbbr(), pvd.getTithiNameExtended(), (GPDisplays.Calendar.PaksaInfoVisible() ? GPPaksa.getAbbreviation(pvd.astrodata.nPaksa) : " "));

            if (GPDisplays.Calendar.YogaVisible())
            {
                str += string.Format("\\tab {0}", GPYoga.getName(pvd.astrodata.nYoga));
            }

            if (GPDisplays.Calendar.NaksatraVisible())
            {
                str += string.Format("\\tab {0}", GPNaksatra.getName(pvd.astrodata.nNaksatra));
            }

            if (pvd.nFastType != GPConstants.FAST_NULL && GPDisplays.Calendar.FastingFlagVisible())
            {
                str += "\\tab *";
            }
            else if (GPDisplays.Calendar.FastingFlagVisible())
            {
                str += "\\tab ";
            }

            if (GPDisplays.Calendar.RasiVisible())
            {
                str += string.Format("\\tab {0}", GPSankranti.getName(pvd.astrodata.moon.GetRasi(pvd.astrodata.msAyanamsa)));
            }

            str += "\r\n";

            return(str);
        }
示例#2
0
        public static void FormatTodayInfoRtf(GPGregorianTime vc, GPLocationProvider loc, StringBuilder str)
        {
            string str2, str3 = string.Empty;

            GPCalendarResults db = new GPCalendarResults();

            GPGregorianTime vc2 = new GPGregorianTime(vc);

            vc2.PreviousDay();
            vc2.PreviousDay();
            vc2.PreviousDay();
            vc2.PreviousDay();
            db.CalculateCalendar(vc2, 9);

            int           i = db.FindDate(vc);
            GPCalendarDay p = db.get(i);

            if (p == null)
            {
                return;
            }

            str.Remove(0, str.Length);
            AppendRtfHeader(str);
            str2 = string.Format("\\f2\\fs{0} {1} ", g_HeaderSize, GPAppHelper.getDateText(vc));
            str.Append(str2);

            str.AppendFormat("\\par\\f2\\fs{0} {{\\fs{1} {2}}\\line {3} ({4}, {5}, {6}: {7})",
                             g_TextSize, g_TextSize + 4, getSharedStringRtf(p.date.getDayOfWeek()), loc.getFullName(), loc.getLocation(0).getLatitudeString(),
                             loc.getLocation(0).getLongitudeString(), getSharedStringRtf(12),
                             loc.getLocation(0).getTimeZoneName());
            str.AppendLine("\\par");
            str.AppendLine("\\par");
            str.AppendFormat("  {0}, {1}", p.getTithiName(), p.getPaksaName());
            str.AppendLine("\\par");
            str.AppendFormat("  {0}, {1}", p.getMasaLongName(), p.getGaurabdaYearLongString());
            str.AppendLine("\\par");
            str.AppendLine("\\par");


            // adding mahadvadasi
            // adding spec festivals

            foreach (GPCalendarDay.Festival fest in p.CompleteFestivalList(db.get(i - 1), db.get(i + 1)))
            {
                if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true))
                {
                    if (fest.ShowSettingItem == GPDisplays.Keys.CalendarSankranti)
                    {
                        str.AppendLine(fest.Text.PadLeft((80 + str2.Length) / 2, '-').PadRight(80, '-'));
                        str.AppendLine("\\par");
                    }
                    else
                    {
                        str.Append("\\tab");
                        str.Append(fest.Text);
                        str.AppendLine("\\par");
                    }
                }
            }

            str.AppendLine("\\par");


            if (GPDisplays.Today.BrahmaMuhurtaVisible())
            {
                str.AppendLine("\\par");
                str.AppendFormat("{0} {1}", getSharedStringRtf(988), p.astrodata.sun.arunodaya.getShortMuhurtaRange(0));
            }

            if (GPDisplays.Today.SunriseVisible())
            {
                str.AppendLine("\\par");
                str.AppendFormat("{0} {1} ", getSharedStringRtf(51), p.astrodata.sun.rise.getShortTimeString());
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.rise.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.NoonVisible())
            {
                str2 = string.Format("{0} {1} ", getSharedStringRtf(857), p.astrodata.sun.noon.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.noon.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.SunsetVisible())
            {
                str.AppendFormat("{0}  {1} ", getSharedStringRtf(52), p.astrodata.sun.set.getShortTimeString());
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.set.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.SunriseInfo())
            {
                str.AppendLine("\\par");
                str.Append(getSharedStringRtf(990));
                str.AppendLine("\\par");
                str.AppendFormat("   {1} {2}", GPNaksatra.getName(p.astrodata.nNaksatra), getSharedStringRtf(15));
                if (GPDisplays.Today.NaksatraPadaVisible())
                {
                    str.AppendFormat(", {0} {1} ({2})", p.astrodata.nNaksatraElapse, getSharedStringRtf(993), getSharedStringRtf(811 + p.getNaksatraPada()));
                }
                if (GPDisplays.Today.RasiOfMoonVisible())
                {
                    str.AppendFormat(", {0}: {1}", getSharedStringRtf(991), GPSankranti.getName(p.astrodata.nMoonRasi));
                }
                str.AppendFormat(", {0} {1}", GPYoga.getName(p.astrodata.nYoga), getSharedStringRtf(104));
                str.AppendLine("\\par");
                str.AppendFormat("  {0} {1}", getSharedStringRtf(992), GPSankranti.getName(p.astrodata.nSunRasi));
                str.AppendLine("\\par");
            }
            /* END GCAL 1.4.3 */

            AddNoteRtf(str);
        }
示例#3
0
        public string getEventTitle()
        {
            switch (nType)
            {
            case 10:
                return(GPStrings.getString(42));

            case 11:
                return(GPStrings.getString(51));

            case 12:
                return(GPStrings.getString(857));

            case 13:
                return(GPStrings.getString(52));

            case 20:
                return(string.Format("{0} {1}", GPTithi.getName(nData), GPStrings.getString(13)));

            case 21:
                return(string.Format("{0} {1}", GPNaksatra.getName(nData), GPStrings.getString(15)));

            case 22:
                return(string.Format("{0} {1}", GPSankranti.getName(nData), GPStrings.getString(56)));

            case 23:
                return(string.Format(GPStrings.getString(995), GPSankranti.getName(nData)));

            case GPConstants.CoreEventMoonRise:
                return(GPStrings.getString(53));

            case GPConstants.CoreEventMoonSet:
                return(GPStrings.getString(54));

            case GPConstants.CCTYPE_SUNECLIPSE_CENTER:
                return(GPStrings.getString(1010));

            case GPConstants.CCTYPE_SUNECLIPSE_FULL_END:
                return(GPStrings.getString(1011));

            case GPConstants.CCTYPE_SUNECLIPSE_FULL_START:
                return(GPStrings.getString(1012));

            case GPConstants.CCTYPE_SUNECLIPSE_PARTIAL_END:
                return(GPStrings.getString(1013));

            case GPConstants.CCTYPE_SUNECLIPSE_PARTIAL_START:
                return(GPStrings.getString(1014));

            case GPConstants.CCTYPE_MOONECLIPSE_CENTER:
                return(GPStrings.getString(1015));

            case GPConstants.CCTYPE_MOONECLIPSE_MAIN_FULL_END:
                return(GPStrings.getString(1016));

            case GPConstants.CCTYPE_MOONECLIPSE_MAIN_FULL_START:
                return(GPStrings.getString(1017));

            case GPConstants.CCTYPE_MOONECLIPSE_MAIN_PART_END:
                return(GPStrings.getString(1018));

            case GPConstants.CCTYPE_MOONECLIPSE_MAIN_PART_START:
                return(GPStrings.getString(1019));

            case GPConstants.CCTYPE_MOONECLIPSE_PENUM_FULL_END:
                return(GPStrings.getString(1020));

            case GPConstants.CCTYPE_MOONECLIPSE_PENUM_FULL_START:
                return(GPStrings.getString(1021));

            case GPConstants.CCTYPE_MOONECLIPSE_PENUM_PART_END:
                return(GPStrings.getString(1022));

            case GPConstants.CCTYPE_MOONECLIPSE_PENUM_PART_START:
                return(GPStrings.getString(1023));

            case GPConstants.CCTYPE_TRAVELLING_START:
                return(GPStrings.getString(1031));

            case GPConstants.CCTYPE_TRAVELLING_END:
                return(GPStrings.getString(1032));

            default:
                return(string.Empty);
            }
        }
示例#4
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);
        }
示例#5
0
 public string getRasiOfMoonName()
 {
     return(GPSankranti.getName(astrodata.moon.GetRasi(astrodata.msAyanamsa)));
 }
示例#6
0
        public void CalculateEvents(GPLocationProvider loc, GPGregorianTime vcStart, GPGregorianTime vcEnd)
        {
            GPCoreEventResults inEvents = this;
            GPLocationProvider earth    = loc;
            GPGregorianTime    vc       = new GPGregorianTime(loc);
            GPSun sun = new GPSun();
            //int ndst = 0;
            int nData;

            inEvents.clear();
            inEvents.m_location = loc;
            inEvents.m_vcStart  = vcStart;
            inEvents.m_vcEnd    = vcEnd;

            GPGregorianTime vcAdd  = new GPGregorianTime(loc);
            GPGregorianTime vcTemp = null;
            GPGregorianTime vcNext = new GPGregorianTime(loc);

            vc.Copy(vcStart);

            if (GPDisplays.CoreEvents.Sunrise())
            {
                vcAdd.Copy(vc);
                while (vcAdd.IsBeforeThis(vcEnd))
                {
                    sun.SunCalc(vcAdd, earth);

                    vcTemp = new GPGregorianTime(sun.arunodaya);
                    inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_ARUN, 0);

                    //GPJulianTime tr, tt, ts;
                    //GPAstroEngine.CalculateTimeSun(vcTemp, vcTemp.getLocation(), out tr, out tt, out ts);
                    vcTemp = new GPGregorianTime(sun.rise);
                    //vcTemp = new GPGregorianTime(vcTemp.getLocation(), tr);
                    inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_RISE, 0);

                    vcTemp = new GPGregorianTime(sun.noon);
                    //vcTemp = new GPGregorianTime(vcTemp.getLocation(), tt);
                    inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_NOON, 0);

                    vcTemp = new GPGregorianTime(sun.set);
                    //vcTemp = new GPGregorianTime(vcTemp.getLocation(), ts);
                    inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_SET, 0);

                    vcAdd.NextDay();
                }
            }

            if (GPDisplays.CoreEvents.Tithi())
            {
                GPTithi te = new GPTithi();
                te.setStartDate(vc);
                vcAdd = te.getNext();
                while (vcAdd.IsBeforeThis(vcEnd))
                {
                    nData = te.getCurrentPosition();
                    //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext);
                    inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_TITHI, nData);
                    vcAdd = te.getNext();
                }
            }

            if (GPDisplays.CoreEvents.Naksatra())
            {
                GPNaksatra te = new GPNaksatra();
                te.setStartDate(vc);
                vcAdd = te.getNext();
                while (vcAdd.IsBeforeThis(vcEnd))
                {
                    nData = te.getCurrentNaksatra();
                    //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext);
                    inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_NAKS, nData);
                    vcAdd = te.getNext();
                }
            }

            if (GPDisplays.CoreEvents.Sankranti())
            {
                GPSankranti te = new GPSankranti();
                te.setStartDate(vc);
                vcAdd = te.getNext();
                while (vcAdd.IsBeforeThis(vcEnd))
                {
                    nData = te.getCurrentPosition();
                    //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext);
                    inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_SANK, nData);
                    vcAdd = te.getNext();
                }
            }

            if (GPDisplays.CoreEvents.Conjunction())
            {
                double[]      times = null;
                GPConjunction te    = new GPConjunction();
                te.setStartDate(vc);
                vcAdd = te.getNext();
                while (vcAdd.IsBeforeThis(vcEnd))
                {
                    nData = te.getCurrentPosition();
                    //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext);
                    inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_CONJ, nData);

                    if (GPDisplays.CoreEvents.SunEclipse())
                    {
                        GPAstroEngine.CalculateTimesSunEclipse(vcAdd.getJulianGreenwichTime(), vcAdd.getLocation(), out times);
                        if (times != null && times[2] > 0)
                        {
                            for (int i = 0; i < 5; i++)
                            {
                                if (times[i] > 0)
                                {
                                    GPGregorianTime gt = new GPGregorianTime(vcAdd.getLocation());
                                    gt.setJulianGreenwichTime(new GPJulianTime(times[i], 0.0));
                                    inEvents.AddEvent(gt, GPConstants.SUNECLIPSE_CONSTS[i], 0);
                                }
                            }
                        }
                    }

                    vcAdd = te.getNext();
                }
            }


            // moon eclipses
            if (GPDisplays.CoreEvents.MoonEclipse())
            {
                double[]      times = null;
                GPConjunction te    = new GPConjunction();
                te.setOpositeConjunction(true);
                te.setStartDate(vc);
                vcAdd = te.getNext();
                while (vcAdd.IsBeforeThis(vcEnd))
                {
                    GPAstroEngine.CalculateTimesMoonEclipse(vcAdd.getJulianGreenwichTime(), vcAdd.getLocation(), out times);
                    if (times != null && times[4] > 0)
                    {
                        for (int i = 0; i < 9; i++)
                        {
                            if (times[i] > 0 && GPConstants.MOONECLIPSE_CONSTS[i] > 0)
                            {
                                GPGregorianTime gt = new GPGregorianTime(vcAdd.getLocation());
                                gt.setJulianGreenwichTime(new GPJulianTime(times[i], 0.0));
                                inEvents.AddEvent(gt, GPConstants.MOONECLIPSE_CONSTS[i], 0);
                            }
                        }
                    }

                    vcAdd = te.getNext();
                }
            }

            // rise and set of the moon
            if (GPDisplays.CoreEvents.Moonrise())
            {
                GPJulianTime julian    = vc.getJulian();
                GPJulianTime julianEnd = vcEnd.getJulian();
                GPJulianTime nextJulian;
                TRiseSet     kind;

                while (julian.getGreenwichJulianDay() < julianEnd.getGreenwichJulianDay())
                {
                    nextJulian = GPAstroEngine.GetNextMoonEvent(julian, vc.getLocationProvider(), out kind);
                    if (kind == TRiseSet.RISE)
                    {
                        inEvents.AddEvent(new GPGregorianTime(loc, nextJulian), GPConstants.CoreEventMoonRise, 0);
                    }
                    else if (kind == TRiseSet.SET)
                    {
                        inEvents.AddEvent(new GPGregorianTime(loc, nextJulian), GPConstants.CoreEventMoonSet, 0);
                    }
                    julian.setGreenwichJulianDay(nextJulian.getGreenwichJulianDay() + 10.0 / 1440.0);
                }
            }

            // travellings
            {
                GPJulianTime julian = vc.getJulian();
                GPJulianTime julianEnd = vcEnd.getJulian();
                double       start, end;

                start = julian.getGreenwichJulianDay();
                end   = julianEnd.getGreenwichJulianDay();

                for (int i = 0; i < loc.getChangeCount(); i++)
                {
                    GPLocationChange chn = loc.getChangeAtIndex(i);
                    if ((chn.julianStart >= start && chn.julianStart <= end) ||
                        (chn.julianStart >= start && chn.julianEnd <= end))
                    {
                        GPGregorianTime startTime = new GPGregorianTime(chn.LocationA);
                        startTime.setJulianGreenwichTime(new GPJulianTime(chn.julianStart, 0));
                        GPGregorianTime endTime = new GPGregorianTime(chn.LocationB);
                        endTime.setJulianGreenwichTime(new GPJulianTime(chn.julianEnd, 0));
                        inEvents.AddEvent(startTime, GPConstants.CCTYPE_TRAVELLING_START, 0);
                        inEvents.AddEvent(endTime, GPConstants.CCTYPE_TRAVELLING_END, 0);
                    }
                }
            }

            // eventual sorting
            inEvents.Sort(GPDisplays.CoreEvents.Sort());
        }
示例#7
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++;
            }
        }
示例#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 void AvcGetTodayInfo(GPGregorianTime vc, GPLocationProvider loc, StringBuilder str)
        {
            string str2;

            GPCalendarResults db = new GPCalendarResults();

            GPGregorianTime vc2 = new GPGregorianTime(vc);

            vc2.AddDays(-4);
            db.CalculateCalendar(vc2, 9);

            int           i = db.FindDate(vc);
            GPCalendarDay p = db.get(i);

            if (p == null)
            {
                return;
            }

            str.AppendFormat("{0}, {1} {2}", loc.getFullName(), loc.getLocation(0).getLatitudeString(), loc.getLocation(0).getLongitudeString());
            str.AppendLine();
            str.AppendFormat("{0}: {1}", getSharedStringPlain(12), loc.getLocation(0).getTimeZoneString());
            str.AppendLine();
            str.AppendLine();
            str.AppendFormat("[{0} - {1}]", vc, getSharedStringPlain(vc.getDayOfWeek()));
            str.AppendLine();
            str.AppendFormat("  {0}, {1} {2}", GPTithi.getName(p.astrodata.nTithi), GPPaksa.getName(p.astrodata.nPaksa), getSharedStringPlain(20));
            str.AppendLine();
            str.Append("  ");
            str.AppendFormat("{0}, {1}", p.getMasaLongName(), p.getGaurabdaYearLongString());
            str.AppendLine();
            str.AppendLine();

            if (p.hasEkadasiParana())
            {
                str.AppendLine(p.getEkadasiParanaString());
            }

            // adding mahadvadasi
            // adding spec festivals

            foreach (GPCalendarDay.Festival fest in p.CompleteFestivalList(db.get(i - 1), db.get(i + 1)))
            {
                if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true))
                {
                    if (fest.ShowSettingItem == GPDisplays.Keys.CalendarSankranti)
                    {
                        str.AppendLine(GPAppHelper.CenterString(fest.Text, 80, '-'));
                    }
                    else
                    {
                        str.AppendFormat("   {0}", fest.Text);
                        str.AppendLine();
                    }
                }
            }


            str.AppendLine();


            if (GPDisplays.Today.BrahmaMuhurtaVisible())
            {
                str.AppendLine();
                str.AppendFormat("{0} {1}", getSharedStringPlain(988), p.astrodata.sun.arunodaya.getShortMuhurtaRange(0));
            }

            if (GPDisplays.Today.SunriseVisible())
            {
                str.AppendLine();
                str2 = string.Format("{0} {1} ",
                                     getSharedStringPlain(51), p.astrodata.sun.rise.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1}", getSharedStringPlain(989), p.astrodata.sun.rise.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine();
            }
            if (GPDisplays.Today.NoonVisible())
            {
                str2 = string.Format("{0}    {1} ", getSharedStringPlain(857), p.astrodata.sun.noon.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringPlain(989), p.astrodata.sun.noon.getShortSandhyaRange());
                }
                str2 = string.Format(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.Append(str2);
                str.AppendLine();
            }
            if (GPDisplays.Today.SunsetVisible())
            {
                str2 = string.Format("{0}  {1} ", getSharedStringPlain(52), p.astrodata.sun.set.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringPlain(989), p.astrodata.sun.set.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine();
            }

            if (GPDisplays.Today.SunriseInfo())
            {
                str.AppendLine();
                str.AppendLine(getSharedStringPlain(990));
                str.AppendLine();
                str.AppendFormat("   {0} {1}", GPNaksatra.getName(p.astrodata.nNaksatra), getSharedStringPlain(15));
                if (GPDisplays.Today.NaksatraPadaVisible())
                {
                    str.AppendFormat(", {0} {1} ({2})", p.getNaksatraElapsedString(), getSharedStringPlain(993), getSharedStringPlain(811 + p.getNaksatraPada()));
                }
                if (GPDisplays.Today.RasiOfMoonVisible())
                {
                    str.AppendFormat(", {0}: {1}", getSharedStringPlain(991), GPSankranti.getName(p.astrodata.nMoonRasi), getSharedStringPlain(105));
                }
                str.AppendFormat(", {0} {1}", GPYoga.getName(p.astrodata.nYoga), getSharedStringPlain(104));
                str.AppendLine();
                str.AppendFormat("   {0}: {1}.", getSharedStringPlain(992), GPSankranti.getName(p.astrodata.nSunRasi));
                str.AppendLine();
            }

            AddNoteText(str);
        }
示例#10
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);
        }
示例#11
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);
        }
示例#12
0
        public static XmlDocument GetSankrantiXml(GPLocationProvider loc, GPGregorianTime vcStart, GPGregorianTime vcEnd)
        {
            XmlDocument doc = new XmlDocument();
            XmlElement  e1, e2, e3, eday, e5, e6;

            GPGregorianTime d = new GPGregorianTime(loc);
            int             zodiac;

            d.Copy(vcStart);


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

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

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "longitude");
            e3.SetAttribute("val", loc.GetLongitudeEastPositive().ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "latitude");
            e3.SetAttribute("val", loc.GetLatitudeNorthPositive().ToString());

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

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

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "enddate");
            e3.SetAttribute("val", vcEnd.ToString());

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



            while (d.IsBeforeThis(vcEnd))
            {
                d = GPSankranti.GetNextSankranti(d, out zodiac);

                eday = doc.CreateElement("sank");
                e2.AppendChild(eday);

                eday.SetAttribute("date", d.getLongDateString());
                eday.SetAttribute("time", d.getLongTimeString());
                eday.SetAttribute("dayweekid", d.getDayOfWeek().ToString());
                eday.SetAttribute("dayweek", getSharedStringHtml(d.getDayOfWeek()));

                e5 = doc.CreateElement("zodiac");
                eday.AppendChild(e5);

                e5.SetAttribute("sans", GPSankranti.GetNameSan(zodiac));
                e5.SetAttribute("eng", GPSankranti.GetNameEng(zodiac));
                e5.SetAttribute("id", zodiac.ToString());

                d.NextDay();
                d.NextDay();
            }

            return(doc);
        }