public override GSCore GetPropertyValue(string Token) { if (Token.Equals("date")) { return(date); } else if (Token.Equals("astro")) { return(astrodata); } else if (Token.Equals("dateHumanName")) { return(new GSString(GregorianDateTime.GetDateTextWithTodayExt(date))); } else if (Token.Equals("nDST")) { return(new GSNumber(BiasMinutes)); } else if (Token.Equals("events")) { GSList list = new GSList(); list.Parts.AddRange(dayEvents); return(list); } else if (Token.Equals("visibleEvents")) { GSList list = new GSList(); list.Parts.AddRange(VisibleEvents); return(list); } else if (Token.Equals("htmlDayColor")) { return(new GSString(TResultCalendar.getDayBkgColorCode(this))); } else if (Token.Equals("dstSignature")) { return(new GSString(GCStrings.GetDSTSignature(BiasMinutes))); } else if (Token.Equals("tithiNameExt")) { return(new GSString(GetFullTithiName())); } else if (Token.Equals("isWeekend")) { return(new GSBoolean(date.dayOfWeek == 6 || date.dayOfWeek == 0)); } else if (Token.Equals("fastType")) { return(new GSNumber(nFastID)); } else if (Token.Equals("fastTypeMark")) { return(new GSString(nFastID != 0 ? "*" : " ")); } else if (Token.Equals("ekadasiParana")) { return(new GSBoolean(ekadasi_parana)); } else if (Token.Equals("ekadasiParanaStart")) { return(GetGregorianDateTime(eparana_time1)); } else if (Token.Equals("ekadasiParanaEnd")) { return(GetGregorianDateTime(eparana_time2)); } else if (Token.Equals("hasParanaStart")) { return(new GSBoolean(eparana_time1 != null)); } else if (Token.Equals("hasParanaEnd")) { return(new GSBoolean(eparana_time2 != null)); } else if (Token.Equals("sankrantiZodiac")) { return(new GSNumber(sankranti_zodiac)); } else if (Token.Equals("sankrantiDateTime")) { return(sankranti_day); } else if (Token.Equals("ksayaTithi")) { return(new GSNumber(ksayaTithi)); } else if (Token.Equals("ksayaMasa")) { return(new GSNumber(ksayaMasa)); } else { return(base.GetPropertyValue(Token)); } }
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)); } }