public static XmlDocument GetSankrantiListXml(GCLocation loc, GregorianDateTime vcStart, GregorianDateTime vcEnd) { GregorianDateTime d = new GregorianDateTime(); int zodiac; XmlDocument doc = new XmlDocument(); XmlElement e1 = doc.CreateElement("xml"); doc.AppendChild(e1); XmlElement e2, e3; GCEarthData earth = loc.GetEarthData(); // open file d.Set(vcStart); e2 = doc.CreateElement("request"); e1.AppendChild(e2); e2.SetAttribute("name", "Sankranti"); e2.SetAttribute("version", GCStrings.getString(130)); e2.SetAttribute("longitude", loc.Longitude.ToString()); e2.SetAttribute("latitude", loc.Latitude.ToString()); e2.SetAttribute("timezone", loc.OffsetUtcHours.ToString()); e2.SetAttribute("startdate", vcStart.ToString()); e2.SetAttribute("enddate", vcEnd.ToString()); e2 = doc.CreateElement("result"); e2.SetAttribute("name", "SankrantiList"); e1.AppendChild(e2); while (d.IsBeforeThis(vcEnd)) { d.Set(GCSankranti.GetNextSankranti(d, earth, out zodiac)); d.InitWeekDay(); e3 = doc.CreateElement("sank"); e2.AppendChild(e3); e3.SetAttribute("date", d.ToString()); e3.SetAttribute("dayweekid", d.dayOfWeek.ToString()); e3.SetAttribute("dayweek", GCCalendar.GetWeekdayName(d.dayOfWeek)); e3.SetAttribute("time", d.LongTimeString()); e3.SetAttribute("rasi", zodiac.ToString()); e3.SetAttribute("rasiName", GCRasi.GetName(zodiac)); e3.SetAttribute("rasiNameEn", GCRasi.GetNameEn(zodiac)); d.NextDay(); d.NextDay(); } return(doc); }
public override GSCore GetPropertyValue(string s) { switch (s) { case "nType": return(new GSNumber(nType)); case "nData": return(new GSNumber(nType)); case "Time": return(Time); case "nDst": return(new GSNumber(nDst)); case "tithiName": return(new GSString(GCTithi.GetName(nData))); case "naksatraName": return(new GSString(GCNaksatra.GetName(nData))); case "rasiName": return(new GSString(GCRasi.GetName(nData))); case "groupNameString": return(new GSString(GetTypeString(nType))); case "typeString": return(new GSString(GetTypeString(nType, nData))); case "dstSignature": return(new GSString(GCStrings.GetDSTSignature(nDst))); default: return(base.GetPropertyValue(s)); } }
public static void Export(string pszFile, int format) { String strc; using (StreamWriter f = new StreamWriter(pszFile)) { foreach (GCFestivalBook book in GCFestivalBookCollection.Books) { switch (format) { case 1: foreach (GCFestivalBase fb in book.Festivals) { if (fb is GCFestivalTithiMasa) { GCFestivalTithiMasa pce = fb as GCFestivalTithiMasa; strc = string.Format("{0}\n\t{1} Tithi,{2} Paksa,{3} Masa\n", pce.Text, GCTithi.GetName(pce.nTithi), GCPaksa.GetName(pce.nTithi / 15), GCMasa.GetName(pce.nMasa)); f.Write(strc); if (pce.FastID != 0) { strc = string.Format("\t{0}\n", GCStrings.GetFastingName(pce.FastID)); f.Write(strc); } } else if (fb is GCFestivalSankranti) { GCFestivalSankranti se = fb as GCFestivalSankranti; f.Write(string.Format("{0}\n\t\t{1} Sankranti, {2}\n", se.Text, GCRasi.GetName(se.RasiOfSun), se.DayOffset)); } } break; case 2: { f.Write("<xml>\n"); foreach (GCFestivalBase fb in book.Festivals) { f.Write("\t<event>\n"); if (fb is GCFestivalTithiMasa) { GCFestivalTithiMasa pce = fb as GCFestivalTithiMasa; strc = string.Format("\t\t<name>{0}</name>\n", pce.Text); f.Write(strc); strc = string.Format("\t\t<tithi>{0}</tithi>\n", GCTithi.GetName(pce.nTithi)); f.Write(strc); strc = string.Format("\t\t<paksa>{0}</paksa>\n", GCPaksa.GetName(pce.nTithi / 15)); f.Write(strc); strc = string.Format("\t\t<masa>{0}</masa>\n", GCMasa.GetName(pce.nMasa)); f.Write(strc); } else if (fb is GCFestivalSankranti) { GCFestivalSankranti se = fb as GCFestivalSankranti; f.Write("\t\t<name>" + se.Text + "</name>\n"); f.Write("\t\t<sankranti>" + GCRasi.GetName(se.RasiOfSun) + "</sankranti>\n"); f.Write("\t\t<rel>" + se.DayOffset + "</rel>\n"); } if (fb.EventsCount > 0) { foreach (GCFestivalBase fb2 in fb.Events) { if (fb2 is GCFestivalRelated) { GCFestivalRelated rel = fb2 as GCFestivalRelated; f.Write("\t\t<relatedEvent>\n"); f.Write("\t\t\t<name>" + rel.Text + "</name>\n"); f.Write("\t\t\t<offset>" + rel.DayOffset + "</offset>\n"); f.Write("\t\t</relatedEvent>\n"); } } } f.Write("\t</event>\n"); } f.Write("</xml>\n"); } break; case 3: GSScript script = new GSScript(); script.Add(new GSToken("book")); script.Add(new GSList(new GSToken("bookId"), new GSNumber(book.CollectionId))); script.Add(new GSList(new GSToken("bookName"), new GSString(book.CollectionName))); foreach (GCFestivalBase fb in book.Festivals) { script.Add(fb.ExecuteMessage("getScript")); } script.writeScript(f); break; case 15: { f.Write("{\n"); f.Write("\tname: \"" + book.CollectionName + "\",\n"); f.Write("\tbookid: " + book.CollectionId + ",\n"); f.Write("\tevents: [\n"); foreach (GCFestivalBase fb in book.Festivals) { f.Write("\t\t{\n"); if (fb is GCFestivalTithiMasa) { GCFestivalTithiMasa pce = fb as GCFestivalTithiMasa; f.Write("\t\t\ttype: \"T\",\n"); f.Write("\t\t\tname: \"{0}\",\n", pce.Text); f.Write("\t\t\ttithi: {0},\n", pce.nTithi); f.Write("\t\t\tmasa: {0}\n", pce.nMasa); f.Write("\t\t\tfastSubj: \"{0}\",\n", pce.FastingSubject); f.Write("\t\t\tfast: {0},\n", pce.FastID); f.Write("\t\t\tstart: {0},\n", pce.StartYear); f.Write("\t\t\tdayoff: {0},\n", pce.DayOffset); } else if (fb is GCFestivalSankranti) { GCFestivalSankranti se = fb as GCFestivalSankranti; f.Write("\t\t\ttype:\"S\",\n"); f.Write("\t\t\tname: \"" + se.Text + "\",\n"); f.Write("\t\t\tsankranti: " + se.RasiOfSun + ",\n"); f.Write("\t\t\tfastSubj: \"{0}\",\n", fb.FastingSubject); f.Write("\t\t\tfast: {0},\n", fb.FastID); f.Write("\t\t\tstart: {0},\n", fb.StartYear); f.Write("\t\t\tdayoff: {0},\n", fb.DayOffset); } else if (fb is GCFestivalSpecial) { GCFestivalSpecial spe = fb as GCFestivalSpecial; f.Write("\t\t\ttype: \"X\",\n"); f.Write("\t\t\tname: \"" + spe.Text + "\",\n"); f.Write("\t\t\tmasa1: " + spe.nMasaMin + ",\n"); f.Write("\t\t\tmasa2: " + spe.nMasaMax + ",\n"); f.Write("\t\t\tscript: \"" + spe.Script + "\",\n"); f.Write("\t\t\tfastSubj: \"{0}\",\n", fb.FastingSubject); f.Write("\t\t\tfast: {0},\n", fb.FastID); f.Write("\t\t\tstart: {0},\n", fb.StartYear); f.Write("\t\t\tdayoff: {0},\n", fb.DayOffset); } else if (fb is GCFestivalEkadasi) { GCFestivalEkadasi se = fb as GCFestivalEkadasi; f.Write("\t\t\ttype: \"E\",\n"); f.Write("\t\t\tname: \"" + se.Text + "\",\n"); f.Write("\t\t\tmasa: " + se.nMasa + ",\n"); f.Write("\t\t\tpaksa: " + se.nPaksa + ",\n"); f.Write("\t\t\tfastSubj: \"{0}\",\n", fb.FastingSubject); f.Write("\t\t\tfast: {0},\n", fb.FastID); f.Write("\t\t\tstart: {0},\n", fb.StartYear); f.Write("\t\t\tdayoff: {0},\n", fb.DayOffset); } if (fb.EventsCount > 0) { f.Write("\t\t\tevents: [\n"); foreach (GCFestivalBase fb2 in fb.Events) { if (fb2 is GCFestivalRelated) { GCFestivalRelated rel = fb2 as GCFestivalRelated; f.Write("\t\t\t\t{\n\t\t\t\t\ttype:\"R\",\n"); f.Write("\t\t\t\t\tname: \"" + rel.Text + "\",\n"); f.Write("\t\t\t\t\tfastSubj: \"{0}\",\n", fb2.FastingSubject); f.Write("\t\t\t\t\tfast: {0},\n", fb2.FastID); f.Write("\t\t\t\t\tstart: {0},\n", fb2.StartYear); f.Write("\t\t\t\t\tdayoff: {0},\n", fb2.DayOffset); f.Write("\t\t\t\t},\n"); } } f.Write("\t\t\t]"); } f.Write("\t\t},\n"); } f.Write("\t]\n"); f.Write("},\n"); } break; default: break; } } } }
public string Format(string format, params string[] args) { StringBuilder sb = new StringBuilder(format); if (format.IndexOf("{day}") >= 0) { format = format.Replace("{day}", date.day.ToString()); } if (format.IndexOf("{month}") >= 0) { format = format.Replace("{month}", date.month.ToString()); } if (format.IndexOf("{monthAbr}") >= 0) { format = format.Replace("{monthAbr}", GregorianDateTime.GetMonthName(date.month)); } if (format.IndexOf("{monthName}") >= 0) { format = format.Replace("{monthName}", GregorianDateTime.GetMonthName(date.month)); } if (format.IndexOf("{year}") >= 0) { format = format.Replace("{year}", date.year.ToString()); } if (format.IndexOf("{hour}") >= 0) { format = format.Replace("{hour}", date.GetHour().ToString("D2")); } if (format.IndexOf("{min}") >= 0) { format = format.Replace("{min}", date.GetMinute().ToString("D2")); } if (format.IndexOf("{minRound}") >= 0) { format = format.Replace("{minRound}", date.GetMinuteRound().ToString("D2")); } if (format.IndexOf("{sec}") >= 0) { format = format.Replace("{sec}", date.GetSecond().ToString("D2")); } if (format.IndexOf("{masaName}") >= 0) { format = format.Replace("{masaName}", GCMasa.GetName(astrodata.Masa)); } if (format.IndexOf("{gaurabdaYear}") >= 0) { format = format.Replace("{gaurabdaYear}", astrodata.GaurabdaYear.ToString()); } if (format.IndexOf("{tithiName}") >= 0) { format = format.Replace("{tithiName}", GCTithi.GetName(astrodata.sunRise.Tithi)); } if (format.IndexOf("{prevTithiName}") >= 0) { format = format.Replace("{prevTithiName}", GCTithi.GetName((astrodata.sunRise.Tithi + 29) % 30)); } if (format.IndexOf("{nextTithiName}") >= 0) { format = format.Replace("{nextTithiName}", GCTithi.GetName((astrodata.sunRise.Tithi + 1) % 30)); } if (format.IndexOf("{paksaName}") >= 0) { format = format.Replace("{paksaName}", GCPaksa.GetName(astrodata.sunRise.Paksa)); } if (format.IndexOf("{yogaName}") >= 0) { format = format.Replace("{yogaName}", GCYoga.GetName(astrodata.sunRise.Yoga)); } if (format.IndexOf("{naksatraName}") >= 0) { format = format.Replace("{naksatraName}", GCNaksatra.GetName(astrodata.sunRise.Naksatra)); } if (format.IndexOf("{naksatraElapse}") >= 0) { format = format.Replace("{naksatraElapse}", astrodata.sunRise.NaksatraElapse.ToString("P2")); } if (format.IndexOf("{naksatraPada}") >= 0) { format = format.Replace("{naksatraPada}", GCNaksatra.GetPadaText(astrodata.sunRise.NaksatraPada)); } if (format.IndexOf("{sankranti.day}") >= 0) { format = format.Replace("{sankranti.day}", sankranti_day.day.ToString()); } if (format.IndexOf("{sankranti.month}") >= 0) { format = format.Replace("{sankranti.month}", sankranti_day.month.ToString()); } if (format.IndexOf("{sankranti.monthAbr}") >= 0) { format = format.Replace("{sankranti.monthAbr}", GregorianDateTime.GetMonthName(sankranti_day.month)); } if (format.IndexOf("{sankranti.monthName}") >= 0) { format = format.Replace("{sankranti.monthName}", GregorianDateTime.GetMonthName(sankranti_day.month)); } if (format.IndexOf("{sankranti.hour}") >= 0) { format = format.Replace("{sankranti.hour}", sankranti_day.GetHour().ToString("D2")); } if (format.IndexOf("{sankranti.min}") >= 0) { format = format.Replace("{sankranti.min}", sankranti_day.GetMinute().ToString("D2")); } if (format.IndexOf("{sankranti.minRound}") >= 0) { format = format.Replace("{sankranti.minRound}", sankranti_day.GetMinuteRound().ToString("D2")); } if (format.IndexOf("{sankranti.sec}") >= 0) { format = format.Replace("{sankranti.sec}", sankranti_day.GetSecond().ToString("D2")); } if (format.IndexOf("{sankranti.rasiNameEn}") >= 0) { format = format.Replace("{sankranti.rasiNameEn}", GCRasi.GetNameEn(sankranti_zodiac)); } if (format.IndexOf("{sankranti.rasiName}") >= 0) { format = format.Replace("{sankranti.rasiName}", GCRasi.GetName(sankranti_zodiac)); } if (format.IndexOf("{dstSig}") >= 0) { format = format.Replace("{dstSig}", GCStrings.GetDSTSignature(BiasMinutes)); } if (format.IndexOf("{moonRiseTime}") >= 0) { format = format.Replace("{moonRiseTime}", moonrise.ToShortTimeString()); } if (format.IndexOf("{moonSetTime}") >= 0) { format = format.Replace("{moonSetTime}", moonset.ToShortTimeString()); } if (format.IndexOf("{moonRasiName}") >= 0) { format = format.Replace("{moonRasiName}", GCRasi.GetName(astrodata.sunRise.RasiOfMoon)); } if (format.IndexOf("{moonRasiNameEn}") >= 0) { format = format.Replace("{moonRasiNameEn}", GCRasi.GetNameEn(astrodata.sunRise.RasiOfMoon)); } if (args == null || args.Length == 0) { return(format.ToString()); } else { return(string.Format(format.ToString(), args)); } }
public static string GetTypeString(int nType, int nData) { switch (nType) { case CoreEventType.CCTYPE_ASCENDENT: return("Ascendent " + GCRasi.GetName(nData)); case CoreEventType.CCTYPE_CONJ: return("Conjunction in " + GCRasi.GetName(nData)); case CoreEventType.CCTYPE_DATE: return("Date"); case CoreEventType.CCTYPE_DAY_MUHURTA: return(string.Format("{0} Muhurta", GCStrings.GetMuhurtaName(nData))); case CoreEventType.CCTYPE_DAY_OF_WEEK: return(GCCalendar.GetWeekdayName(nData)); case CoreEventType.CCTYPE_KALA_END: return(string.Format("{0} ends", GCStrings.GetKalaName(nData))); case CoreEventType.CCTYPE_KALA_START: return(string.Format("{0} starts", GCStrings.GetKalaName(nData))); case CoreEventType.CCTYPE_M_RASI: return(string.Format("Moon in {0} rasi", GCRasi.GetName(nData))); case CoreEventType.CCTYPE_M_RISE: return("Moon rise"); case CoreEventType.CCTYPE_M_SET: return("Moon set"); case CoreEventType.CCTYPE_NAKS: return(string.Format("{0} Naksatra", GCNaksatra.GetName(nData))); case CoreEventType.CCTYPE_S_ARUN: return("Arunodaya"); case CoreEventType.CCTYPE_S_MIDNIGHT: return("Midnight"); case CoreEventType.CCTYPE_S_NOON: return("Noon"); case CoreEventType.CCTYPE_S_RISE: return("Sunrise"); case CoreEventType.CCTYPE_S_SET: return("Sunset"); case CoreEventType.CCTYPE_SANK: return(string.Format("{0} Sankranti", GCRasi.GetName(nData))); case CoreEventType.CCTYPE_TITHI: return(string.Format("{0} Tithi", GCTithi.GetName(nData))); case CoreEventType.CCTYPE_YOGA: return(string.Format("{0} Yoga", GCYoga.GetName(nData))); default: return(string.Format("Unspecified event {0} / {1}", nType, nData)); } }
public void calculateAppDay(GCLocation location, GregorianDateTime eventDate) { //MOONDATA moon; //SUNDATA sun; GCAstroData d = this.details = new GCAstroData(); GregorianDateTime vc = new GregorianDateTime(); GregorianDateTime vcsun = new GregorianDateTime(); GCEarthData m_earth = location.GetEarthData(); vc.Set(eventDate); vcsun.Set(eventDate); this.b_adhika = false; this.eventTime = new GregorianDateTime(eventDate); Location = location; //d.nTithi = GetPrevTithiStart(m_earth, vc, dprev); //GetNextTithiStart(m_earth, vc, dnext); vcsun.shour -= vcsun.TimezoneHours / 24.0; vcsun.NormalizeValues(); vcsun.TimezoneHours = 0.0; d.sunRise = new GCHourTime(); d.sunRise.TotalDays = vc.shour; d.sunRise.longitude = GCCoreAstronomy.GetSunLongitude(vcsun, m_earth); d.sunRise.longitudeMoon = GCCoreAstronomy.GetMoonLongitude(vcsun, m_earth); d.Ayanamsa = GCAyanamsha.GetAyanamsa(vc.GetJulianComplete()); d.sunRise.Ayanamsa = d.Ayanamsa; // tithi d.Masa = d.MasaCalc(vc, m_earth); if (d.Masa == (int)MasaId.ADHIKA_MASA) { d.Masa = d.sunRise.RasiOfSun; this.b_adhika = true; } vc.Today(); vc.TimezoneHours = m_earth.OffsetUtcHours; int m = 0; GaurabdaDate va = new GaurabdaDate(); GregorianDateTime vctemp; va.tithi = d.sunRise.Tithi; va.masa = d.Masa; va.gyear = GCCalendar.GetGaurabdaYear(vc, m_earth); if (va.gyear < d.GaurabdaYear) { va.gyear = d.GaurabdaYear; } MainInfo.Add(new AppDayInfo(GCStrings.getString(7), eventDate.ToString())); MainInfo.Add(new AppDayBase()); MainInfo.Add(new AppDayInfo(GCStrings.getString(8), eventDate.ShortTimeString())); MainInfo.Add(new AppDayBase()); MainInfo.Add(new AppDayBase()); MainInfo.Add(new AppDayInfo(GCStrings.getString(9), location.Title)); MainInfo.Add(new AppDayInfo(GCStrings.getString(10), location.GetLatitudeString())); MainInfo.Add(new AppDayInfo(GCStrings.getString(11), location.GetLongitudeString())); MainInfo.Add(new AppDayInfo(GCStrings.Localized("Timezone"), location.TimeZoneName)); MainInfo.Add(new AppDayInfo("DST", "N/A")); MainInfo.Add(new AppDayBase()); MainInfo.Add(new AppDayInfo(GCStrings.getString(13), GCTithi.GetName(d.sunRise.Tithi))); MainInfo.Add(new AppDayInfo(GCStrings.getString(14), string.Format("{0:00.000}%", d.sunRise.TithiElapse))); MainInfo.Add(new AppDayInfo(GCStrings.getString(15), GCNaksatra.GetName(d.sunRise.Naksatra))); MainInfo.Add(new AppDayInfo(GCStrings.getString(16), string.Format("{0:00.000}% ({1} pada)", d.sunRise.NaksatraElapse, GCStrings.getString(811 + d.sunRise.NaksatraPada)))); MainInfo.Add(new AppDayInfo(GCStrings.Localized("Moon Rasi"), GCRasi.GetName(d.sunRise.RasiOfMoon))); MainInfo.Add(new AppDayInfo(GCStrings.Localized("Sun Rasi"), GCRasi.GetName(d.sunRise.RasiOfSun))); MainInfo.Add(new AppDayInfo(GCStrings.getString(20), GCPaksa.GetName(d.sunRise.Paksa))); if (b_adhika == true) { MainInfo.Add(new AppDayInfo(GCStrings.getString(22), string.Format("{0} {1}", GCMasa.GetName(d.Masa), GCStrings.getString(21)))); } else { MainInfo.Add(new AppDayInfo(GCStrings.getString(22), GCMasa.GetName(d.Masa))); } MainInfo.Add(new AppDayInfo(GCStrings.getString(23), d.GaurabdaYear.ToString())); if (GCDisplaySettings.Current.getValue(48) == 1) { MainInfo.Add(new AppDayBase(GCDS.APP_CHILDNAMES)); MainInfo.Add(new AppDaySeparator(GCStrings.getString(17))); MainInfo.Add(new AppDayBase(GCDS.APP_CHILDNAMES)); MainInfo.Add(new AppDayInfo(GCDS.APP_CHILDNAMES, GCStrings.getString(18), GCStrings.GetNaksatraChildSylable(d.sunRise.Naksatra, d.sunRise.NaksatraPada) + "...")); MainInfo.Add(new AppDayInfo(GCDS.APP_CHILDNAMES, GCStrings.getString(19), GCStrings.GetRasiChildSylable(d.sunRise.RasiOfMoon) + "...")); } MainInfo.Add(new AppDayBase()); MainInfo.Add(new AppDaySeparator(GCStrings.getString(24))); MainInfo.Add(new AppDayBase()); celeb_date = new GregorianDateTime[TRESULT_APP_CELEBS]; celeb_gy = new int[TRESULT_APP_CELEBS]; for (int i = 0; i < TRESULT_APP_CELEBS + 3; i++) { GCCalendar.VATIMEtoVCTIME(va, out vctemp, m_earth); if (va.gyear > d.GaurabdaYear) { if (m < TRESULT_APP_CELEBS) { MainInfo.Add(new AppDayInfo(string.Format("Gaurabda {0}", va.gyear), vctemp.ToString())); this.celeb_date[m] = new GregorianDateTime(vctemp); this.celeb_gy[m] = va.gyear; m++; } } va.gyear++; } }
public override void updateListBoxEntry(GCListBoxEntry lb) { base.updateListBoxEntry(lb); lb.Subtitle = string.Format("{0} Sankranti, {1} days offset", GCRasi.GetName(RasiOfSun), DayOffset); }
public static void Export(string pszFile, int format) { String strc; using (StreamWriter f = new StreamWriter(pszFile)) { foreach (GCFestivalBook book in GCFestivalBookCollection.Books) { switch (format) { case 1: foreach (GCFestivalBase fb in book.Festivals) { if (fb is GCFestivalTithiMasa) { GCFestivalTithiMasa pce = fb as GCFestivalTithiMasa; strc = string.Format("{0}\n\t{1} Tithi,{2} Paksa,{3} Masa\n", pce.Text, GCTithi.GetName(pce.nTithi), GCPaksa.GetName(pce.nTithi / 15), GCMasa.GetName(pce.nMasa)); f.Write(strc); if (pce.FastID != 0) { strc = string.Format("\t{0}\n", GCStrings.GetFastingName(pce.FastID)); f.Write(strc); } } else if (fb is GCFestivalSankranti) { GCFestivalSankranti se = fb as GCFestivalSankranti; f.Write(string.Format("{0}\n\t\t{1} Sankranti, {2}\n", se.Text, GCRasi.GetName(se.RasiOfSun), se.DayOffset)); } } break; case 2: { f.Write("<xml>\n"); foreach (GCFestivalBase fb in book.Festivals) { f.Write("\t<event>\n"); if (fb is GCFestivalTithiMasa) { GCFestivalTithiMasa pce = fb as GCFestivalTithiMasa; strc = string.Format("\t\t<name>{0}</name>\n", pce.Text); f.Write(strc); strc = string.Format("\t\t<tithi>{0}</tithi>\n", GCTithi.GetName(pce.nTithi)); f.Write(strc); strc = string.Format("\t\t<paksa>{0}</paksa>\n", GCPaksa.GetName(pce.nTithi / 15)); f.Write(strc); strc = string.Format("\t\t<masa>{0}</masa>\n", GCMasa.GetName(pce.nMasa)); f.Write(strc); } else if (fb is GCFestivalSankranti) { GCFestivalSankranti se = fb as GCFestivalSankranti; f.Write("\t\t<name>" + se.Text + "</name>\n"); f.Write("\t\t<sankranti>" + GCRasi.GetName(se.RasiOfSun) + "</sankranti>\n"); f.Write("\t\t<rel>" + se.DayOffset + "</rel>\n"); } if (fb.EventsCount > 0) { foreach (GCFestivalBase fb2 in fb.Events) { if (fb2 is GCFestivalRelated) { GCFestivalRelated rel = fb2 as GCFestivalRelated; f.Write("\t\t<relatedEvent>\n"); f.Write("\t\t\t<name>" + rel.Text + "</name>\n"); f.Write("\t\t\t<offset>" + rel.DayOffset + "</offset>\n"); f.Write("\t\t</relatedEvent>\n"); } } } f.Write("\t</event>\n"); } f.Write("</xml>\n"); } break; case 3: GSScript script = new GSScript(); script.Add(new GSToken("book")); script.Add(new GSList(new GSToken("bookId"), new GSNumber(book.CollectionId))); script.Add(new GSList(new GSToken("bookName"), new GSString(book.CollectionName))); foreach (GCFestivalBase fb in book.Festivals) { script.Add(fb.ExecuteMessage("getScript")); } script.writeScript(f); break; default: break; } } } }
public override GSCore GetPropertyValue(string Token) { GSCore result = null; switch (Token) { case "tithi": result = new GSNumber() { IntegerValue = sunRise.Tithi }; break; case "tithiElapsed": result = new GSNumber() { DoubleValue = sunRise.TithiElapse }; break; case "tithiName": result = new GSString() { Value = GCTithi.GetName(sunRise.Tithi) }; break; case "naksatra": result = new GSNumber() { IntegerValue = sunRise.Naksatra }; break; case "naksatraElapsed": result = new GSNumber() { DoubleValue = sunRise.NaksatraElapse }; break; case "naksatraName": result = new GSString() { Value = GCNaksatra.GetName(sunRise.Naksatra) }; break; case "paksa": result = new GSNumber() { IntegerValue = sunRise.Paksa }; break; case "paksaName": result = new GSString() { Value = GCPaksa.GetName(sunRise.Paksa) }; break; case "paksaAbbr": result = new GSString() { Value = GCPaksa.GetAbbr(sunRise.Paksa).ToString() }; break; case "yoga": result = new GSNumber() { IntegerValue = sunRise.Yoga }; break; case "yogaName": result = new GSString() { Value = GCYoga.GetName(sunRise.Yoga) }; break; case "masa": result = new GSNumber() { IntegerValue = Masa }; break; case "masaName": result = new GSString() { Value = GCMasa.GetName(Masa) }; break; case "masaNameVedic": result = new GSString() { Value = GCMasa.GetNameEx(Masa, 2) }; break; case "masaNameGaudiya": result = new GSString() { Value = GCMasa.GetNameEx(Masa, 0) }; break; case "gaurabdaYear": result = new GSNumber() { IntegerValue = GaurabdaYear }; break; case "arunodayaTime": result = new GCHourTimeObject(sunArunodaya); break; case "arunodayaTithi": result = new GSString(GCTithi.GetName(sunArunodaya.Tithi)); break; case "sunRiseTime": result = new GCHourTimeObject(sunRise); break; case "noonTime": result = new GCHourTimeObject(sunNoon); break; case "sunSetTime": result = new GCHourTimeObject(sunSet); break; case "moonRasi": result = new GSNumber(sunRise.RasiOfMoon); break; case "moonRasiName": result = new GSString(GCRasi.GetName(sunRise.RasiOfMoon)); break; case "sunRasi": result = new GSNumber(sunRise.RasiOfSun); break; case "sunRasiName": result = new GSString(GCRasi.GetName(sunRise.RasiOfSun)); break; case "sunLongitude": result = new GSNumber(sunRise.longitude); break; default: result = base.GetPropertyValue(Token); break; } return(result); }