static public Todo Create(iCalendar iCal) { Todo t = (Todo)iCal.Create(iCal, "VTODO"); t.UID = UniqueComponent.NewUID(); return t; }
static public Event Create(iCalendar iCal) { Event evt = new Event(iCal); evt.UID = UniqueComponent.NewUID(); return evt; }
static public Journal Create(iCalendar iCal) { Journal j = (Journal)iCal.Create(iCal, "VJOURNAL"); j.UID = UniqueComponent.NewUID(); return j; }
static public Journal Create(iCalendar iCal) { Journal j = new Journal(iCal); j.UID = UniqueComponent.NewUID(); return j; }
static public Todo Create(iCalendar iCal) { Todo t = new Todo(iCal); t.UID = UniqueComponent.NewUID(); return t; }
static public Journal Create(iCalendar iCal) { Journal j = iCal.Create<Journal>(); j.UID = UniqueComponent.NewUID(); j.Created = DateTime.Now; j.DTStamp = DateTime.Now; return j; }
public void UniqueComponent1() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); Assert.IsNotNull(evt.UID); Assert.IsNull(evt.Created); // We don't want this to be set automatically Assert.IsNotNull(evt.DTStamp); }
static public Todo Create(iCalendar iCal) { Todo t = (Todo)iCal.Create(iCal, "VTODO"); t.UID = UniqueComponent.NewUID(); t.Created = DateTime.Now; t.DTStamp = DateTime.Now; return t; }
public void UniqueComponent1() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); Assert.IsNotNull(evt.UID); Assert.IsNotNull(evt.Created); Assert.IsNotNull(evt.DTStamp); }
public void UID1() { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\General\BINARY.ics"); Program.TestCal(iCal); Event evt = iCal.Events["uuid1153170430406"]; Assert.IsNotNull(evt, "Event could not be accessed by UID"); }
public void BASE64_1() { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\General\BASE64_1.ics"); Program.TestCal(iCal); Event evt = iCal.Events[0]; Assert.IsTrue(evt.UID.Value == "uuid1153170430406", "UID should be 'uuid1153170430406'; it is " + evt.UID.Value); Assert.IsTrue(evt.Sequence.Value == 1, "SEQUENCE should be 1; it is " + evt.Sequence.Value); }
public void GEO1() { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\General\GEO1.ics"); Program.TestCal(iCal); Event evt = iCal.Events[0]; Assert.IsTrue(evt.Geo.Latitude.Value == 37.386013, "Latitude should be 37.386013; it is not."); Assert.IsTrue(evt.Geo.Longitude.Value == -122.082932, "Longitude should be -122.082932; it is not."); }
public void LoadFromFile() { string path = @"Calendars\General\Test1.ics"; Assert.IsTrue(File.Exists(path), "File '" + path + "' does not exist."); iCalendar iCal = iCalendar.LoadFromFile(path); Program.TestCal(iCal); }
public void SERIALIZE33() { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\SERIALIZE33.ics"); Event evt = iCal.Events["edb7a48a-d846-47f8-bad2-9ea3f29bcda5"]; Assert.IsNotNull(evt); Assert.AreEqual(new Duration(TimeSpan.FromDays(12) + TimeSpan.FromHours(1)), evt.Duration, "Duration should be 12 days, 1 hour"); SerializeTest("SERIALIZE33.ics", typeof(iCalendarSerializer)); }
static public Todo Create(iCalendar iCal) { Todo t = (Todo)iCal.Create(iCal, "VTODO"); t.UID = UniqueComponent.NewUID(); t.Created = DateTime.Now; t.DTStamp = DateTime.Now; return(t); }
static public Journal Create(iCalendar iCal) { Journal j = iCal.Create <Journal>(); j.UID = UniqueComponent.NewUID(); j.Created = DateTime.Now; j.DTStamp = DateTime.Now; return(j); }
public void LoadFromUri() { string path = Directory.GetCurrentDirectory(); path = Path.Combine(path, "Calendars/General/Test1.ics").Replace(@"\", "/"); path = "file:///" + path; Uri uri = new Uri(path); iCalendar iCal = iCalendar.LoadFromUri(uri); Program.TestCal(iCal); }
public void LANGUAGE4() { string calendarPath = Path.Combine(Environment.CurrentDirectory, "Calendars"); calendarPath = Path.Combine(calendarPath, "Serialization"); iCalendar russia1 = iCalendar.LoadFromUri(new Uri("http://www.mozilla.org/projects/calendar/caldata/RussiaHolidays.ics")); iCalendar russia2 = iCalendar.LoadFromFile(Path.Combine(calendarPath, "RussiaHolidays.ics")); CompareCalendars(russia1, russia2); }
public void JOURNAL1() { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Journal\JOURNAL1.ics"); Program.TestCal(iCal); DDay.iCal.Components.Journal j = (DDay.iCal.Components.Journal)iCal.Journals[0]; Assert.IsNotNull(j, "Journal entry was null"); Assert.IsTrue(j.Status == JournalStatus.Draft, "Journal entry should have been in DRAFT status, but it was in " + j.Status.ToString() + " status."); Assert.IsTrue(j.Class.Value == "PUBLIC", "Journal class should have been PUBLIC, but was " + j.Class + "."); Assert.IsNull(j.DTStart); }
public void AddNewEvent(iCalendar iCal, DateTime Begin, DateTime End, string Discipline, string Type, string Room, string Teacher, string SubGroup, bool IsMoved) { Event evt = iCal.Create<Event>(); evt.Start = new iCalDateTime(Begin); evt.End = new iCalDateTime(End); evt.Description = "#Disc:"+Discipline+"#Type:"+Type+"#SubGroup:"+SubGroup+"#Teacher:"+Teacher+"#IsMoved:"+IsMoved.ToString(); evt.Location = Room; evt.Summary = "Занятие по предмету '"+Discipline+"', "+ Type +" для подгруппы "+SubGroup+", проводится в " + Room + ", преподаватель " + Teacher +", с "+ Begin.ToShortTimeString() +" до " + End.ToShortTimeString()+"."; if (IsMoved) evt.Summary = evt.Summary + " Перенесено."; }
public void PARSE10() { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\PARSE10.ics"); Event evt = iCal.Events[0]; IList <Parameter> parms = evt.DTStart.Parameters.AllOf("VALUE"); Assert.AreEqual(2, parms.Count); Assert.AreEqual("DATE", parms[0].Values[0]); Assert.AreEqual("OTHER", parms[1].Values[0]); }
private void Schedule_Load(object sender, EventArgs e) { iCal = iCalendar.LoadFromFile(@"Calendars\USHolidays.ics"); iCal.MergeWith(iCalendar.LoadFromFile(@"Calendars\lotr.ics")); iCal.MergeWith(iCalendar.LoadFromFile(@"Calendars\To-do.ics")); //iCal.MergeWith(iCalendar.LoadFromFile("Barça 2006 - 2007.ics")); if (iCal == null) { throw new ApplicationException("iCalendar could not be loaded."); } }
public void Merge2() { iCalendar iCal = new iCalendar(); IICalendar tmp_cal = iCalendar.LoadFromFile(@"Calendars\Serialization\TimeZone3.ics")[0]; iCal.MergeWith(tmp_cal); tmp_cal = iCalendar.LoadFromFile(@"Calendars\Serialization\TimeZone3.ics")[0]; // Compare the two calendars -- they should match exactly SerializationTest.CompareCalendars(iCal, tmp_cal); }
public void MERGE2() { iCalendar iCal = new iCalendar(); iCalendar tmp_cal = iCalendar.LoadFromFile(@"Calendars\General\MERGE2.ics"); iCal.MergeWith(tmp_cal); tmp_cal = iCalendar.LoadFromFile(@"Calendars\General\MERGE2.ics"); // Compare the two calendars -- they should match exactly SerializationTest.CompareCalendars(iCal, tmp_cal); }
private iCalendar CreateEntity(int startInHundretDays) { var calendar = new iCalendar(); var evt = new Event(); calendar.Events.Add(evt); evt.Start = new iCalDateTime(DateTime.Now.AddDays(startInHundretDays * 100)); evt.End = new iCalDateTime(DateTime.Now.AddDays(startInHundretDays * 100).AddHours(1)); evt.Summary = "Event" + startInHundretDays; return(calendar); }
static public void TestCal(iCalendar iCal) { Assert.IsNotNull(iCal, "The iCalendar was not loaded"); if (iCal.Events.Count > 0) { Assert.IsTrue(iCal.Events.Count == 1, "Calendar should contain 1 event; however, the iCalendar loaded " + iCal.Events.Count + " events"); } else if (iCal.Todos.Count > 0) { Assert.IsTrue(iCal.Todos.Count == 1, "Calendar should contain 1 todo; however, the iCalendar loaded " + iCal.Todos.Count + " todos"); } }
public iCalendar GetCalendarForGroup(int groupId) { iCalendar res = new iCalendar(); List <EventInfo> eiArray = GetEventsForGroup(groupId); foreach (EventInfo ei in eiArray) { CICalConverter.AddNewEvent(res, ei); } return(res); }
public Calendar( AuthContext context, TimeZoneConverter timeZoneConverter, iCalendar iCalendar, DataProvider dataProvider) : base(context, timeZoneConverter) { ICalendar = iCalendar; DataProvider = dataProvider; this.ViewSettings = new List <UserViewSettings>(); this.Context.CanChangeAlertType = true; this.Context.CanChangeTimeZone = true; }
public iCalDateTime(DateTime value, TZID tzid, iCalendar iCal) : this() { if (value.Kind == DateTimeKind.Utc) { this.IsUniversalTime = true; } this.Value = DateTime.SpecifyKind(value, DateTimeKind.Utc); this.HasDate = true; this.HasTime = (value.Second == 0 && value.Minute == 0 && value.Hour == 0) ? false : true; this.TZID = tzid; this.iCalendar = iCal; }
public void SERIALIZE24() { // // Ensures that custom iCalendars are loaded correctly // iCalendar calendar = iCalendar.LoadFromFile <iCalendar>(@"Calendars\Serialization\SERIALIZE1.ics"); CustomICal1 customiCal = iCalendar.LoadFromFile <CustomICal1>(@"Calendars\Serialization\SERIALIZE1.ics"); Assert.IsTrue(calendar.Events.Count == 1, "Calendar should have 1 event"); Assert.IsTrue(customiCal.Events.Count == 1, "Custom calendar should have 1 event"); Assert.IsTrue(calendar.Events[0].GetType() == typeof(Event), "Calendar event should be of type Event"); Assert.IsTrue(customiCal.Events[0].GetType() == typeof(CustomEvent1), "Custom calendar event should be of type CustomEvent1"); }
public void TIMEZONE3() { SerializeTest("TIMEZONE3.ics", typeof(iCalendarSerializer)); iCalendar iCal = new iCalendar(); iCalendar tmp_cal = iCalendar.LoadFromFile(@"Calendars\Serialization\TIMEZONE3.ics"); iCal.MergeWith(tmp_cal); iCalendarSerializer serializer = new iCalendarSerializer(iCal); serializer.Serialize(@"Calendars\Serialization\testMeOut.ics"); }
public void PARSE9() { iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\PARSE9.ics"); IList <Property> props = iCal.Properties.AllOf("VERSION"); Assert.AreEqual(2, props.Count); for (int i = 0; i < props.Count; i++) { Assert.AreEqual("2." + i, props[i].Value); } }
public void Add1() { IICalendar iCal = new iCalendar(); Event evt = new Event(); evt.Summary = "Testing"; evt.Start = new iCalDateTime(2010, 3, 25); evt.End = new iCalDateTime(2010, 3, 26); iCal.Events.Add(evt); Assert.AreEqual(1, iCal.Children.Count); Assert.AreSame(evt, iCal.Children[0]); }
public void SERIALIZE25() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create <Event>(); evt.Start = DateTime.Now; evt.Duration = TimeSpan.FromHours(1); evt.Summary = @" Thank you for purchasing tickets on Ticketmaster. Your order number for this purchase is 19-36919/UK1. Tickets will be despatched as soon as possible, but may not be received until 7-10 days before the event. Please do not contact us unless you have not received your tickets within 7 days of the event. You purchased 2 tickets to: _____________________________________________________________________________________________ Prince The O2, London, UK Fri 31 Aug 2007, 18:00 Seat location: section BK 419, row M, seats 912-913 Total Charge: £69.42 http://ads.as4x.tmcs.ticketmaster.com/click.ng/site=tm&pagepos=531&adsize=336x102&lang=en-uk&majorcatid=10001&minorcatid=1&event_id=12003EA8AD65189AD&venueid=148826&artistid=135895&promoter=161&TransactionID=0902229695751936911UKA Thanks again for using Ticketmaster. Show complete HYPERLINK ""http://ntr.ticketmaster.com:80/ssp/?&C=%39%33%30%30%35%5F%33%30%33&R=%6F%6C%5F%31%33%31&U=%31%39%2D%33%36%41%31%39%2F%55%4B%31&M=%35&B=%32%2E%30&S=%68%80%74%70%73%3A%2F%3F%77%77%77%2E%74%80%63%6B%65%71%6D%61%73%74%65%72%2E%63%6F%2E"" \t ""_blank"" order detail. You can always check your order and manage your preferences in HYPERLINK ""http://ntr.ticketmaster.com:80/ssp/?&C=%39%33%30%30%30%5F%33%30%33&R=%6F%6C%5F%6D%65%6D%62%65%72&U=%31%39%2D%33%36%39%31%39%2F%55%4B%31&M=%31&B=%32%2E%30&S=%68%74%74%70%73%3A%2F%2F%77%"" \t ""_blank"" My Ticketmaster. _____________________________________________________________________________________________ C U S T O M E R S E R V I C E _____________________________________________________________________________________________ If you have any questions regarding your booking you can search for answers using our online helpdesk at http://ticketmaster.custhelp.com You can search our extensive range of answers and in the unlikely event that you cannot find an answer to your query, you can use 'Ask a Question' to contact us directly. _____________________________________________________________________________________________ This email confirms your ticket order, so print/save it for future reference. All purchases are subject to credit card approval and billing address verification. We make every effort to be accurate, but we cannot be responsible for changes, cancellations, or postponements announced after this email is sent. Please do not reply to this email. Replies to this email will not be responded to or read. If you have any questions or comments, HYPERLINK ""http://ntr.ticketmaster.com:80/ssp/?&C=%39%33%30%30%30%5F%33%30%33&R=%32&U=%31%39%2D%33%36%39%31%39%2F%55%4B%31&M=%31&B=%32%2E%30&S=%68%74%74%70%3A%2F%2F%77%77%77%2E%74%69%63%6B%65%74%6D%61%73%74%65%72%2E%63%6F%2E%75%6B%2F%68%2F%63%75%73%74%6F%6D%65%72%5F%73%65%72%76%65%2E%68%74%6D%6C"" \t ""_blank"" contact us. Ticketmaster UK Limited Registration in England No 2662632, Registered Office, 48 Leicester Square, London WC2H 7LR "; iCalendarSerializer serializer = new iCalendarSerializer(iCal); serializer.Serialize(@"Calendars\Serialization\SERIALIZE25.ics"); SerializeTest("SERIALIZE25.ics", typeof(iCalendarSerializer)); }
public void TIMEZONE2() { // // First, check against the VALUE parameter; it must be absent in DTSTART // iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\TIMEZONE2.ics"); iCalTimeZone tz = iCal.TimeZones[0]; foreach (iCalTimeZoneInfo tzi in tz.TimeZoneInfos) { tzi.Start = new iCalDateTime(2007, 1, 1); } iCalendarSerializer serializer = new iCalendarSerializer(iCal); serializer.Serialize(@"Calendars\Serialization\Temp\TIMEZONE2.ics"); iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\Temp\TIMEZONE2.ics"); tz = iCal.TimeZones[0]; foreach (iCalTimeZoneInfo tzi in tz.TimeZoneInfos) { ContentLine cl = tzi.Start.ContentLine; Assert.IsFalse(cl.Parameters.ContainsKey("VALUE"), "\"DTSTART\" property MUST be represented in local time in timezones"); } // // Next, check against UTC time; DTSTART must be presented in local time // iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\TIMEZONE2.ics"); tz = iCal.TimeZones[0]; foreach (iCalTimeZoneInfo tzi in tz.TimeZoneInfos) { tzi.Start = DateTime.Now.ToUniversalTime(); } serializer = new iCalendarSerializer(iCal); serializer.Serialize(@"Calendars\Serialization\Temp\TIMEZONE2.ics"); iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\Temp\TIMEZONE2.ics"); tz = iCal.TimeZones[0]; foreach (iCalTimeZoneInfo tzi in tz.TimeZoneInfos) { ContentLine cl = tzi.Start.ContentLine; Assert.IsFalse(cl.Parameters.ContainsKey("VALUE"), "\"DTSTART\" property MUST be represented in local time in timezones"); } }
public static string Export(CalendarBase calendar) { var iCal = new iCalendar { Method = "PUBLISH", Version = "2.0" }; foreach (AppointmentBase appointment in calendar.Appointments) { CreateCalendarEvent(iCal: ref iCal, appointment: appointment); } return(new iCalendarSerializer().SerializeToString(iCal)); }
/// <summary> /// The main program execution. /// </summary> static void Main(string[] args) { // Create a new iCalendar iCalendar iCal = new iCalendar(); // Create the event, and add it to the iCalendar Event evt = iCal.Create <Event>(); // Set information about the event evt.Start = iCalDateTime.Today.AddHours(8); evt.End = evt.Start.AddHours(18); // This also sets the duration evt.Description = "The event description"; evt.Location = "Event location"; evt.Summary = "18 hour event summary"; // Set information about the second event evt = iCal.Create <Event>(); evt.Start = iCalDateTime.Today.AddDays(5); evt.End = evt.Start.AddDays(1); evt.IsAllDay = true; evt.Summary = "All-day event"; // Display each event foreach (Event e in iCal.Events) { Console.WriteLine("Event created: " + GetDescription(e)); } // Serialize (save) the iCalendar iCalendarSerializer serializer = new iCalendarSerializer(); serializer.Serialize(iCal, @"iCalendar.ics"); Console.WriteLine("iCalendar file saved." + Environment.NewLine); // Load the calendar from the file we just saved IICalendarCollection calendars = iCalendar.LoadFromFile(@"iCalendar.ics"); Console.WriteLine("iCalendar file loaded."); // Iterate through each event to display its description // (and verify the file saved correctly) foreach (IICalendar calendar in calendars) { foreach (IEvent e in calendar.Events) { Console.WriteLine("Event loaded: " + GetDescription(e)); } } }
private void SerializeTest(string filename) { iCalendar iCal1 = iCalendar.LoadFromFile(@"Calendars\Serialization\" + filename); iCalendarSerializer serializer = new iCalendarSerializer(iCal1); if (!Directory.Exists(@"Calendars\Serialization\Temp")) { Directory.CreateDirectory(@"Calendars\Serialization\Temp"); } serializer.Serialize(@"Calendars\Serialization\Temp\" + Path.GetFileNameWithoutExtension(filename) + "_Serialized.ics"); iCalendar iCal2 = iCalendar.LoadFromFile(@"Calendars\Serialization\Temp\" + Path.GetFileNameWithoutExtension(filename) + "_Serialized.ics"); CompareCalendars(iCal1, iCal2); }
public static Event DinnerToEvent(Dinner dinner, iCalendar iCal) { string eventLink = "http://nrddnr.com/" + dinner.DinnerID; Event evt = iCal.Create <Event>(); evt.Start = new iCalDateTime(dinner.EventDate); evt.Duration = new TimeSpan(3, 0, 0); evt.Location = dinner.Address; evt.Summary = String.Format("{0} with {1}", dinner.Description, dinner.HostedBy); evt.Contacts.Add(dinner.ContactPhone); evt.GeographicLocation = new GeographicLocation(dinner.Latitude, dinner.Longitude); evt.Url = new Uri(eventLink); evt.Description = eventLink; return(evt); }
[Test, Category("DDay")] //Category(("FreeBusy")] public void GetFreeBusyStatus1() { IICalendar iCal = new iCalendar(); IEvent evt = iCal.Create<DDayEvent>(); evt.Summary = "Test event"; evt.Start = new iCalDateTime(2010, 10, 1, 8, 0, 0); evt.End = new iCalDateTime(2010, 10, 1, 9, 0, 0); IFreeBusy freeBusy = iCal.GetFreeBusy(new iCalDateTime(2010, 10, 1, 0, 0, 0), new iCalDateTime(2010, 10, 7, 11, 59, 59)); Assert.AreEqual(FreeBusyStatus.Free, freeBusy.GetFreeBusyStatus(new iCalDateTime(2010, 10, 1, 7, 59, 59))); Assert.AreEqual(FreeBusyStatus.Busy, freeBusy.GetFreeBusyStatus(new iCalDateTime(2010, 10, 1, 8, 0, 0))); Assert.AreEqual(FreeBusyStatus.Busy, freeBusy.GetFreeBusyStatus(new iCalDateTime(2010, 10, 1, 8, 59, 59))); Assert.AreEqual(FreeBusyStatus.Free, freeBusy.GetFreeBusyStatus(new iCalDateTime(2010, 10, 1, 9, 0, 0))); }
static public void CompareCalendars(iCalendar iCal1, iCalendar iCal2) { Assert.IsTrue(object.Equals(iCal1.Method, iCal2.Method), "Methods do not match"); Assert.IsTrue(object.Equals(iCal1.ProductID, iCal2.ProductID), "ProductIDs do not match"); Assert.IsTrue(object.Equals(iCal1.Scale, iCal2.Scale), "Scales do not match"); Assert.IsTrue(object.Equals(iCal1.Version, iCal2.Version), "Versions do not match"); for (int i = 0; i < iCal1.Events.Count; i++) CompareComponents(iCal1.Events[i], iCal2.Events[i]); for (int i = 0; i < iCal1.FreeBusy.Count; i++) CompareComponents(iCal1.FreeBusy[i], iCal2.FreeBusy[i]); for (int i = 0; i < iCal1.Journals.Count; i++) CompareComponents(iCal1.Journals[i], iCal2.Journals[i]); for (int i = 0; i < iCal1.Todos.Count; i++) CompareComponents(iCal1.Todos[i], iCal2.Todos[i]); }
public void TestCorrectInput() { vCalendar vcalendar = new vCalendar(@"BEGIN:VCALENDAR VERSION:2.0 METHOD:PUBLISH X-WR-CALDESC:CheckMyTrip Calendar X-WR-CALNAME:2THQ73 PRODID:-//Amadeus/trip//NONSGML v1.0//EN BEGIN:VEVENT DTSTAMP:20150408T101400Z UID:2THQ73FlightVIE_201504172000_201504172050 DTSTART:20150417T180000Z DTEND:20150417T185000Z SUMMARY:2THQ73 / Hennies - Flight: Vienna - Prague (Austrian Airlines OS 711) LOCATION:Vienna International (Vienna\, Austria) TRANSP:TRANSPARENT DESCRIPTION:Trip status: Confirmed\n \n FLIGHT INFORMATION: \n \n Austrian Airlines OS 711: \n \n \n From: Vienna International (Vienna\, Austria) at Fri\, Apr 17\, 2015 20:00 (local time) \n To: Ruzyne (Prague\, Czech Republic) - Terminal2 at Fri\, Apr 17\, 2015 20:50 (local time) \n Cabin: Economy\n Duration: 00:50\n Stop(s): 0\n Aircraft: De Havilland DHC-8 400 Series\n Airline Recloc: 2THQ73\n \n http://www.checkmytrip.com/CMTServlet?R=2THQ73&L=US&N=Hennies\n END:VEVENT BEGIN:VEVENT DTSTAMP:20150408T101400Z UID:2THQ73FlightPRG_201504191840_201504191935 DTSTART:20150419T164000 DTEND:20150419T173500 SUMMARY:2THQ73 / Hennies - Flight 1 : Prague - Vienna (Austrian Airlines OS 710) LOCATION:Ruzyne (Prague\, Czech Republic) TRANSP:TRANSPARENT DESCRIPTION:Trip status: Confirmed\n \n FLIGHT INFORMATION: \n \n Austrian Airlines OS 710: \n \n \n From: Ruzyne (Prague\, Czech Republic) - Terminal2 at Sun\, Apr 19\, 2015 18:40 (local time) \n To: Vienna International (Vienna\, Austria) at Sun\, Apr 19\, 2015 19:35 (local time) \n Cabin: Economy\n Duration: 00:55\n Stop(s): 0\n Aircraft: Fokker 70\n \n http://www.checkmytrip.com/CMTServlet?R=2THQ73&L=US&N=Hennies\n END:VEVENT BEGIN:VEVENT DTSTAMP:20150408T101400Z UID:2THQ73FlightVIE_201504192035_201504192130 DTSTART:20150419T183500Z DTEND:20150419T193000Z SUMMARY:2THQ73 / Hennies - Flight 2 : Vienna - Innsbruck (Austrian Airlines OS 913) LOCATION:Vienna International (Vienna\, Austria) TRANSP:TRANSPARENT DESCRIPTION:Trip status: Confirmed\n \n FLIGHT INFORMATION: \n \n Austrian Airlines OS 913: \n \n \n From: Vienna International (Vienna\, Austria) at Sun\, Apr 19\, 2015 20:35 (local time) \n To: Innsbruck Airport (Innsbruck\, Austria) at Sun\, Apr 19\, 2015 21:30 (local time) \n Cabin: Economy\n Duration: 00:55\n Stop(s): 0\n Aircraft: Fokker 100\n \n http://www.checkmytrip.com/CMTServlet?R=2THQ73&L=US&N=Hennies\n END:VEVENT END:VCALENDAR"); iCalendar ical = new iCalendar(vcalendar); var a = ical[0].StartTime.ToLocalTime(); }
static public IValidator Create(Type validatorType, iCalendar iCalendar, string iCalendarText) { IValidator validator = null; if (validatorType != null) { ConstructorInfo ci = null; if (iCalendar != null) ci = validatorType.GetConstructor(new Type[] { typeof(iCalendar) }); if (ci != null) validator = ci.Invoke(new object[] { iCalendar }) as IValidator; else { if (iCalendarText != null) ci = validatorType.GetConstructor(new Type[] { typeof(string) }); if (ci != null) validator = ci.Invoke(new object[] { iCalendarText }) as IValidator; } } return validator; }
static public void TestCal(iCalendar iCal) { Assert.IsNotNull(iCal, "The iCalendar was not loaded"); if (iCal.Events.Count > 0) Assert.IsTrue(iCal.Events.Count == 1, "Calendar should contain 1 event; however, the iCalendar loaded " + iCal.Events.Count + " events"); else if (iCal.Todos.Count > 0) Assert.IsTrue(iCal.Todos.Count == 1, "Calendar should contain 1 todo; however, the iCalendar loaded " + iCal.Todos.Count + " todos"); }
public void RECURPARSE3() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); evt.Summary = "Test event"; evt.Start = new iCalDateTime(2006, 1, 1, 9, 0, 0); evt.Duration = new TimeSpan(1, 0, 0); evt.RecurrenceRules.Add(new RecurrencePattern("Every other month, on day 21")); IList<Occurrence> occurrences = evt.GetOccurrences( new iCalDateTime(2006, 1, 1), new iCalDateTime(2006, 12, 31)); iCalDateTime[] DateTimes = new iCalDateTime[] { new iCalDateTime(2006, 1, 1, 9, 0, 0), new iCalDateTime(2006, 1, 21, 9, 0, 0), new iCalDateTime(2006, 3, 21, 9, 0, 0), new iCalDateTime(2006, 5, 21, 9, 0, 0), new iCalDateTime(2006, 7, 21, 9, 0, 0), new iCalDateTime(2006, 9, 21, 9, 0, 0), new iCalDateTime(2006, 11, 21, 9, 0, 0) }; for (int i = 0; i < DateTimes.Length; i++) Assert.AreEqual(DateTimes[i], occurrences[i].Period.StartTime, "Event should occur on " + DateTimes[i]); Assert.AreEqual( DateTimes.Length, occurrences.Count, "There should be exactly " + DateTimes.Length + " occurrences; there were " + occurrences.Count); }
public void GetOccurrences1() { IICalendar iCal = new iCalendar(); IEvent evt = iCal.Create<Event>(); evt.Start = new iCalDateTime(2009, 11, 18, 5, 0, 0); evt.End = new iCalDateTime(2009, 11, 18, 5, 10, 0); evt.RecurrenceRules.Add(new RecurrencePattern(FrequencyType.Daily)); evt.Summary = "xxxxxxxxxxxxx"; iCalDateTime previousDateAndTime = new iCalDateTime(2009, 11, 17, 0, 15, 0); iCalDateTime previousDateOnly = new iCalDateTime(2009, 11, 17, 23, 15, 0); iCalDateTime laterDateOnly = new iCalDateTime(2009, 11, 19, 3, 15, 0); iCalDateTime laterDateAndTime = new iCalDateTime(2009, 11, 19, 11, 0, 0); iCalDateTime end = new iCalDateTime(2009, 11, 23, 0, 0, 0); IList<Occurrence> occurrences = null; occurrences = evt.GetOccurrences(previousDateAndTime, end); Assert.AreEqual(5, occurrences.Count); occurrences = evt.GetOccurrences(previousDateOnly, end); Assert.AreEqual(5, occurrences.Count); occurrences = evt.GetOccurrences(laterDateOnly, end); Assert.AreEqual(4, occurrences.Count); occurrences = evt.GetOccurrences(laterDateAndTime, end); Assert.AreEqual(3, occurrences.Count); // Add ByHour "9" and "12" evt.RecurrenceRules[0].ByHour.Add(9); evt.RecurrenceRules[0].ByHour.Add(12); // Clear the evaluation so we can calculate recurrences again. evt.ClearEvaluation(); occurrences = evt.GetOccurrences(previousDateAndTime, end); Assert.AreEqual(11, occurrences.Count); occurrences = evt.GetOccurrences(previousDateOnly, end); Assert.AreEqual(11, occurrences.Count); occurrences = evt.GetOccurrences(laterDateOnly, end); Assert.AreEqual(8, occurrences.Count); occurrences = evt.GetOccurrences(laterDateAndTime, end); Assert.AreEqual(7, occurrences.Count); }
public void TEST1() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); evt.Summary = "Event summary"; evt.Start = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc); Recur recur = new Recur(); evt.AddRecurrence(recur); try { List<Period> periods = evt.Evaluate(DateTime.Today.AddDays(1), DateTime.Today.AddDays(2)); Assert.Fail("An exception should be thrown when evaluating a recurrence with no specified FREQUENCY"); } catch { } }
public void TEST2() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); evt.Summary = "Event summary"; evt.Start = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc); Recur recur = new Recur(); recur.Frequency = Recur.FrequencyType.DAILY; recur.Count = 3; recur.ByDay.Add(new Recur.DaySpecifier(DayOfWeek.Monday)); recur.ByDay.Add(new Recur.DaySpecifier(DayOfWeek.Wednesday)); recur.ByDay.Add(new Recur.DaySpecifier(DayOfWeek.Friday)); evt.AddRecurrence(recur); DDay.iCal.Serialization.iCalendar.DataTypes.RecurSerializer serializer = new DDay.iCal.Serialization.iCalendar.DataTypes.RecurSerializer(recur); Assert.IsTrue(string.Compare(serializer.SerializeToString(), "FREQ=DAILY;COUNT=3;BYDAY=MO,WE,FR") == 0, "Serialized recurrence string is incorrect"); }
public void RECURPARSE6() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); evt.Summary = "Test event"; evt.Start = new Date_Time(2006, 1, 1, 9, 0, 0); evt.Duration = new TimeSpan(1, 0, 0); evt.AddRecurrence(new Recur("Every month on the first sunday, at 5:00PM, and at 7:00PM")); List<Occurrence> occurrences = evt.GetOccurrences( new Date_Time(2006, 1, 1), new Date_Time(2006, 3, 31)); Date_Time[] DateTimes = new Date_Time[] { new Date_Time(2006, 1, 1, 9, 0, 0), new Date_Time(2006, 1, 1, 17, 0, 0), new Date_Time(2006, 1, 1, 19, 0, 0), new Date_Time(2006, 2, 5, 17, 0, 0), new Date_Time(2006, 2, 5, 19, 0, 0), new Date_Time(2006, 3, 5, 17, 0, 0), new Date_Time(2006, 3, 5, 19, 0, 0) }; for (int i = 0; i < DateTimes.Length; i++) Assert.AreEqual(DateTimes[i], occurrences[i].Period.StartTime, "Event should occur on " + DateTimes[i]); Assert.AreEqual( DateTimes.Length, occurrences.Count, "There should be exactly " + DateTimes.Length + " occurrences; there were " + occurrences.Count); }
public void Test3() { IICalendar iCal = new iCalendar(); IEvent evt = iCal.Create<Event>(); evt.Start = new iCalDateTime(2008, 10, 18, 10, 30, 0); evt.Summary = "Test Event"; evt.Duration = TimeSpan.FromHours(1); evt.RecurrenceRules.Add(new RecurrencePattern("RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH")); IDateTime doomsdayDate = new iCalDateTime(2010, 12, 31, 10, 30, 0); IList<Occurrence> allOcc = evt.GetOccurrences(evt.Start, doomsdayDate); foreach (Occurrence occ in allOcc) Console.WriteLine(occ.Period.StartTime.ToString("d") + " " + occ.Period.StartTime.ToString("t")); }
public void RECURPARSE1() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); evt.Summary = "Test event"; evt.Start = new Date_Time(2006, 10, 1, 9, 0, 0); evt.Duration = new TimeSpan(1, 0, 0); evt.AddRecurrence(new Recur("Every 3rd month on the last tuesday and wednesday")); List<Occurrence> occurrences = evt.GetOccurrences( new Date_Time(2006, 10, 1), new Date_Time(2007, 4, 30)); Date_Time[] DateTimes = new Date_Time[] { new Date_Time(2006, 10, 1, 9, 0, 0), new Date_Time(2006, 10, 25, 9, 0, 0), new Date_Time(2006, 10, 31, 9, 0, 0), new Date_Time(2007, 1, 30, 9, 0, 0), new Date_Time(2007, 1, 31, 9, 0, 0), new Date_Time(2007, 4, 24, 9, 0, 0), new Date_Time(2007, 4, 25, 9, 0, 0) }; for (int i = 0; i < DateTimes.Length; i++) Assert.AreEqual(DateTimes[i], occurrences[i].Period.StartTime, "Event should occur on " + DateTimes[i]); Assert.AreEqual( DateTimes.Length, occurrences.Count, "There should be exactly " + DateTimes.Length + " occurrences; there were " + occurrences.Count); }
public void RECURPARSE5() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); evt.Summary = "Test event"; evt.Start = new Date_Time(2006, 1, 1, 9, 0, 0); evt.Duration = new TimeSpan(1, 0, 0); evt.AddRecurrence(new Recur("Every 10 minutes until 1/1/2006 9:50")); List<Occurrence> occurrences = evt.GetOccurrences( new Date_Time(2006, 1, 1), new Date_Time(2006, 1, 31)); Date_Time[] DateTimes = new Date_Time[] { new Date_Time(2006, 1, 1, 9, 0, 0), new Date_Time(2006, 1, 1, 9, 10, 0), new Date_Time(2006, 1, 1, 9, 20, 0), new Date_Time(2006, 1, 1, 9, 30, 0), new Date_Time(2006, 1, 1, 9, 40, 0), new Date_Time(2006, 1, 1, 9, 50, 0) }; for (int i = 0; i < DateTimes.Length; i++) Assert.AreEqual(DateTimes[i], occurrences[i].Period.StartTime, "Event should occur on " + DateTimes[i]); Assert.AreEqual( DateTimes.Length, occurrences.Count, "There should be exactly " + DateTimes.Length + " occurrences; there were " + occurrences.Count); }
public void RRULE43() { iCalendar iCal = new iCalendar(); DDay.iCal.Components.TimeZone tz = iCal.Create<DDay.iCal.Components.TimeZone>(); tz.TZID = "US-Eastern"; tz.Last_Modified = new DateTime(1987, 1, 1, 0, 0, 0, DateTimeKind.Utc); DDay.iCal.Components.TimeZone.TimeZoneInfo standard = new DDay.iCal.Components.TimeZone.TimeZoneInfo(DDay.iCal.Components.TimeZone.STANDARD, tz); standard.Start = new DateTime(1967, 10, 29, 2, 0, 0, DateTimeKind.Utc); standard.AddRecurrence(new Recur("FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10")); standard.TZOffsetFrom = new UTC_Offset("-0400"); standard.TZOffsetTo = new UTC_Offset("-0500"); standard.TimeZoneName = "EST"; DDay.iCal.Components.TimeZone.TimeZoneInfo daylight = new DDay.iCal.Components.TimeZone.TimeZoneInfo(DDay.iCal.Components.TimeZone.DAYLIGHT, tz); daylight.Start = new DateTime(1987, 4, 5, 2, 0, 0, DateTimeKind.Utc); daylight.AddRecurrence(new Recur("FREQ=YEARLY;BYDAY=1SU;BYMONTH=4")); daylight.TZOffsetFrom = new UTC_Offset("-0500"); daylight.TZOffsetTo = new UTC_Offset("-0400"); daylight.TimeZoneName = "EDT"; Event evt = iCal.Create<Event>(); evt.Summary = "Test event"; evt.Start = new Date_Time(2007, 1, 24, 8, 0, 0, tzid, iCal); evt.Duration = TimeSpan.FromHours(1); evt.End = new Date_Time(2007, 1, 24, 9, 0, 0, tzid, iCal); Recur recur = new Recur("FREQ=MONTHLY;INTERVAL=2;BYDAY=4WE"); evt.AddRecurrence(recur); List<Occurrence> occurrences = evt.GetOccurrences( new DateTime(2007, 1, 24), new DateTime(2007, 12, 31)); Date_Time[] DateTimes = new Date_Time[] { new Date_Time(2007, 1, 24, 8, 0, 0, tzid, iCal), new Date_Time(2007, 3, 28, 8, 0, 0, tzid, iCal), new Date_Time(2007, 5, 23, 8, 0, 0, tzid, iCal), new Date_Time(2007, 7, 25, 8, 0, 0, tzid, iCal), new Date_Time(2007, 9, 26, 8, 0, 0, tzid, iCal), new Date_Time(2007, 11, 28, 8, 0, 0, tzid, iCal) }; for (int i = 0; i < DateTimes.Length; i++) Assert.AreEqual(DateTimes[i], occurrences[i].Period.StartTime, "Event should occur on " + DateTimes[i]); Assert.AreEqual( DateTimes.Length, occurrences.Count, "There should be exactly " + DateTimes.Length + " occurrences; there were " + occurrences.Count); }
public void Test1() { IICalendar iCal = new iCalendar(); IEvent evt = iCal.Create<Event>(); evt.Summary = "Event summary"; evt.Start = new iCalDateTime(DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc)); IRecurrencePattern recur = new RecurrencePattern(); evt.RecurrenceRules.Add(recur); try { IList<Occurrence> occurrences = evt.GetOccurrences(DateTime.Today.AddDays(1), DateTime.Today.AddDays(2)); Assert.Fail("An exception should be thrown when evaluating a recurrence with no specified FREQUENCY"); } catch { } }
public void Test2() { IICalendar iCal = new iCalendar(); IEvent evt = iCal.Create<Event>(); evt.Summary = "Event summary"; evt.Start = new iCalDateTime(DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc)); IRecurrencePattern recur = new RecurrencePattern(); recur.Frequency = FrequencyType.Daily; recur.Count = 3; recur.ByDay.Add(new WeekDay(DayOfWeek.Monday)); recur.ByDay.Add(new WeekDay(DayOfWeek.Wednesday)); recur.ByDay.Add(new WeekDay(DayOfWeek.Friday)); evt.RecurrenceRules.Add(recur); RecurrencePatternSerializer serializer = new RecurrencePatternSerializer(); Assert.IsTrue(string.Compare(serializer.SerializeToString(recur), "FREQ=DAILY;COUNT=3;BYDAY=MO,WE,FR") == 0, "Serialized recurrence string is incorrect"); }
public void Bug1821721() { iCalendar iCal = new iCalendar(); iCalTimeZone tz = iCal.Create<iCalTimeZone>(); tz.TZID = "US-Eastern"; tz.LastModified = new iCalDateTime(new DateTime(1987, 1, 1, 0, 0, 0, DateTimeKind.Utc)); ITimeZoneInfo standard = new iCalTimeZoneInfo(Components.STANDARD); standard.Start = new iCalDateTime(new DateTime(1967, 10, 29, 2, 0, 0, DateTimeKind.Utc)); standard.RecurrenceRules.Add(new RecurrencePattern("FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10")); standard.OffsetFrom = new UTCOffset("-0400"); standard.OffsetTo = new UTCOffset("-0500"); standard.TimeZoneName = "EST"; tz.AddChild(standard); ITimeZoneInfo daylight = new iCalTimeZoneInfo(Components.DAYLIGHT); daylight.Start = new iCalDateTime(new DateTime(1987, 4, 5, 2, 0, 0, DateTimeKind.Utc)); daylight.RecurrenceRules.Add(new RecurrencePattern("FREQ=YEARLY;BYDAY=1SU;BYMONTH=4")); daylight.OffsetFrom = new UTCOffset("-0500"); daylight.OffsetTo = new UTCOffset("-0400"); daylight.TimeZoneName = "EDT"; tz.AddChild(daylight); IEvent evt = iCal.Create<Event>(); evt.Summary = "Test event"; evt.Start = new iCalDateTime(2007, 1, 24, 8, 0, 0, tzid); evt.Duration = TimeSpan.FromHours(1); evt.End = new iCalDateTime(2007, 1, 24, 9, 0, 0, tzid); IRecurrencePattern recur = new RecurrencePattern("FREQ=MONTHLY;INTERVAL=2;BYDAY=4WE"); evt.RecurrenceRules.Add(recur); EventOccurrenceTest( iCal, new iCalDateTime(2007, 1, 24), new iCalDateTime(2007, 12, 31), new iCalDateTime[] { new iCalDateTime(2007, 1, 24, 8, 0, 0, tzid), new iCalDateTime(2007, 3, 28, 8, 0, 0, tzid), new iCalDateTime(2007, 5, 23, 8, 0, 0, tzid), new iCalDateTime(2007, 7, 25, 8, 0, 0, tzid), new iCalDateTime(2007, 9, 26, 8, 0, 0, tzid), new iCalDateTime(2007, 11, 28, 8, 0, 0, tzid) }, null ); }
public void EVALUATE1() { iCalendar iCal = new iCalendar(); Event evt = iCal.Create<Event>(); evt.Summary = "Event summary"; // Start at midnight, UTC time evt.Start = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc); evt.AddRecurrence(new Recur("FREQ=MINUTELY;INTERVAL=10;COUNT=5")); List<Occurrence> occurrences = evt.GetOccurrences(DateTime.Today.AddDays(1), DateTime.Today.AddDays(2)); foreach (Occurrence o in occurrences) Assert.IsTrue(o.Period.StartTime.HasTime, "All recurrences of this event should have a time set."); }
static public Event Create(iCalendar iCal) { Event evt = (Event)iCal.Create(iCal, "VEVENT"); evt.UID = UniqueComponent.NewUID(); evt.Created = DateTime.Now; evt.DTStamp = DateTime.Now; return evt; }
static public Todo Create(iCalendar iCal) { Todo t = iCal.Create<Todo>(); return t; }