Exemple #1
0
        public static int AvcGetOldCalendarDayText(GPCalendarDay pvd, StringBuilder dayText, GPCalendarDay prevd, GPCalendarDay nextd)
        {
            String str = string.Empty, str2, str3;

            dayText.Remove(0, dayText.Length);
            str  = GetTextA(pvd);
            str2 = str.Substring(16);
            str3 = str.Substring(0, 16);
            str  = str3;
            if (pvd.astrodata.sun.eclipticalLongitude < 0.0)
            {
                AddListText(dayText, str, getSharedStringPlain(974));
                return(1);
            }
            AddListText(dayText, str, str2);

            foreach (GPCalendarDay.Festival fest in pvd.CompleteFestivalList(prevd, nextd))
            {
                if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true))
                {
                    if (fest.ShowSettingItem == GPDisplays.Keys.CalendarSankranti)
                    {
                        dayText.AppendLine(GPAppHelper.CenterString(fest.Text, 80, '-'));
                    }
                    else
                    {
                        AddListText(dayText, fest.Text);
                    }
                }
            }



            return(0);
        }
Exemple #2
0
        public static void AddNoteRtf(StringBuilder str)
        {
            str.AppendLine("\\par\\par{\\fs16\\cf10");
            str.Append(gpszSeparator);
            str.Append("\\par {\\b ");
            str.Append(getSharedStringRtf(978));
            str.Append("}");
            str.AppendLine("\\par\\pard");
            str.AppendLine();
            str.Append("\\tab ");
            str.Append(getSharedStringRtf(979));
            str.AppendLine("\\par");
            str.Append("\\tab ");
            str.Append(getSharedStringRtf(980));
            str.AppendLine("\\par");

            if (GPDisplays.Calendar.JulianDayVisible() ||
                GPDisplays.Calendar.AyanamsaValueVisible() ||
                GPDisplays.Calendar.SunLongitudeVisible() ||
                GPDisplays.Calendar.MoonLongitudeVisible())
            {
                str.Append("\\tab ");
                str.Append(getSharedStringRtf(981));
                str.AppendLine("\\par");
            }

            // last line
            str.AppendLine("\\par");
            str.Append("\\tab ");
            str.AppendFormat("{0} {1}", getSharedStringRtf(982), GPAppHelper.getShortVersionText());
            str.AppendLine("}");
        }
Exemple #3
0
        public static int FormatMasaListText(GPMasaListResults mlist, StringBuilder str)
        {
            string stt;

            str.Remove(0, str.Length);
            str.AppendLine(GPAppHelper.CenterString(getSharedStringPlain(39), 60));
            str.AppendLine();
            str.AppendLine();
            str.AppendLine(GPAppHelper.CenterString(mlist.m_location.getLocation(0).getFullName(), 60));
            str.AppendFormat(getSharedStringPlain(41), mlist.vc_start, mlist.vc_end);
            str.AppendLine();
            str.AppendLine(string.Empty.PadRight(60, '='));
            str.AppendLine();

            int i;

            for (i = 0; i < mlist.n_countMasa; i++)
            {
                stt = string.Format("{0} {1}", GPMasa.GetName(mlist.arr[i].masa), mlist.arr[i].year);
                str.Append(stt.PadRight(30));
                stt = string.Format("{0} - ", mlist.arr[i].vc_start);
                str.Append(stt.PadLeft(16));
                stt = string.Format("{0}", mlist.arr[i].vc_end);
                str.Append(stt.PadLeft(13));
                str.AppendLine();
            }

            return(1);
        }
Exemple #4
0
 public static GPAppHelper getShared()
 {
     if (sharedObject == null)
     {
         sharedObject = new GPAppHelper();
     }
     return(sharedObject);
 }
Exemple #5
0
        public string getLongDateString()
        {
            bool     dst;
            DateTime dt;

            getLocalTimeEx(out dt, out dst);
            return(string.Format("{0} {1} {2}", dt.Day, GPAppHelper.getMonthAbr(dt.Month), dt.Year));
        }
Exemple #6
0
        public string getCompleteLongDateString()
        {
            bool     dst;
            DateTime dt;

            getLocalTimeEx(out dt, out dst);
            return(string.Format("{0} {1} {2} ({3})", dt.Day, GPAppHelper.getMonthAbr(dt.Month), dt.Year, getDayOfWeekName(dt.DayOfWeek)));
        }
Exemple #7
0
        public string getEkadasiParanaString()
        {
            string str;
            string dstIndicator  = string.Empty;
            string dstIndicator2 = string.Empty;
            string shortTime     = "";

            if (ekadasiParanaEnd != null)
            {
                if (GPDisplays.Calendar.EkadasiParanaDetails())
                {
                    shortTime = ekadasiParanaStart.getShortTimeString(false, ref dstIndicator);
                    str       = string.Format("{0} {1} ({2}) - {3} ({4})", GPStrings.getString(60),
                                              shortTime, GPAppHelper.GetParanaReasonText(EkadasiParanaReasonStart),
                                              ekadasiParanaEnd.getShortTimeString(false, ref dstIndicator2), GPAppHelper.GetParanaReasonText(EkadasiParanaReasonEnd));
                }
                else
                {
                    shortTime = ekadasiParanaStart.getShortTimeString(false, ref dstIndicator);
                    str       = string.Format("{0} {1} - {2}", GPStrings.getString(60),
                                              shortTime, ekadasiParanaEnd.getShortTimeString(false, ref dstIndicator2));
                }
                if (!String.IsNullOrEmpty(dstIndicator))
                {
                    str += " " + dstIndicator;
                }
            }
            else if (ekadasiParanaStart != null)
            {
                if (GPDisplays.Calendar.EkadasiParanaDetails())
                {
                    str = string.Format("{0} {1} ({2})", GPStrings.getString(61),
                                        ekadasiParanaStart.getShortTimeString(), GPAppHelper.GetParanaReasonText(EkadasiParanaReasonStart));
                }
                else
                {
                    str = string.Format("{0} {1}", GPStrings.getString(61),
                                        ekadasiParanaStart.getShortTimeString());
                }
            }
            else
            {
                str = GPStrings.getString(62);
            }

            return(str);
        }
Exemple #8
0
        public string getShortTimeString(bool showDstIndicator, ref string dstIndicator)
        {
            bool     dst;
            DateTime dt;

            getLocalTimeEx(out dt, out dst);
            if (dt.Second >= 30)
            {
                dt = dt.AddMinutes(1);
            }
            int h = dt.Hour;
            int m = dt.Minute;

            if (dstIndicator != null && getLocation().getTimeZone().isSupportDaylightSaving())
            {
                dstIndicator = GPAppHelper.GetDSTSignature(dst ? 1 : 0);
            }

            if (getLocation().getTimeZone().isSupportDaylightSaving() && showDstIndicator)
            {
                if (timeFormat24)
                {
                    return(string.Format("{0:00}:{1:00} ({2})", h, m, GPAppHelper.GetDSTSignature(dst ? 1 : 0)));
                }
                else
                {
                    return(string.Format("{0:00}:{1:00} {2} ({3})", (((h % 12) + 11) % 12 + 1), m, (h >= 12 ? "PM" : "AM"), GPAppHelper.GetDSTSignature(dst ? 1 : 0)));
                }
            }
            else
            {
                if (timeFormat24)
                {
                    return(string.Format("{0:00}:{1:00}", h, m));
                }
                else
                {
                    return(string.Format("{0:00}:{1:00} {2}", (((h % 12) + 11) % 12 + 1), m, (h >= 12 ? "PM" : "AM")));
                }
            }
        }
Exemple #9
0
        public static void AddNoteText(StringBuilder builder)
        {
            builder.AppendLine();
            builder.AppendLine();
            builder.Append(gpszSeparator);
            builder.AppendLine();
            builder.AppendLine(getSharedStringPlain(978));
            builder.AppendLine();
            builder.AppendLine();
            builder.AppendLine(getSharedStringPlain(979));
            builder.AppendLine(getSharedStringPlain(980));

            if (GPDisplays.Calendar.JulianDayVisible() || GPDisplays.Calendar.AyanamsaValueVisible() || GPDisplays.Calendar.SunLongitudeVisible() || GPDisplays.Calendar.MoonLongitudeVisible())
            {
                builder.AppendLine(getSharedStringPlain(981));
            }

            // last line
            builder.AppendLine();
            builder.AppendFormat("{0} {1}", getSharedStringPlain(982), GPAppHelper.getLongVersionText());
            //builder.Append(GPAppHelper.getShortVersionText());
        }
Exemple #10
0
        public static int CalcEndDate(GPLocationProvider m_earth, GPGregorianTime vcStart, GPVedicTime vaStart, out GPGregorianTime vcEnd, out GPVedicTime vaEnd, int nType, int nCount)
        {
            vcEnd = new GPGregorianTime(vcStart);
            vaEnd = new GPVedicTime(vaStart);
            switch (nType)
            {
            case 1:
                //vcEnd = vcStart;
                if (nCount > 30240)
                {
                    nCount = 30240;
                }
                vcEnd.AddDays(nCount);
                VCTIMEtoVATIME(vcEnd, out vaEnd, m_earth);
                break;

            case 2:
                //vcEnd = vcStart;
                if (nCount > 4320)
                {
                    nCount = 4320;
                }
                vcEnd.AddDays(nCount * 7);
                VCTIMEtoVATIME(vcEnd, out vaEnd, m_earth);
                break;

            case 3:
                //vcEnd = vcStart;
                if (nCount > 1080)
                {
                    nCount = 1080;
                }
                vcEnd.AddMonths(nCount);
                VCTIMEtoVATIME(vcEnd, out vaEnd, m_earth);
                break;

            case 4:
                //vcEnd = vcStart;
                if (nCount > 90)
                {
                    nCount = 90;
                }
                vcEnd.AddYears(nCount);
                VCTIMEtoVATIME(vcEnd, out vaEnd, m_earth);
                break;

            case 5:
                //vaEnd = vaStart;
                if (nCount > 30240)
                {
                    nCount = 30240;
                }
                vaEnd.tithi += nCount;
                while (vaEnd.tithi >= 30)
                {
                    vaEnd.tithi -= 30;
                    vaEnd.masa++;
                }
                while (vaEnd.masa >= 12)
                {
                    vaEnd.masa -= 12;
                    vaEnd.gyear++;
                }
                VATIMEtoVCTIME(vaEnd, out vcEnd, m_earth);
                break;

            case 6:
                //vaEnd = vaStart;
                if (nCount > 1080)
                {
                    nCount = 1080;
                }
                vaEnd.masa = GPAppHelper.MasaToComboMasa(vaEnd.masa);
                if (vaEnd.masa == GPMasa.ADHIKA_MASA)
                {
                    vcEnd = new GPGregorianTime(vcStart);
                    vcEnd.AddMonths(nCount);
                    VCTIMEtoVATIME(vcEnd, out vaEnd, m_earth);
                    vaEnd.tithi = vaStart.tithi;
                    VATIMEtoVCTIME(vaEnd, out vcEnd, m_earth);
                }
                else
                {
                    vaEnd.masa += nCount;
                    while (vaEnd.masa >= 12)
                    {
                        vaEnd.masa -= 12;
                        vaEnd.gyear++;
                    }
                    vaEnd.masa = GPAppHelper.ComboMasaToMasa(vaEnd.masa);
                    VATIMEtoVCTIME(vaEnd, out vcEnd, m_earth);
                }
                break;

            case 7:
                //vaEnd = vaStart;
                if (nCount > 90)
                {
                    nCount = 90;
                }
                vaEnd.gyear += nCount;
                VATIMEtoVCTIME(vaEnd, out vcEnd, m_earth);
                break;
            }

            return(1);
        }
Exemple #11
0
        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++;
            }
        }
Exemple #12
0
        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);
        }
Exemple #13
0
        public static void FormatTodayInfoRtf(GPGregorianTime vc, GPLocationProvider loc, StringBuilder str)
        {
            string str2, str3 = string.Empty;

            GPCalendarResults db = new GPCalendarResults();

            GPGregorianTime vc2 = new GPGregorianTime(vc);

            vc2.PreviousDay();
            vc2.PreviousDay();
            vc2.PreviousDay();
            vc2.PreviousDay();
            db.CalculateCalendar(vc2, 9);

            int           i = db.FindDate(vc);
            GPCalendarDay p = db.get(i);

            if (p == null)
            {
                return;
            }

            str.Remove(0, str.Length);
            AppendRtfHeader(str);
            str2 = string.Format("\\f2\\fs{0} {1} ", g_HeaderSize, GPAppHelper.getDateText(vc));
            str.Append(str2);

            str.AppendFormat("\\par\\f2\\fs{0} {{\\fs{1} {2}}\\line {3} ({4}, {5}, {6}: {7})",
                             g_TextSize, g_TextSize + 4, getSharedStringRtf(p.date.getDayOfWeek()), loc.getFullName(), loc.getLocation(0).getLatitudeString(),
                             loc.getLocation(0).getLongitudeString(), getSharedStringRtf(12),
                             loc.getLocation(0).getTimeZoneName());
            str.AppendLine("\\par");
            str.AppendLine("\\par");
            str.AppendFormat("  {0}, {1}", p.getTithiName(), p.getPaksaName());
            str.AppendLine("\\par");
            str.AppendFormat("  {0}, {1}", p.getMasaLongName(), p.getGaurabdaYearLongString());
            str.AppendLine("\\par");
            str.AppendLine("\\par");


            // 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(fest.Text.PadLeft((80 + str2.Length) / 2, '-').PadRight(80, '-'));
                        str.AppendLine("\\par");
                    }
                    else
                    {
                        str.Append("\\tab");
                        str.Append(fest.Text);
                        str.AppendLine("\\par");
                    }
                }
            }

            str.AppendLine("\\par");


            if (GPDisplays.Today.BrahmaMuhurtaVisible())
            {
                str.AppendLine("\\par");
                str.AppendFormat("{0} {1}", getSharedStringRtf(988), p.astrodata.sun.arunodaya.getShortMuhurtaRange(0));
            }

            if (GPDisplays.Today.SunriseVisible())
            {
                str.AppendLine("\\par");
                str.AppendFormat("{0} {1} ", getSharedStringRtf(51), p.astrodata.sun.rise.getShortTimeString());
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.rise.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.NoonVisible())
            {
                str2 = string.Format("{0} {1} ", getSharedStringRtf(857), p.astrodata.sun.noon.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.noon.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.SunsetVisible())
            {
                str.AppendFormat("{0}  {1} ", getSharedStringRtf(52), p.astrodata.sun.set.getShortTimeString());
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.set.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.SunriseInfo())
            {
                str.AppendLine("\\par");
                str.Append(getSharedStringRtf(990));
                str.AppendLine("\\par");
                str.AppendFormat("   {1} {2}", GPNaksatra.getName(p.astrodata.nNaksatra), getSharedStringRtf(15));
                if (GPDisplays.Today.NaksatraPadaVisible())
                {
                    str.AppendFormat(", {0} {1} ({2})", p.astrodata.nNaksatraElapse, getSharedStringRtf(993), getSharedStringRtf(811 + p.getNaksatraPada()));
                }
                if (GPDisplays.Today.RasiOfMoonVisible())
                {
                    str.AppendFormat(", {0}: {1}", getSharedStringRtf(991), GPSankranti.getName(p.astrodata.nMoonRasi));
                }
                str.AppendFormat(", {0} {1}", GPYoga.getName(p.astrodata.nYoga), getSharedStringRtf(104));
                str.AppendLine("\\par");
                str.AppendFormat("  {0} {1}", getSharedStringRtf(992), GPSankranti.getName(p.astrodata.nSunRasi));
                str.AppendLine("\\par");
            }
            /* END GCAL 1.4.3 */

            AddNoteRtf(str);
        }
Exemple #14
0
        public static string GetTextRtf(GPCalendarDay pvd)
        {
            String str;

            str = string.Format("\\par {0} {1} {2} {3}\\tab {4}\\tab {5} ", pvd.date.getDay().ToString().PadLeft(2), GPAppHelper.getMonthAbr(pvd.date.getMonth()), pvd.date.getYear()
                                , pvd.getWeekdayAbbr(), pvd.getTithiNameExtended(), (GPDisplays.Calendar.PaksaInfoVisible() ? GPPaksa.getAbbreviation(pvd.astrodata.nPaksa) : " "));

            if (GPDisplays.Calendar.YogaVisible())
            {
                str += string.Format("\\tab {0}", GPYoga.getName(pvd.astrodata.nYoga));
            }

            if (GPDisplays.Calendar.NaksatraVisible())
            {
                str += string.Format("\\tab {0}", GPNaksatra.getName(pvd.astrodata.nNaksatra));
            }

            if (pvd.nFastType != GPConstants.FAST_NULL && GPDisplays.Calendar.FastingFlagVisible())
            {
                str += "\\tab *";
            }
            else if (GPDisplays.Calendar.FastingFlagVisible())
            {
                str += "\\tab ";
            }

            if (GPDisplays.Calendar.RasiVisible())
            {
                str += string.Format("\\tab {0}", GPSankranti.getName(pvd.astrodata.moon.GetRasi(pvd.astrodata.msAyanamsa)));
            }

            str += "\r\n";

            return(str);
        }
Exemple #15
0
        public static int FormatCalendarPlain(GPCalendarResults daybuff, StringBuilder m_text)
        {
            int           k, nMasaHeader;
            String        str;
            StringBuilder dayText = new StringBuilder();

            GPCalendarDay pvd, prevd, nextd;
            int           lastmasa  = -1;
            int           lastmonth = -1;
            int           tp1;
            bool          bCalcMoon = (getShowSettingsValue(4) > 0 || getShowSettingsValue(5) > 0);

            GPStrings.pushRich(false);

            m_text.Remove(0, m_text.Length);

            for (k = 0; k < daybuff.m_vcCount; k++)
            {
                prevd = daybuff.get(k - 1);
                pvd   = daybuff.get(k);
                nextd = daybuff.get(k + 1);

                if (pvd != null)
                {
                    nMasaHeader = 0;
                    if (GPDisplays.Calendar.MasaHeader() && (pvd.astrodata.nMasa != lastmasa))
                    {
                        nMasaHeader = 1;
                        m_text.AppendLine();
                        str = string.Format("{0}, {1}", pvd.getMasaLongName(), pvd.getGaurabdaYearLongString());
                        tp1 = (80 - str.Length) / 2;
                        m_text.Append(string.Empty.PadLeft(tp1));
                        m_text.Append(str);
                        m_text.Append(string.Empty.PadLeft(tp1 - GPAppHelper.getShortVersionText().Length));
                        m_text.AppendLine(GPAppHelper.getShortVersionText());
                        if ((pvd.astrodata.nMasa == GPMasa.ADHIKA_MASA) && ((lastmasa >= GPMasa.SRIDHARA_MASA) && (lastmasa <= GPMasa.DAMODARA_MASA)))
                        {
                            AddListText(m_text, getSharedStringPlain(128));
                        }
                        m_text.AppendLine();
                        m_text.AppendLine(GPAppHelper.CenterString(daybuff.CurrentLocation.getLocation(pvd.date.getJulianGreenwichTime()).getFullName(), 80));
                        m_text.AppendLine();
                        lastmasa = pvd.astrodata.nMasa;
                    }

                    if (GPDisplays.Calendar.MonthHeader() && (pvd.date.getMonth() != lastmonth))
                    {
                        nMasaHeader = 1;
                        m_text.AppendLine();
                        str = string.Format("{0} {1}", getSharedStringPlain(759 + pvd.date.getMonth()), pvd.date.getYear());
                        tp1 = (80 - str.Length) / 2;
                        m_text.Append(string.Empty.PadLeft(tp1));
                        m_text.Append(str);
                        string tmpString = GPAppHelper.getShortVersionText();
                        if (tmpString.Length < tp1)
                        {
                            m_text.Append(string.Empty.PadLeft(tp1 - tmpString.Length));
                        }
                        m_text.AppendLine(GPAppHelper.getShortVersionText());
                        m_text.AppendLine(GPAppHelper.CenterString(daybuff.CurrentLocation.getLocation(pvd.date.getJulianGreenwichTime()).getFullName(), 80));
                        m_text.AppendLine();
                        lastmonth = pvd.date.getMonth();
                    }

                    else if (pvd.Travelling != null)
                    {
                        m_text.AppendLine(GPAppHelper.CenterString(GPStrings.getString(1030), 80));
                        GPLocationChange lastLocChange = null;
                        foreach (GPLocationChange lc in pvd.Travelling)
                        {
                            if (lastLocChange != lc)
                            {
                                m_text.AppendLine(GPAppHelper.CenterString(String.Format("{0} -> {1}", lc.LocationA.getFullName(), lc.LocationB.getFullName()), 80));
                                lastLocChange = lc;
                            }
                        }
                        m_text.AppendLine();

                        nMasaHeader = 1;
                    }
                    else if (pvd.FlagNewLocation)
                    {
                        m_text.AppendLine(GPAppHelper.CenterString(GPStrings.getString(9), 80));
                        m_text.AppendLine(GPAppHelper.CenterString(daybuff.CurrentLocation.getLocation(pvd.date.getJulianGreenwichTime()).getFullName(), 80));
                        m_text.AppendLine();

                        nMasaHeader = 1;
                    }

                    if (nMasaHeader == 1)
                    {
                        nMasaHeader = m_text.Length;
                        m_text.Append(" ");
                        m_text.Append(getSharedStringPlain(985).ToUpper().PadRight(16));
                        m_text.Append(getSharedStringPlain(986).ToUpper().PadRight(30));
                        if (GPDisplays.Calendar.PaksaInfoVisible())
                        {
                            m_text.Append(getSharedStringPlain(20).ToUpper().PadRight(6));
                        }
                        else
                        {
                            m_text.Append(string.Empty.PadRight(6));
                        }
                        if (GPDisplays.Calendar.YogaVisible())
                        {
                            m_text.Append(getSharedStringPlain(104).ToUpper().PadRight(10));
                        }
                        if (GPDisplays.Calendar.NaksatraVisible())
                        {
                            m_text.Append(getSharedStringPlain(15).ToUpper().PadRight(15));
                        }
                        if (GPDisplays.Calendar.FastingFlagVisible())
                        {
                            m_text.Append(getSharedStringPlain(987).ToUpper().PadRight(5));
                        }
                        if (GPDisplays.Calendar.RasiVisible())
                        {
                            m_text.Append(getSharedStringPlain(105).ToUpper().PadRight(15));
                        }
                        nMasaHeader = m_text.Length - nMasaHeader;
                        m_text.AppendLine();
                        m_text.AppendLine(string.Empty.PadRight(nMasaHeader, '-'));
                    }

                    AvcGetOldCalendarDayText(pvd, dayText, prevd, nextd);

                    if (!GPDisplays.Calendar.HideEmptyDays() || dayText.Length > 90)
                    {
                        m_text.Append(dayText);
                    }
                }
            }

            AddNoteText(m_text);

            GPStrings.popRich();
            return(1);
        }
Exemple #16
0
        public static string GetTextA(GPCalendarDay pvd)
        {
            string str;
            String s1, s2;

            s1 = pvd.getTithiNameExtended();

            s2  = GPStrings.getString(150 + pvd.date.getDayOfWeek());
            str = string.Format("{0} {1} {2} {3}  {4}{5} ", pvd.date.getDay().ToString().PadLeft(2), GPAppHelper.getMonthAbr(pvd.date.getMonth()), pvd.date.getYear()
                                , s2, s1.PadRight(34), (GPDisplays.Calendar.PaksaInfoVisible() ? GPPaksa.getAbbreviation(pvd.astrodata.nPaksa) : " "));

            if (GPDisplays.Calendar.YogaVisible())
            {
                str += GPYoga.getName(pvd.astrodata.nYoga).PadRight(10);
            }

            if (GPDisplays.Calendar.NaksatraVisible())
            {
                str += GPNaksatra.getName(pvd.astrodata.nNaksatra).PadRight(15);
            }

            if (pvd.nFastType != GPConstants.FAST_NULL && GPDisplays.Calendar.FastingFlagVisible())
            {
                str += " *";
            }
            else
            {
                str += "  ";
            }

            if (GPDisplays.Calendar.RasiVisible())
            {
                str += "   ";
                str += pvd.getRasiOfMoonName().PadRight(15);
            }

            return(str);
        }
Exemple #17
0
 public string FormatTimeRange(int h1, int m1, int h2, int m2, bool dst)
 {
     if (timeFormat24)
     {
         if (getLocation().getTimeZone().isSupportDaylightSaving())
         {
             return(string.Format("{0:00}:{1:00} - {2:00}:{3:00} ({4})", h1, m1, h2, m2, GPAppHelper.GetDSTSignature(dst ? 1 : 0)));
         }
         else
         {
             return(string.Format("{0:00}:{1:00} - {2:00}:{3:00}", h1, m1, h2, m2));
         }
     }
     else
     {
         if (getLocation().getTimeZone().isSupportDaylightSaving())
         {
             return(string.Format("{0:00}:{1:00} {2} - {3:00}:{4:00} {5} ({6})", (((h1 % 12) + 11) % 12 + 1), m1, (h1 > 12), (((h2 % 12) + 11) % 12 + 1), m2, GPAppHelper.GetDSTSignature(dst ? 1 : 0)));
         }
         else
         {
             return(string.Format("{0:00}:{1:00} {2} - {3:00}:{4:00} {5}", (((h1 % 12) + 11) % 12 + 1), m1, (((h2 % 12) + 11) % 12 + 1), m2));
         }
     }
 }
Exemple #18
0
        public string getLongTimeString()
        {
            bool     dst;
            DateTime dt;

            getLocalTimeEx(out dt, out dst);
            if (getLocation().getTimeZone().isSupportDaylightSaving())
            {
                if (timeFormat24)
                {
                    return(string.Format("{0:00}:{1:00}:{2:00} ({3})", dt.Hour, dt.Minute, dt.Second, GPAppHelper.GetDSTSignature(dst ? 1 : 0)));
                }
                else
                {
                    return(string.Format("{0:00}:{1:00}:{2:00} {3} ({4})", (((dt.Hour % 12) + 11) % 12 + 1), dt.Minute, dt.Second, (dt.Hour >= 12 ? "PM" : "AM"), GPAppHelper.GetDSTSignature(dst ? 1 : 0)));
                }
            }
            else
            {
                if (timeFormat24)
                {
                    return(string.Format("{0:00}:{1:00}:{2:00}", dt.Hour, dt.Minute, dt.Second));
                }
                else
                {
                    return(string.Format("{0:00}:{1:00}:{2:00} {3}", (((dt.Hour % 12) + 11) % 12 + 1), dt.Minute, dt.Second, (dt.Hour >= 12 ? "PM" : "AM")));
                }
            }
        }
Exemple #19
0
        public static int FormatEventsRtf(GPCoreEventResults inEvents, StringBuilder res)
        {
            int i;

            AppendRtfHeader(res);

            res.AppendFormat("{\\fs{0}\\f2 ", g_Header2Size, g_TextSize);
            res.AppendFormat(getSharedStringRtf(983), inEvents.m_vcStart, inEvents.m_vcEnd);
            res.AppendLine("} \\par");
            List <GPLocation> locList = inEvents.getLocationList();

            foreach (GPLocation loc in locList)
            {
                res.Append(loc.getFullName());
                res.AppendLine("\\par");
            }
            res.AppendLine();

            //res.AppendFormat(inEvents.m_location.getFullName());
            //res.AppendLine("\\par");
            res.AppendLine("\\par");

            DateTime prevd = new DateTime(1970, 1, 1);
            int      prevt = -1;

            for (i = 0; i < inEvents.getCount(); i++)
            {
                GPCoreEvent dnr = inEvents.get(i);

                if (inEvents.b_sorted)
                {
                    DateTime dt = dnr.Time.getLocalTime();
                    if (prevd.Day != dt.Day || prevd.Month != dt.Month || prevd.Year != dt.Year)
                    {
                        res.AppendLine("\\par");
                        res.Append(GPAppHelper.CenterString(dnr.Time.getCompleteLongDateString(), 60, '-'));
                        res.AppendLine("\\par");
                        res.AppendLine("\\par");
                    }
                    prevd = dt;
                }
                else
                {
                    if (prevt != dnr.nType)
                    {
                        string s = " " + dnr.getTypeTitle() + " ";
                        res.AppendLine("\\par");
                        res.Append(GPAppHelper.CenterString(s, 60, '-'));
                        res.AppendLine("\\par");
                        res.AppendLine("\\par");
                    }
                    prevt = dnr.nType;
                }

                if (!inEvents.b_sorted)
                {
                    res.Append(dnr.Time.ToString().PadLeft(20));
                }

                GPLocation loc = dnr.Time.getLocation();
                res.AppendFormat("  {0}  {1} {2} {3} {4}", dnr.Time.getLongTimeString(), dnr.getEventTitle().PadRight(45),
                                 loc.getTimeZoneName().PadRight(32), loc.getLongitudeString().PadLeft(6), loc.getLatitudeString().PadLeft(6));
                res.AppendLine("\\par");
            }

            res.AppendLine("\\par");

            AddNoteRtf(res);

            res.AppendLine("}");


            return(1);
        }
Exemple #20
0
        public static int FormatCalendarPlusCorePlain(GPCalendarPlusEventsResults calev, StringBuilder fout)
        {
            GPCalendarResults  daybuff = calev.theCalendar;
            GPCoreEventResults events  = calev.theEvents;

            //List<string> gstr = GPStrings.getSharedStrings().gstr;
            int             k;
            string          str;
            GPGregorianTime date = new GPGregorianTime(daybuff.CurrentLocation);
            GPCalendarDay   pvd;
            GPCalendarDay   prevd;
            GPCalendarDay   nextd;
            int             nPrevMasa  = -1;
            int             nPrevMonth = -1;

            if (events.b_sorted == false)
            {
                events.Sort(true);
            }

            StringBuilder lineA = new StringBuilder();
            StringBuilder lineB = new StringBuilder();


            for (k = 0; k < daybuff.getCount(); k++)
            {
                prevd = daybuff.get(k - 1);
                pvd   = daybuff.get(k);
                nextd = daybuff.get(k + 1);

                if (pvd != null)
                {
                    bool writeHeaders = false;

                    if (nPrevMasa != pvd.astrodata.nMasa && GPDisplays.Calendar.MasaHeader())
                    {
                        str = string.Format("{0} {1}", pvd.getMasaLongName(), ((nPrevMasa == GPMasa.ADHIKA_MASA) ?  GPStrings.getString(109) : ""));
                        fout.AppendLine(GPAppHelper.CenterString(str, 80));
                        fout.AppendLine(GPAppHelper.CenterString(pvd.getGaurabdaYearLongString(), 80));
                        fout.AppendLine(GPAppHelper.CenterString(pvd.date.getLocation().getFullName(), 80));
                        fout.AppendLine(GPAppHelper.CenterString(string.Format("{0}: {1}", GPStrings.getString(12), pvd.date.getLocation().getTimeZone().getFullName()), 80));
                        fout.AppendLine();

                        nPrevMasa    = pvd.astrodata.nMasa;
                        writeHeaders = true;
                    }
                    else if (nPrevMonth != pvd.date.getMonth() && GPDisplays.Calendar.MonthHeader())
                    {
                        fout.AppendLine(GPAppHelper.CenterString(string.Format("{0} {1}", GPStrings.getString(759 + pvd.date.getMonth()), pvd.date.getYear()), 80));
                        fout.AppendLine(GPAppHelper.CenterString(pvd.date.getLocation().getFullName(), 80));
                        fout.AppendLine(GPAppHelper.CenterString(string.Format("{0}: {1}", GPStrings.getString(12), pvd.date.getLocation().getTimeZone().getFullName()), 80));
                        fout.AppendLine();

                        nPrevMonth   = pvd.date.getMonth();
                        writeHeaders = true;
                    }


                    if (writeHeaders)
                    {
                        int len = fout.Length;

                        fout.Append(" ");
                        fout.Append(GPStrings.getString(985).PadRight(16));
                        fout.Append(GPStrings.getString(986).ToUpper().PadRight(30));
                        if (GPDisplays.Calendar.PaksaInfoVisible())
                        {
                            fout.Append(GPStrings.getString(20).ToUpper().PadRight(6));
                        }
                        else
                        {
                            fout.Append(string.Empty.PadRight(6));
                        }
                        if (GPDisplays.Calendar.YogaVisible())
                        {
                            fout.Append(GPStrings.getString(104).ToUpper().PadRight(10));
                        }
                        if (GPDisplays.Calendar.NaksatraVisible())
                        {
                            fout.Append(GPStrings.getString(15).ToUpper().PadRight(15));
                        }
                        if (GPDisplays.Calendar.FastingFlagVisible())
                        {
                            fout.Append(GPStrings.getString(987).ToUpper().PadRight(5));
                        }
                        if (GPDisplays.Calendar.RasiVisible())
                        {
                            fout.Append(GPStrings.getString(105).ToUpper().PadRight(15));
                        }

                        fout.AppendLine();
                        len = fout.Length - len;
                        fout.AppendLine(string.Empty.PadLeft(len, '-'));
                    }

                    AvcGetOldCalendarDayText(pvd, fout, prevd, nextd);

                    fout.AppendLine();
                    lineA.Remove(0, lineA.Length);
                    lineB.Remove(0, lineB.Length);
                    List <GPStringPair> recs = events.ExtractRecordsForDate(pvd.date);
                    foreach (GPStringPair rec in recs)
                    {
                        lineA.Append(rec.Name);
                        lineB.Append(rec.Value);
                        int tosize = Math.Max(lineA.Length, lineB.Length) + 2;
                        while (lineA.Length < tosize)
                        {
                            lineA.Append(' ');
                        }
                        while (lineB.Length < tosize)
                        {
                            lineB.Append(' ');
                        }
                    }
                    fout.Append(string.Empty.PadLeft(17, ' '));
                    fout.AppendLine(lineA.ToString());
                    fout.Append(string.Empty.PadLeft(17, ' '));
                    fout.AppendLine(lineB.ToString());
                    fout.AppendLine();
                }
                date.setDayHours(0.0);
                date.NextDay();
            }

            return(1);
        }
Exemple #21
0
 public string getFullName()
 {
     return(string.Format("{0} {1}", GPAppHelper.GetTextTimeZone(OffsetSeconds), Name));
 }
Exemple #22
0
 public string getTimeZoneString()
 {
     return(string.Format("{0} {1}", GPAppHelper.GetTextTimeZone(getTimeZone().OffsetSeconds), getTimeZoneName()));
 }