public static void Report(GPLocationProvider loc, string prefix) { GPGregorianTime start = new GPGregorianTime(loc); GPGregorianTime end = new GPGregorianTime(loc); start.setDate(2010, 1, 1); end.setDate(2015, 1, 1); GPCalendarResults calendar = new GPCalendarResults(); calendar.CalculateCalendar(start, Convert.ToInt32(end.getJulianLocalNoon() - start.getJulianLocalNoon())); GPCoreEventResults coreEvents = new GPCoreEventResults(); coreEvents.Sort(false); coreEvents.CalculateEvents(loc, start, end); string path = "d:\\gcal\\reports\\"; if (Directory.Exists(path)) { File.WriteAllText(Path.Combine(path, prefix + "-cal-" + loc.getCity() + ".txt"), FormaterInternal.getInternalDalendarData(calendar)); File.WriteAllText(Path.Combine(path, prefix + "-eve-" + loc.getCity() + ".txt"), FormaterInternal.getInternalEventsText(coreEvents)); } }
protected override void Execute() { GPCalendarResults cal = new GPCalendarResults(); GPCoreEventResults evn = new GPCoreEventResults(); cal.progressReport = this; evn.progressReport = this; if (location != null && startDate != null) { cal.CalculateCalendar(startDate, Convert.ToInt32(endDate.getJulianLocalNoon() - startDate.getJulianLocalNoon())); evn.CalculateEvents(location, startDate, endDate); } GPCalendarPlusEventsResults calev = new GPCalendarPlusEventsResults(); calev.theCalendar = cal; calev.theEvents = evn; StringBuilder sb = new StringBuilder(); FormatOutput(sb, calev); HtmlText = sb.ToString(); CalculatedObject = calev; }
protected override void Execute() { GPCalendarResults calA = new GPCalendarResults(); GPCalendarResults calB = new GPCalendarResults(); calA.progressReport = this; calB.progressReport = this; if (startDateA != null && startDateB != null) { calA.CalculateCalendar(startDateA, nCount); calB.CalculateCalendar(startDateB, nCount); } StringBuilder sb = new StringBuilder(); GPCalendarTwoLocResults cals = new GPCalendarTwoLocResults(); cals.CalendarA = calA; cals.CalendarB = calB; FormaterHtml.WriteCompareCalendarHTML(cals, sb); HtmlText = sb.ToString(); CalculatedObject = cals; }
/// <summary> /// Calculation of calendar /// </summary> /// <param name="city"></param> /// <param name="longitude"></param> /// <param name="latitude"></param> /// <param name="timezoneName"></param> /// <param name="startDate"></param> /// <param name="days"></param> /// <returns></returns> public static XmlDocument CalculateCalendar(GPLocationProvider locationProvider, DateTime startDate, int days) { GPCalendarResults cr = new GPCalendarResults(); GPGregorianTime sd = new GPGregorianTime(locationProvider); sd.setDate(startDate.Year, startDate.Month, startDate.Day); cr.CurrentLocation = locationProvider; cr.CalculateCalendar(sd, days); return(FormaterXml.GetCalendarXmlDocument(cr)); }
protected override void Execute() { GPCalendarResults cal = new GPCalendarResults(); cal.progressReport = this; if (location != null && startDate != null) { cal.CalculateCalendar(startDate, nCount); } StringBuilder sb = new StringBuilder(); FormatOutput(sb, cal); HtmlText = sb.ToString(); CalculatedObject = cal; }
protected override void Execute() { GPCalendarResults calA = new GPCalendarResults(); calA.progressReport = this; if (startDateA != null) { calA.CalculateCalendar(startDateA, nCount); } StringBuilder sb = new StringBuilder(); FormaterHtml.WriteCalendarHTML(calA, sb); HtmlText = sb.ToString(); CalculatedObject = calA; }
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); }
/// <summary> /// Main function of this class /// </summary> /// <param name="args"></param> /// <returns></returns> public bool ParseCommandArguments(string[] args) { GPLocationProvider loc = new GPLocationProvider(); GPLocation loc1 = new GPLocation(); GPGregorianTime vcStart = new GPGregorianTime(loc), vcEnd = new GPGregorianTime(loc); GPVedicTime vaStart = new GPVedicTime(), vaEnd = new GPVedicTime(); int nCount; int nReq = 0; string strFileOut = ""; try { loc1.setLatitudeNorthPositive(0.0); loc1.setLongitudeEastPositive(0.0); loc1.setTimeZoneName(""); loc.setDefaultLocation(loc1); vcStart.Clear(); vcEnd = vcStart; vaStart.tithi = vaStart.masa = vaStart.gyear = 0; vaEnd = vaStart; nCount = -1; int argc = args.Length; for (int i = 0; i < argc; i++) { //TRACE2("arg %d = %s\n", i, args[i]); if (args[i] == "-L") { if (argc >= i + 2) { loc1.setLongitudeString(args[i + 1]); double lat = 0.0; double longi = 0.0; GetArg_EarthPos(args[i + 1], ref lat, ref longi); loc1.setLongitudeEastPositive(longi); loc1.setLatitudeNorthPositive(lat); //TRACE2("-L latitude=%f longitude=%f\n", loc.m_fLatitude, loc.m_fLongitude); } i++; } else if (args[i] == "-N") { if (argc >= i + 2) { loc1.setCity(args[i + 1]); //TRACE1("-N name=%s\n", loc.m_strName); } i++; } else if (args[i] == "-SV") { if (argc >= i + 2) { GetArg_VaisnDate(args[i + 1], out vaStart); } i++; } else if (args[i] == "-SG") { if (argc >= i + 2) { GetArg_Date(args[i + 1], out vcStart); } i++; } else if (args[i] == "-ST") { if (argc >= i + 2) { GetArg_Time(args[i + 1], out vcStart); } i++; } else if (args[i] == "-EG") { if (argc >= i + 2) { GetArg_Date(args[i + 1], out vcEnd); //AfxTrace("-EG day=%d month=%d year=%d\n", vcEnd.day, vcEnd.month, vcEnd.year); } i++; } else if (args[i] == "-EV") { if (argc >= i + 2) { GetArg_VaisnDate(args[i + 1], out vaEnd); //AfxTrace("-EV tithi=%d masa=%d gyear=%d\n", vaEnd.tithi, vaEnd.masa, vaEnd.gyear); } i++; } else if (args[i] == "-EC") { if (argc >= i + 2) { int.TryParse(args[i + 1], out nCount); } i++; } else if (args[i] == "-TZ") { if (argc >= i + 2) { loc1.setTimeZoneName(args[i + 1]); } i++; } else if (args[i] == "-O") { if (argc >= i + 2) { strFileOut = args[i + 1]; } i++; } else if (args[i] == "-R") { if (argc >= i + 2) { if (args[i + 1] == "calendar") { nReq = 10; } else if (args[i + 1] == "appday") { nReq = 11; } else if (args[i + 1] == "tithi") { nReq = 12; } else if (args[i + 1] == "sankranti") { nReq = 13; } else if (args[i + 1] == "naksatra") { nReq = 14; } else if (args[i + 1] == "firstday") { nReq = 15; } else if (args[i + 1] == "gcalendar") { nReq = 16; } else if (args[i + 1] == "gtithi") { nReq = 17; } else if (args[i + 1] == "next") { nReq = 18; } else if (args[i + 1] == "help") { nReq = 60; } /*else if (args[i+1] == "") * { * } else if (args[i+1] == "") * { * } else if (args[i+1] == "") * { * } else if (args[i+1] == "") * { * }*/ } i++; } } vcStart.setLocationProvider(loc); vcEnd.setLocationProvider(loc); switch (nReq) { case 10: case 13: case 14: if (vcStart.getYear() == 0 && vaStart.gyear != 0) { GPEngine.VATIMEtoVCTIME(vaStart, out vcStart, loc); } if (vcEnd.getYear() == 0 && vaEnd.gyear != 0) { GPEngine.VATIMEtoVCTIME(vaEnd, out vcEnd, loc); } break; default: break; } if (vcStart.getYear() != 0 && vcEnd.getYear() != 0 && nCount < 0) { nCount = Convert.ToInt32(vcEnd.getJulianLocalNoon() - vcStart.getJulianLocalNoon()); } if (nCount < 0) { nCount = 30; } GPAppDayResults appday = new GPAppDayResults(); GPCalendarResults calendar = new GPCalendarResults(); //AfxTrace("Count === %d\n", nCount); StringBuilder fout = new StringBuilder(); switch (nReq) { case 10: // -R -O -LAT -LON -SG -C [-DST -NAME] vcStart.NextDay(); vcStart.PreviousDay(); calendar.CalculateCalendar(vcStart, nCount); FormaterXml.WriteXml(FormaterXml.GetCalendarXmlDocument(calendar), fout); break; case 11: // -R -O -LAT -LON -SG -ST [-NAME] appday.calculateAppearanceDayData(loc, vcStart); FormaterXml.FormatAppDayXML(appday, fout); break; case 12: FormaterXml.WriteXML_Tithi(fout, loc, vcStart); break; case 13: if (vcEnd.getYear() == 0) { vcEnd = vcStart; vcEnd.AddDays(nCount); } FormaterXml.WriteXml(FormaterXml.GetSankrantiXml(loc, vcStart, vcEnd), fout); break; case 14: FormaterXml.WriteXML_Naksatra(fout, loc, vcStart, nCount); break; case 15: FormaterXml.WriteXML_FirstDay_Year(fout, vcStart); break; case 16: vcStart = GPGaurabdaYear.getFirstDayOfYear(loc, vcStart.getYear()); vcEnd = GPGaurabdaYear.getFirstDayOfYear(loc, vcStart.getYear() + 1); nCount = Convert.ToInt32(vcEnd.getJulianLocalNoon() - vcStart.getJulianLocalNoon()); calendar.CalculateCalendar(vcStart, nCount); FormaterXml.WriteXml(FormaterXml.GetCalendarXmlDocument(calendar), fout); break; case 17: FormaterXml.WriteXML_GaurabdaTithi(fout, loc, vaStart, vaEnd); break; case 18: FormaterXml.WriteXML_GaurabdaNextTithi(fout, loc, vcStart, vaStart); break; } // application should be windowless // since some parameters are present File.WriteAllText(strFileOut, fout.ToString()); } catch (Exception ex) { Console.WriteLine("Exception during execution: " + ex.Message); } return(true); }
protected override void Execute() { loc = GPAppHelper.getMyLocation(); //Testing.Report(loc, "gcal13"); //loc1.setLatitudeNorthPositive(48.16); //loc1.setLongitudeEastPositive(17.09); //loc1.setTimeZoneName("Europe/Bratislava"); p_today = new GPGregorianTime(loc); p_today.Today(); /* * Debugger.Log(0,"", String.Format("Location: {0} {1} {2}\n", loc.getFullName(), loc1.getLongitudeString(), loc1.getLatitudeString())); * * double date = p_today.getJulianLocalNoon(); * TEclipse te; * for (int i = 0; i < 30; i++) * { * te = MA.Engine.NextEclipse(ref date, true); * int y, m, d; * MA.Engine.DecodeDateCorrect(date, out y, out m, out d); * Debugger.Log(0, "", String.Format("eclipse:{0} date: {1} {2} {3}\n", te, y, m, d)); * date += 20; * } * * //double a1 = MA.GPMeeusEngine.star_time(2456708.3200) ; * //a1 = MA.GPMeeusEngine.star_time(2452083) - a1; * * * double lat1 = 48.16, lat2 = 120; * double lon1 = 17.09, lon2 = 123; * double dStart = 0.287399999999998; * double dEnd = 0.287799999999998; * GPObserver obs = new GPObserver(); * obs.setLatitudeNorthPositive(lat1).setLongitudeEastPositive(lon1).SetAltitude(0.2); * * GPJulianTime rise, trans, set; * * * GPJulianTime time = new GPJulianTime(); * * time.setLocalJulianDay(2456708.5); * time.setLocalTimezoneOffset(1); * for (int l = 0; l < 40; l++) * { * Log("Julian {0} = {1} / {2} / {3} {4}:{5}:{6}\n", time.GetJulianDay(), time.GetYear(), * time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); * time.AddSeconds(79367.6); * } * * //GPGregorianTime gt = new GPGregorianTime(loc); * //gt.setJulianGreenwichTime(time); * //double rise = MA.GPMeeusEngine.Sun_Rise(p_today.GetJulianDetailed() - 0.5, loc.Latitude, -loc.Longitude); * //GPAstroEngine.CalculateTimeSun(gt, obs, out rise, out trans, out set); * * //Log("Rise: {0}, \nTrans:{1}, \nSet:{2}", rise, trans, set); * * //MA.Testing.TestSunCoordinates(); * //MA.Testing.TestSiderealTime(); * //MA.Testing.TestMoonEvents(); * * //GPSun sun = new GPSun(); * //sun.SunCalc(p_today, loc); * TRiseSet kind; * double deltaphi, epsilon, srt; * GPJulianTime dp = new GPJulianTime(); * dp.setLocalJulianDay(2456710.500000); * * obs.setLongitudeEastPositive(-25.858).setLatitudeNorthPositive(-23.983); * srt = 2452081.000000; * * //MA.Testing.TestMoonEclipse(); * * Testing.TestConjunctions(); * * //MA.GPCelestialBodyCoordinates coord = MA.GPMeeusEngine.moon_coordinate(2448724.5); * //double phi, eps; * //MA.GPMeeusEngine.calc_epsilon_phi(2446895.5, out phi, out eps); * //Log("Sidereal time: {0}", MA.GPMeeusEngine.star_time(2446895.5)); * //Log("Epsilon: {0}, phi: {1}", eps, phi); * //Log("Sunrise {0}", sun.rise.LongTimeString); * * return; */ int maxCount = GPUserDefaults.IntForKey("nextfest.days", 16); if (maxCount < 3) { maxCount = 16; GPUserDefaults.SetIntForKey("nextfest.days", maxCount); } bool onlyFast = GPUserDefaults.BoolForKey("nextfest.onlyfast", true); p_cal.CalculateCalendar(p_today, maxCount); List <string> temp = new List <string>(); for (int i = 0; i < p_cal.getCount(); i++) { temp.Clear(); GPCalendarDay vd = p_cal.get(i); if (onlyFast) { if (vd.sEkadasiVrataName.Length > 0) { temp.Add(string.Format(GPStrings.getString(87), vd.sEkadasiVrataName)); } else if (vd.hasEkadasiParana()) { temp.Add(vd.getEkadasiParanaString()); } } else { if (vd.hasEkadasiParana()) { temp.Add(vd.getEkadasiParanaString()); } foreach (GPCalendarDay.Festival fest in vd.Festivals) { if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true)) { temp.Add(fest.Text); } } } if (temp.Count > 0) { for (int j = 0; j < temp.Count; j++) { GPStringPair dr = new GPStringPair(); if (j == 0) { dr.Name = vd.date.ToString() + " " + GPStrings.getString(150 + vd.date.getDayOfWeek()); } dr.Value = temp[j]; lines.Add(dr); } } } }
private void button1_Click(object sender, EventArgs e) { GPLocation loc; content.findLocations("Bratislava"); loc = content.getLocation(0); GPLocationProvider provider = new GPLocationProvider(loc); int nCount = 365; GPGregorianTime startDateA = new GPGregorianTime(loc); GPCalendarResults calA = new GPCalendarResults(); GPCalendarResults calB = new GPCalendarResults(); calA.progressReport = this; calB.progressReport = this; if (startDateA != null) { GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOR; calA.CalculateCalendar(startDateA, nCount); GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOREX; calB.CalculateCalendar(startDateA, nCount); } GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOR; StringBuilder sb = new StringBuilder(); GPCalendarTwoLocResults cals = new GPCalendarTwoLocResults(); cals.CalendarA = calA; cals.CalendarB = calB; FormaterHtml.WriteCompareCalendarHTML(cals, sb); string HtmlText = sb.ToString(); webBrowser1.DocumentText = HtmlText; GPObserver obs = new GPObserver(); obs = loc; GPStrings.pushRich(false); StringBuilder sba = new StringBuilder(); GPJulianTime sunRise, sunNoon, sunSet; for (int i = 0; i < calA.getCount(); i++) { GPCalendarDay cd = calA.get(i); GPCalendarDay cd2 = calB.get(i); GPAstroEngine.CalculateTimeSun(cd.date, loc, out sunRise, out sunNoon, out sunSet); GPGregorianTime gt = new GPGregorianTime(loc); GPCelestialBodyCoordinates pos = GPAstroEngine.sun_coordinate(GPDynamicTime.getUniversalTimeFromDynamicTime(2457012.82313)); GPAstroEngine.calcHorizontal(pos, loc); sunRise.setLocalTimezoneOffset(loc.getTimeZoneOffsetHours()); sba.AppendFormat("{0} {1} {2} \n", cd.date.ToString(), cd.getSunriseTime().getLongTimeString(), cd2.getSunriseTime().getLongTimeString()); gt.setDate(1992, 10, 13); //cd.astrodata.sun.calculateCoordinatesMethodM(gt, 360/24.0); } GPStrings.popRich(); richTextBox1.Text = sba.ToString(); GPGregorianTime t1 = new GPGregorianTime(loc); t1.setDate(2015, 4, 4); double jd = t1.getJulianLocalNoon(); sba.Clear(); for (double d = 0.3; d < 1.0; d += 0.01) { double ml = GPAstroEngine.moon_coordinate(jd + d).eclipticalLongitude; double sl1 = GPAstroEngine.sun_coordinate(jd + d).eclipticalLongitude; double sl2 = GPAstroEngine.sunLongitudeMethodM(jd + d); sba.AppendFormat("{0} : {1} {2} {3}\n", jd + d, ml, sl1, sl2); } richTextBox2.Text = sba.ToString(); }
protected override void Execute() { ResultsList.Clear(); //ClearControlList(); int limit; if (Location == null || p_text == null || p_text.Length == 0) { return; } // find in texts StringBuilder sb = new StringBuilder(); Results res = new Results(this, p_text); GPGregorianTime vc = new GPGregorianTime(Location); vc.Today(); // // today results (this day, tomorrow and day after // #region today screen results limit = GPUserDefaults.IntForKey("search.today.days", 3); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); FormaterPlain.AvcGetTodayInfo(vc, Location, sb); res.Title = GPAppHelper.getDateText(vc); res.Type = GPStrings.getString(174); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.Today; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); res.ActionScript += string.Format("scriptObject.setMyDate({0},{1},{2});", vc.getYear(), vc.getMonth(), vc.getDay()); res.ActionScript += "window.location.href='today.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.NextDay(); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region calendar results limit = GPUserDefaults.IntForKey("search.calendar.months", 12); GPCalendarResults rcal = new GPCalendarResults(); vc.Today(); vc.AddDays(1 - vc.getDay()); for (int i = 0; i < limit; i++) { rcal.CalculateCalendar(vc, GPGregorianTime.GetMonthMaxDays(vc.getYear(), vc.getMonth())); FormaterPlain.FormatCalendarPlain(rcal, sb); res.Title = string.Format("{0} {1}", GPStrings.getString(759 + vc.getMonth()), vc.getYear()); res.Type = GPStrings.getString(44); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.Calendar; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); GPGregorianTime vc2 = vc.Copy(); vc2.AddMonths(1); res.Parameters.Add(GPCalculationParameters.EndWesternDate, vc2); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('startmonth', '" + vc.getMonth() + "');"; res.ActionScript += "saveString('startday', '" + vc.getDay() + "');"; res.ActionScript += "saveString('endperiodtype', '3');"; res.ActionScript += "saveString('endperiodlength', '1');"; res.ActionScript += "window.location.href='calendar.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddMonths(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region core events results limit = GPUserDefaults.IntForKey("search.coreevents.months", 1); GPCoreEventResults reve = new GPCoreEventResults(); vc.Today(); vc.AddDays(1 - vc.getDay()); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); GPGregorianTime vcEnd = vc.Copy(); vcEnd.AddDays(31); reve.CalculateEvents(Location, vc, vcEnd); FormaterPlain.FormatEventsText(reve, sb); res.Title = string.Format("{0} {1}", GPStrings.getString(759 + vc.getMonth()), vc.getYear()); res.Type = GPStrings.getString(46); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.CoreEvents; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); res.Parameters.Add(GPCalculationParameters.EndWesternDate, vcEnd); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('startmonth', '" + vc.getMonth() + "');"; res.ActionScript += "saveString('startday', '" + vc.getDay() + "');"; res.ActionScript += "saveString('endperiodtype', '3');"; res.ActionScript += "saveString('endperiodlength', '1');"; res.ActionScript += "window.location.href='coreevents.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddMonths(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region masa list limit = GPUserDefaults.IntForKey("search.masalist.years", 3); GPMasaListResults rmas = new GPMasaListResults(); vc.Today(); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); rmas.CalcMasaList(Location, vc.getYear(), 1); FormaterPlain.FormatMasaListText(rmas, sb); res.Title = string.Format("{0}", vc.getYear()); res.Type = GPStrings.getString(48); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.MasaList; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartYear, vc.getYear()); res.Parameters.Add(GPCalculationParameters.CountYear, 1); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('yearcount', '1');"; res.ActionScript += "window.location.href='masalist.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddYears(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion finished = true; }
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); }