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 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 GCConfigRatedEvents() { int i; for (i = 0; i < 30; i++) { rateTithi[i] = new GCConfigRatedEntry(); rateTithi[i].Title = string.Format("{0} Tithi", GCTithi.GetName(i)); rateTithi[i].Key = "Tithi"; rateMuhurta[i] = new GCConfigRatedEntry(); rateMuhurta[i].Title = GCStrings.GetMuhurtaName(i); rateMuhurta[i].Key = "Muhurta"; } for (i = 0; i < 4; i++) { rateDayHours[i] = new GCConfigRatedEntry(); rateDayHours[i].Title = GCStrings.GetSandhyaName(i); rateDayHours[i].Key = "DayHours"; } for (i = 0; i < 2; i++) { rateDay[i] = new GCConfigRatedEntry(); rateDay[i].Title = GCStrings.GetSandhyaName(i * 2); rateDay[i].Key = "DayPart"; rateMoonTime[i] = new GCConfigRatedEntry(); rateMoonTime[i].Title = GCStrings.GetMoonTimesName(i); rateMoonTime[i].Key = "MoonTimes"; } rateKalas[0] = new GCConfigRatedEntry(); for (i = 1; i < 6; i++) { rateKalas[i] = new GCConfigRatedEntry(); rateKalas[i].Title = GCStrings.GetKalaName(i); rateKalas[i].Key = string.Format("kala.{0}", i); } for (i = 0; i < 27; i++) { rateNaksatra[i] = new GCConfigRatedEntry(); rateNaksatra[i].Title = string.Format("{0} Naksatra", GCNaksatra.GetName(i)); rateNaksatra[i].Key = "Naksatra"; rateYoga[i] = new GCConfigRatedEntry(); rateYoga[i].Title = string.Format("{0} Yoga", GCYoga.GetName(i)); rateYoga[i].Key = "Yoga"; for (int j = 0; j < 4; j++) { rateNaksatraPada[i, j] = new GCConfigRatedEntry(); rateNaksatraPada[i, j].Title = string.Format("{0} of {1}", GCNaksatra.GetPadaText(j), rateNaksatra[i].Title); rateNaksatraPada[i, j].Key = "NaksatraPada"; } } for (i = 0; i < 7; i++) { weekday[i] = new GCConfigRatedEntry(); weekday[i].Title = string.Format("Weekday: {0}", GCCalendar.GetWeekdayName(i)); weekday[i].Key = "Weekday"; } for (i = 0; i < 10; i++) { for (int j = 0; j < 12; j++) { rateGrahaRasi[i, j] = new GCConfigRatedEntry(); rateGrahaRasi[i, j].Title = string.Format("{0} in {1}", GCStrings.GetPlanetNameEn(i), GCRasi.GetNameEn(j)); rateGrahaRasi[i, j].Key = "RasiGraha." + GCStrings.GetPlanetNameEn(i); rateGrahaHouse[i, j] = new GCConfigRatedEntry(); rateGrahaHouse[i, j].Title = string.Format("{0} in house {1}", GCStrings.GetPlanetNameEn(i), j + 1); rateGrahaHouse[i, j].Key = "HouseGraha." + GCStrings.GetPlanetNameEn(i); rateRasiGraha[j, i] = rateGrahaRasi[i, j]; rateHouseGraha[j, i] = rateGrahaHouse[i, j]; } } FileName = null; }