Beispiel #1
0
        public string ShortSandhyaString()
        {
            GCHourTime start, end;

            start = new GCHourTime(this, -96);
            end   = new GCHourTime(this, -48);

            return(string.Format("{0}-{1}", start.ToShortTimeString(), end.ToShortTimeString()));
        }
Beispiel #2
0
        public string ShortMuhurtaString(int nMuhurta)
        {
            GCHourTime start, end;

            start = new GCHourTime(this, nMuhurta * 48);
            end   = new GCHourTime(this, nMuhurta * 48 + 48);

            return(string.Format("{0}-{1}", start.ToShortTimeString(), end.ToShortTimeString()));
        }
Beispiel #3
0
        public override GSCore GetPropertyValue(string s)
        {
            switch (s)
            {
            case "shortTime":
                return(new GSString(Value.ToShortTimeString()));

            case "longTime":
                return(new GSString(Value.ToLongTimeString()));

            case "standardTimeString":
                return(new GSString(String.Format("{0:00}{1:00}{2:00}", Value.hour, Value.min, Value.sec)));

            default:
                break;
            }
            return(base.GetPropertyValue(s));
        }
Beispiel #4
0
        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));
            }
        }