public static string getInternalEventsText(GPCoreEventResults inEvents) { int i; StringBuilder res = new StringBuilder(); res.AppendFormat(getSharedStringHtml(983), inEvents.m_vcStart, inEvents.m_vcEnd); res.AppendLine(); res.AppendLine(); res.Append(inEvents.m_location.getFullName()); res.AppendLine(); res.AppendLine(); DateTime prevd = new DateTime(1970, 1, 1); for (i = 0; i < inEvents.getCount(); i++) { GPCoreEvent dnr = inEvents.get(i); if (!inEvents.b_sorted) { res.Append(dnr.Time.ToString().PadLeft(20)); } res.AppendFormat(" {0} {1}", dnr.Time.getLongTimeString(), dnr.getEventTitle()); res.AppendLine(); } res.AppendLine(); return(res.ToString()); }
public static int FormatEventsXML(GPCoreEventResults inEvents, StringBuilder strXml) { int i; strXml.AppendFormat("<xml>\r\n<program version=\"{0}\">\r\n<location longitude=\"{1}\" latitude=\"{2}\" timezone=\"{3}\"/>\n" , GPFileHelper.FileVersion, inEvents.m_location.getLocation(0).GetLongitudeEastPositive(), inEvents.m_location.getLocation(0).GetLatitudeNorthPositive() , inEvents.m_location.getLocation(0).getTimeZoneName()); GPGregorianTime prevd = new GPGregorianTime(inEvents.m_location); prevd.setDate(1800, 1, 1); for (i = 0; i < inEvents.getCount(); i++) { GPCoreEvent dnr = inEvents.get(i); if (inEvents.b_sorted) { if (prevd.getDay() != dnr.Time.getDay() || prevd.getMonth() != dnr.Time.getMonth() || prevd.getYear() != dnr.Time.getYear()) { strXml.AppendFormat("\t<day date=\"{0}\" />\n", dnr.Time); } prevd = dnr.Time; } strXml.AppendFormat("\t<event type=\"{0}\" time=\"{1}\" />\n", dnr.getEventTitle(), dnr.Time.getLongTimeString()); } strXml.Append("</xml>\n"); return(1); }
private bool AddEvent(GPGregorianTime inTime, int inType, string inData) { GPCoreEvent eve = new GPCoreEvent(); eve.Time = inTime; eve.strData = inData; eve.nType = inType; p_events.Add(eve); return(true); }
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); }