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)); }
public static int WriteXML_Tithi(StringBuilder doc, GPLocationProvider loc, GPGregorianTime vc) { doc.Append("<xml>\n"); doc.Append("\t<request name=\"Tithi\" version=\"" + GPFileHelper.FileVersion + "\">\n"); doc.Append("\t\t<arg name=\"longitude\" val=\"" + vc.getLocation().GetLongitudeEastPositive() + "\" />\n"); doc.Append("\t\t<arg name=\"latitude\" val=\"" + vc.getLocation().GetLatitudeNorthPositive() + "\" />\n"); doc.Append("\t\t<arg name=\"timezone\" val=\"" + vc.getLocation().getTimeZone().OffsetSeconds / 60 + "\" />\n"); doc.Append("\t\t<arg name=\"startdate\" val=\"" + vc + "\" />\n"); doc.Append("\t</request>\n"); doc.Append("\t<result name=\"Tithi\">\n"); GPGregorianTime d = new GPGregorianTime(vc); GPGregorianTime d1 = new GPGregorianTime(loc); GPGregorianTime d2 = new GPGregorianTime(loc); GPAstroData day = new GPAstroData(); day.calculateDayData(vc, loc); d.setDayHours(day.sun.getSunriseDayHours()); GPTithi.GetPrevTithiStart(d, out d1); GPTithi.GetNextTithiStart(d, out d2); //dt.SetDegTime(d1.getDayHours() * 360); // start tithi at t[0] doc.Append("\t\t<tithi\n\t\t\tid=\"" + day.nTithi + "\"\n"); doc.Append("\t\t\tname=\"" + GPTithi.getName(day.nTithi) + "\"\n"); doc.Append("\t\t\tstartdate=\"" + d1.getShortDateString() + "\"\n"); doc.Append("\t\t\tstarttime=\"" + d1.getShortTimeString() + "\"\n"); //dt.SetDegTime(d2.getDayHours() * 360); doc.Append("\t\t\tenddate=\"" + d2.getShortDateString() + "\"\n"); doc.Append("\t\t\tendtime=\"" + d2.getShortTimeString() + "\"\n />"); doc.Append("\t</result>\n"); doc.Append("</xml>\n"); return(1); }
public string getTithiNameExtended() { if ((astrodata.nTithi == 10) || (astrodata.nTithi == 25) || (astrodata.nTithi == 11) || (astrodata.nTithi == 26)) { if (hasEkadasiParana() == false) { if (nMahadvadasiType == GPConstants.EV_NULL) { return(string.Format("{0} {1}", GPTithi.getName(astrodata.nTithi), GPStrings.getString(58))); } else { return(string.Format("{0} {1}", GPTithi.getName(astrodata.nTithi), GPStrings.getString(59))); } } } return(GPTithi.getName(astrodata.nTithi)); }
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); } }
public string getTithiName() { return(GPTithi.getName(astrodata.nTithi)); }
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); }
public string getName() { return(GPTithi.getName(tithi)); }
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++; } }
public static int FormatCalendarVCAL(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 = " , "; DateTime st = new DateTime(); m_text.Remove(0, m_text.Length); m_text.Append("BEGIN:VCALENDAR\nVERSION:1.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 * Convert.ToInt32(st.DayOfWeek), st.Month, st.Hour, st.Minute + st.Millisecond); m_text.Append(str2); m_text.Append("\nX-WR-TIMEZONE:"); m_text.Append(daybuff.CurrentLocation.getLocation(0).getTimeZoneName()); m_text.Append("\n"); m_text.Append("CALSCALE:GREGORIAN\nMETHOD:PUBLISH\n"); for (k = 0; k < daybuff.m_PureCount; k++) { 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}", pvd.getMasaLongName(), pvd.getGaurabdaYearLongString()); dayText.Append(str); dayText.AppendLine(); 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.AppendLine(); } 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.AppendLine(); initialLength += dayText.Length; if (pvd.astrodata.sun.eclipticalLongitude >= 0.0) { if (pvd.hasEkadasiParana()) { m_text.AppendLine("BEGIN:VEVENT"); if (pvd.ekadasiParanaStart != null) { str2 = string.Format("DTSTART:{0:0000}{1:00}{2:00}T{3:00}{4:00}00", pvd.date.getYear(), pvd.date.getMonth(), pvd.date.getDay(), pvd.ekadasiParanaStart.getHour(), pvd.ekadasiParanaStart.getMinute()); } else { str2 = string.Format("DTSTART:{0:0000}{1:00}{2:00}T000000", pvd.date.getYear(), pvd.date.getMonth(), pvd.date.getDay()); } m_text.AppendLine(str2); if (pvd.ekadasiParanaEnd != null) { str2 = string.Format("DTEND:{0:0000}{1:00}{2:00}T{3:00}{4:00}00", pvd.date.getYear(), pvd.date.getMonth(), pvd.date.getDay(), pvd.ekadasiParanaEnd.getHour(), pvd.ekadasiParanaEnd.getMinute()); } else { str2 = string.Format("DTEND:{0:0000}{1:00}{2:00}T{3:00}{4:00}00", pvd.date.getYear(), pvd.date.getMonth(), pvd.date.getDay(), pvd.astrodata.sun.set.getHour(), pvd.astrodata.sun.set.getMinute()); } m_text.AppendLine(str2); m_text.Append("SUMMARY:"); m_text.Append(getSharedStringHtml(60)); m_text.Append("\nSEQUENCE:1\nEND:VEVENT\n"); } foreach (GPCalendarDay.Festival fest in pvd.CompleteFestivalList(prevd, nextd)) { if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true)) { dayText.Append(SPACE_BEFORE_LINE); dayText.AppendLine(fest.Text); } } } if (dayText.Length > initialLength) { m_text.Append("BEGIN:VEVENT\n"); str2 = string.Format("DTSTART:{0:0000}{1:00}{2:00}T{3:00}{4:00}{5:00}\n", pvd.date.getYear(), pvd.date.getMonth(), pvd.date.getDay(), pvd.astrodata.sun.rise.getHour(), pvd.astrodata.sun.rise.getMinute(), pvd.astrodata.sun.rise.getSecond()); m_text.Append(str2); str2 = string.Format("DTEND:{0:0000}{1:00}{2:00}T{3:00}{4:00}{5:00}\n", pvd.date.getYear(), pvd.date.getMonth(), pvd.date.getDay(), pvd.astrodata.sun.set.getHour(), pvd.astrodata.sun.set.getMinute(), pvd.astrodata.sun.set.getSecond()); m_text.Append(str2); str2 = string.Format("LOCATION:{0}\n", pvd.date.getLocation().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("SEQUENCE:1\nEND:VEVENT\n"); } } } m_text.Append("END:VCALENDAR\n"); return(1); }
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); }
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); }
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); }
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); }
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"); }
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); }
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); }