Exemplo n.º 1
0
        public RulesetValidator(IValidationRuleset ruleset, string text) :
            this(ruleset)
        {
            iCalendarText = text;

            try
            {
                iCalendarSerializer serializer = new iCalendarSerializer();
                
                // Turn off speed optimization so line/col from
                // antlr are accurate.
                serializer.OptimizeForSpeed = false;

                iCalendar = serializer.Deserialize(new StringReader(text), typeof(iCalendar)) as iCalendar;                
            }
            catch (antlr.RecognitionException ex)
            {
                _RecognitionError = new ValidationErrorWithLookup(
                    "calendarParseError", 
                    ValidationErrorType.Error, 
                    true, 
                    ex.line, 
                    ex.column);
            }
        }
Exemplo n.º 2
0
        private void SerializeTest(string filename, Type iCalType)
        {
            iCalendar iCal1 = iCalendar.LoadFromFile(iCalType, @"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(iCalType, @"Calendars\Serialization\Temp\" + Path.GetFileNameWithoutExtension(filename) + "_Serialized.ics");

            CompareCalendars(iCal1, iCal2);
        }
Exemplo n.º 3
0
        private void SerializeTest(string filename, Type iCalType)
        {
            if (!Directory.Exists(@"Calendars\Serialization\Temp"))
                Directory.CreateDirectory(@"Calendars\Serialization\Temp");
            
            iCalendar iCal1 = iCalendar.LoadFromFile(iCalType, @"Calendars\Serialization\" + filename);
            iCalendarSerializer serializer = new iCalendarSerializer(iCal1);

            Assert.IsTrue(iCal1.Properties.Count > 0, "iCalendar has no properties; did it load correctly?");
            Assert.IsTrue(iCal1.UniqueComponents.Count > 0, "iCalendar has no unique components; it must to be used in SerializeTest(). Did it load correctly?");            

            serializer.Serialize(@"Calendars\Serialization\Temp\" + Path.GetFileNameWithoutExtension(filename) + "_Serialized.ics");
            iCalendar iCal2 = iCalendar.LoadFromFile(iCalType, @"Calendars\Serialization\Temp\" + Path.GetFileNameWithoutExtension(filename) + "_Serialized.ics");

            CompareCalendars(iCal1, iCal2);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            // Create a new iCalendar
            iCalendar iCal = new iCalendar();
            
            // Create the event, and add it to the iCalendar
            Event evt = Event.Create(iCal);

            // Set information about the event
            evt.Start = DateTime.Today;
            evt.End = DateTime.Today.AddDays(1); // This also sets the duration
            evt.DTStamp = DateTime.Now;
            evt.Description = "The event description";
            evt.Location = "Event location";
            evt.Summary = "The summary of the event";
            
            // Serialize (save) the iCalendar
            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"iCalendar.ics");
        }
Exemplo n.º 5
0
        /// <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 = Event.Create(iCal);

            // Set information about the event
            evt.Start = DateTime.Today;
            evt.Start = evt.Start.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 = Event.Create(iCal);
            evt.Start = DateTime.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(iCal);
            serializer.Serialize(@"iCalendar.ics");
            Console.WriteLine("iCalendar file saved." + Environment.NewLine);
            
            // Load the calendar from the file we just saved
            iCal = iCalendar.LoadFromFile(@"iCalendar.ics");
            Console.WriteLine("iCalendar file loaded.");

            // Iterate through each event to display its description
            // (and verify the file saved correctly)
            foreach (Event e in iCal.Events)
                Console.WriteLine("Event loaded: " + GetDescription(e));
        }
Exemplo n.º 6
0
        protected override void WriteFile(System.Web.HttpResponseBase response)
        {
            iCalendar iCal = new iCalendar();
            foreach (Dinner d in this.Dinners)
            {
                try
                {
                    Event e = CalendarHelpers.DinnerToEvent(d, iCal);
                    iCal.Events.Add(e);
                }
                catch (ArgumentOutOfRangeException)
                {
                    //Swallow folks that have dinners in 9999.
                }
            }

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            string result = serializer.SerializeToString();
            response.ContentEncoding = Encoding.UTF8;
            response.Write(result);
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            // Load the example iCalendar file into our CustomICalendar object
            CustomICalendar iCal = iCalendar.LoadFromFile<CustomICalendar>(@"Example4.ics");
                        
            // Set the additional information on our custom events
            Console.WriteLine("Adding additional information to each event from Example4.ics...");
            foreach(CustomEvent evt in iCal.Events)
                evt.AdditionalInformation = "Some additional information we want to save";

            // Serializer our iCalendar
            Console.WriteLine("Saving altered iCalendar to Example4_Serialized.ics...");
            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Example4_Serialized.ics");

            // Load the serialized calendar from the file we just saved,
            // and display the event summary for each event, along
            // with the additional information we saved.
            Console.WriteLine("Loading Example4_Serialized.ics to display saved events...");
            iCal = iCalendar.LoadFromFile<CustomICalendar>(@"Example4_Serialized.ics");
            foreach (CustomEvent evt in iCal.Events)
                Console.WriteLine("\t" + evt.Summary + ": " + evt.AdditionalInformation);
        }
Exemplo n.º 8
0
        public void SERIALIZE17()
        {
            // Create a normal iCalendar, serialize it, and load it as a custom calendar
            iCalendar iCal = new iCalendar();            

            Event evt = iCal.Create<Event>();
            evt.Summary = "Test event";
            evt.Start = new DateTime(2007, 02, 15, 8, 0, 0);            

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\Serialization\SERIALIZE17.ics");

            SerializeTest("SERIALIZE17.ics", typeof(CustomICal1));
        }
Exemplo n.º 9
0
        public void SERIALIZE18()
        {
            iCalendar iCal = new iCalendar();

            Event evt = iCal.Create<Event>();
            evt.Summary = "Test event title";
            evt.Start = new Date_Time(2007, 3, 19);
            evt.Start.Kind = DateTimeKind.Utc;
            evt.Duration = new TimeSpan(24, 0, 0);
            evt.Created = evt.Start.Copy();
            evt.DTStamp = evt.Start.Copy();
            evt.UID = "123456789";
            evt.IsAllDay = true;            

            Recur rec = new Recur("FREQ=WEEKLY;INTERVAL=3;BYDAY=TU,FR,SU;COUNT=4");
            evt.AddRecurrence(rec);

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            string icalString = serializer.SerializeToString();

            Assert.IsNotEmpty(icalString, "iCalendarSerializer.SerializeToString() must not be empty");

            ComponentBaseSerializer compSerializer = new ComponentBaseSerializer(evt);
            string evtString = compSerializer.SerializeToString();

            Assert.IsTrue(evtString.Equals("BEGIN:VEVENT\r\nCREATED:20070319T000000Z\r\nDTEND:20070320T000000Z\r\nDTSTAMP:20070319T000000Z\r\nDTSTART;VALUE=DATE:20070319\r\nDURATION:P1D\r\nRRULE:FREQ=WEEKLY;INTERVAL=3;COUNT=4;BYDAY=TU,FR,SU\r\nSUMMARY:Test event title\r\nUID:123456789\r\nEND:VEVENT\r\n"), "ComponentBaseSerializer.SerializeToString() serialized incorrectly");
        }
        public void Bug3512192()
        {
            IICalendar calendar = new iCalendar();
            calendar.Method = "PUBLISH";
            IEvent evt = calendar.Create<Event>();
            evt.Summary = "Test Event";
            evt.Start = new iCalDateTime(2012, 3, 27, 22, 00, 00);
            evt.Duration = TimeSpan.FromHours(1);

            var attendees = new List<IAttendee>();
            var attendee = new Attendee("MAILTO:[email protected]")
            {
                CommonName = "Test Name",
                Role = "OPT-PARTICIPANT",
                Members = new List<string>() { "Other", "Name" }
            };
            attendees.Add(attendee);
            
            evt.Attendees = attendees;

            // Serialize (save) the iCalendar 
            var serializer = new iCalendarSerializer(calendar);
            var result = serializer.SerializeToString(calendar);

            var calendars = serializer.Deserialize(new StringReader(result)) as IICalendarCollection;
            calendar = calendars.First();
            evt = calendar.Events.First();

            Assert.AreEqual(1, evt.Attendees.Count);
            Assert.AreEqual(attendee, evt.Attendees[0]);
            Assert.AreEqual("Test Name", evt.Attendees[0].CommonName);
            Assert.AreEqual("OPT-PARTICIPANT", evt.Attendees[0].Role);
            Assert.AreEqual(1, evt.Attendees[0].Members.Count);
        }
Exemplo n.º 11
0
        public void SERIALIZE16()
        {
            CustomICal1 iCal = new CustomICal1();
            string nonstandardText = "Some nonstandard property we want to serialize";

            CustomEvent1 evt = iCal.Create<CustomEvent1>();
            evt.Summary = "Test event";
            evt.Start = new DateTime(2007, 02, 15);
            evt.NonstandardProperty = nonstandardText;
            evt.IsAllDay = true;

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\Serialization\SERIALIZE16.ics");

            iCal = iCalendar.LoadFromFile<CustomICal1>(@"Calendars\Serialization\SERIALIZE16.ics");
            foreach (CustomEvent1 evt1 in iCal.Events)
                Assert.IsTrue(evt1.NonstandardProperty.Equals(nonstandardText));

            SerializeTest("SERIALIZE16.ics", typeof(CustomICal1));
        }
Exemplo n.º 12
0
        public void ADDEVENT1()
        {
            iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\General\GEO1.ics");
            Program.TestCal(iCal);

            Event evt = Event.Create(iCal);
            evt.Summary = "Test event";
            evt.Description = "This is an event to see if event creation works";
            evt.Start = new Date_Time(2006, 12, 15, "US-Eastern", iCal);
            evt.Duration = new TimeSpan(1, 0, 0);
            evt.Organizer = "*****@*****.**";

            if (!Directory.Exists(@"Calendars\General\Temp"))
                Directory.CreateDirectory(@"Calendars\General\Temp");

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\General\Temp\GEO1_Serialized.ics");
        }
Exemplo n.º 13
0
        public IValidationResult[] Validate()
        {
            if (Ruleset != null)
            {
                // If no iCalendar was provided, let's ensure it can
                // at least be basically parsed before moving on to
                // more in-depth validation rules.
                if (iCalendar == null &&
                    !string.IsNullOrEmpty(iCalendarText))
                {
                    try
                    {
                        StringReader sr = new StringReader(iCalendarText);
                        
                        // Turn off speed optimization to ensure we get proper
                        // line/column numbers
                        iCalendarSerializer serializer = new iCalendarSerializer();
                        serializer.OptimizeForSpeed = false;

                        iCalendar calendar = serializer.Deserialize(sr, typeof(iCalendar)) as iCalendar;
                    }
                    catch (antlr.MismatchedTokenException ex)
                    {
                        return new IValidationResult[]
                        {
                            new ValidationResult(
                                null, 
                                false,
                                new IValidationError[] { new ValidationErrorWithLookup("calendarParseError", ValidationErrorType.Error, true, ex.line, ex.column) }
                            )
                        };
                    }
                }

                // We've passed a basic parsing test, let's move
                // on to the more complex tests!
                List<IValidationResult> results = new List<IValidationResult>();
                foreach (IValidationRule rule in Ruleset.Rules)
                {
                    IValidator validator = null;

                    Type validatorType = rule.ValidatorType;
                    if (validatorType != null)
                        validator = ValidatorActivator.Create(validatorType, iCalendar, iCalendarText);

                    if (validator == null)
                    {
                        results.Add(
                            new ValidationResult(
                                rule.Name,
                                false,
                                new IValidationError[] { 
                                    new ValidationError(null, "Validator for rule '" + rule.Name + "' could not be determined!")
                                }
                            )
                        );
                    }
                    else
                    {
                        IValidationResult[] currentResults = validator.Validate();
                        results.AddRange(currentResults);

                        // Determine if there were any fatal errors in the results.
                        // If there are, then we need to abort any further processing!
                        bool isFatal = false;
                        foreach (IValidationResult result in currentResults)
                        {                            
                            if (result.Errors != null)
                            {
                                foreach (IValidationError err in result.Errors)
                                {
                                    if (err.IsFatal)
                                    {
                                        isFatal = true;
                                        break;
                                    }
                                }
                            }

                            if (isFatal)
                                break;
                        }

                        if (isFatal)
                            break;
                    }
                }

                return results.ToArray();
            }
            else return new IValidationResult[0];            
        }
        public void FreeBusy2()
        {
            IICalendar iCal = new iCalendar();

            IEvent evt = iCal.Create<Event>();
            evt.Summary = "Test event";
            evt.Start = new iCalDateTime(2010, 10, 1, 8, 0, 0);
            evt.End = new iCalDateTime(2010, 10, 1, 9, 0, 0);

            IAttendee attendee = new Attendee("mailto:[email protected]");
            attendee.ParticipationStatus = ParticipationStatus.Tentative;
            evt.Attendees.Add(attendee);

            IICalendar freeBusyCalendar = new iCalendar();
            IFreeBusy freeBusy = iCal.GetFreeBusy(
                null, 
                new IAttendee[] { new Attendee("mailto:[email protected]") }, 
                new iCalDateTime(2010, 10, 1, 0, 0, 0), 
                new iCalDateTime(2010, 10, 7, 11, 59, 59));

            freeBusyCalendar.AddChild(freeBusy);

            iCalendarSerializer serializer = new iCalendarSerializer();
            serializer.Serialize(freeBusyCalendar, @"Calendars/Serialization/FreeBusy2.ics");

            SerializeTest("FreeBusy2.ics", typeof(iCalendarSerializer));
        }
Exemplo n.º 15
0
        public void TIMEZONE2()
        {
            //
            // First, check against the VALUE parameter; it must be absent in DTSTART
            //

            iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\TIMEZONE2.ics");

            DDay.iCal.Components.TimeZone tz = iCal.TimeZones[0];
            foreach (DDay.iCal.Components.TimeZone.TimeZoneInfo tzi in tz.TimeZoneInfos)
                tzi.Start = new Date_Time(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 (DDay.iCal.Components.TimeZone.TimeZoneInfo 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 (DDay.iCal.Components.TimeZone.TimeZoneInfo 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 (DDay.iCal.Components.TimeZone.TimeZoneInfo 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 void Event5()
        {
            iCalendar iCal = new iCalendar();

            Event evt = iCal.Create<Event>();
            evt.Summary = "Test event title";
            evt.Start = new iCalDateTime(2007, 3, 19);
            evt.Start.IsUniversalTime = true;
            evt.Duration = new TimeSpan(24, 0, 0);
            evt.Created = evt.Start.Copy<IDateTime>();
            evt.DTStamp = evt.Start.Copy<IDateTime>();
            evt.UID = "123456789";
            evt.IsAllDay = true;

            RecurrencePattern rec = new RecurrencePattern("FREQ=WEEKLY;INTERVAL=3;BYDAY=TU,FR,SU;COUNT=4");
            evt.RecurrenceRules.Add(rec);

            iCalendarSerializer serializer = new iCalendarSerializer();
            string icalString = serializer.SerializeToString(iCal);

            Assert.IsFalse(String.Empty == icalString, "iCalendarSerializer.SerializeToString() must not be empty");

            EventSerializer eventSerializer = new EventSerializer();
            string evtString = eventSerializer.SerializeToString(evt);

            var target = "BEGIN:VEVENT\r\nCREATED:20070319T000000Z\r\nDTEND;VALUE=DATE:20070320\r\nDTSTAMP:20070319T000000Z\r\nDTSTART;VALUE=DATE:20070319\r\nRRULE:FREQ=WEEKLY;INTERVAL=3;COUNT=4;BYDAY=TU,FR,SU\r\nSEQUENCE:0\r\nSUMMARY:Test event title\r\nUID:123456789\r\nEND:VEVENT\r\n";
            Assert.AreEqual(target, evtString, "ComponentBaseSerializer.SerializeToString() serialized incorrectly");

            serializer.Serialize(iCal, @"Calendars/Serialization/Event5.ics");
            SerializeTest("Event5.ics", typeof(iCalendarSerializer));
        }
        public void FreeBusy1()
        {
            IICalendar iCal = new iCalendar();

            IEvent evt = iCal.Create<Event>();
            evt.Summary = "Test event";
            evt.Start = new iCalDateTime(2010, 10, 1, 8, 0, 0);
            evt.End = new iCalDateTime(2010, 10, 1, 9, 0, 0);

            IICalendar freeBusyCalendar = new iCalendar();
            IFreeBusy freeBusy = iCal.GetFreeBusy(new iCalDateTime(2010, 10, 1, 0, 0, 0), new iCalDateTime(2010, 10, 7, 11, 59, 59));
            freeBusyCalendar.AddChild(freeBusy);

            iCalendarSerializer serializer = new iCalendarSerializer();
            serializer.Serialize(freeBusyCalendar, @"Calendars/Serialization/FreeBusy1.ics");

            SerializeTest("FreeBusy1.ics", typeof(iCalendarSerializer));
        }
        public void CalendarParameters1()
        {
            IICalendar iCal = new iCalendar();
            iCalendarSerializer serializer = new iCalendarSerializer();
            serializer.Serialize(iCal, @"Calendars/Serialization/CalendarParameters1.ics");

            iCal = iCalendar.LoadFromFile(@"Calendars/Serialization/CalendarParameters1.ics")[0];
            Assert.IsFalse((null == iCal.Version) || (String.Empty == iCal.Version));
            Assert.IsFalse((null == iCal.ProductID) || (String.Empty == iCal.ProductID));
        }
        public void BugFromForumTopic3355446()
        {
            var ical = new iCalendar();
            var evt = ical.Create<Event>();
            
            var altDescProp = new CalendarProperty("X-ALT-DESC");
            altDescProp.AddParameter("FMTTYPE", "text/html");
            altDescProp.Value = "<a href=\"http://test.com\">some html</a>";
            evt.AddProperty(altDescProp);

            evt.Summary = "Test";
            evt.Description = "Test";
            evt.Start = new iCalDateTime(2012, 7, 30, 8, 0, 0);
            evt.Duration = TimeSpan.FromHours(1);

            var serializer = new iCalendarSerializer();
            var serializedString = serializer.SerializeToString(ical);

            Assert.IsTrue(serializedString.Contains("FMTTYPE=text/html"));
        }
        public void Bug3534283()
        {
            IICalendar iCal = new iCalendar();
            var start = new DateTime(2000, 1, 1);
            Event evt = new Event();
            evt.RecurrenceDates.Add(new PeriodList { new Period(new iCalDateTime(start), new iCalDateTime(new DateTime(2000, 1, 2))) });
            evt.Summary = "Testing";
            evt.Start = new iCalDateTime(2010, 3, 25);
            evt.End = new iCalDateTime(2010, 3, 26);

            iCal.Events.Add(evt);

            Assert.That(((IEvent)iCal.Children[0]).RecurrenceDates[0][0].StartTime.Local, Is.EqualTo(start));

            var bar = new iCalendarSerializer().SerializeToString(iCal);

            var foobar = iCalendar.LoadFromStream(new StringReader(bar)).First().Events.First();

            Assert.That(foobar.RecurrenceDates[0][0].StartTime.Local, Is.EqualTo(start));
        }
Exemplo n.º 21
0
        public void REQUIREDPARAMETERS1()
        {
            iCalendar iCal = new iCalendar();
            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\Serialization\Temp\REQUIREDPARAMETERS1.ics");

            iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\Temp\REQUIREDPARAMETERS1.ics");
            Assert.IsNotEmpty(iCal.Version);
            Assert.IsNotEmpty(iCal.ProductID);

            iCal.Version = string.Empty;
            iCal.ProductID = null;
            Assert.IsNotEmpty(iCal.Version, "VERSION is required");
            Assert.IsNotEmpty(iCal.ProductID, "PRODID is required");
        }
        public void Bug3211934()
        {
            var calendar = new iCalendar();
            var serializer = new iCalendarSerializer();

            var filename = "Bug3211934.ics";

            if (File.Exists(filename))
            {
                // Reset the file attributes and delete
                File.SetAttributes(filename, FileAttributes.Normal);
                File.Delete(filename);
            }

            serializer.Serialize(calendar, filename);

            // Set the file as read-only
            File.SetAttributes(filename, FileAttributes.ReadOnly);

            // Load the calendar from file, and ensure the read-only attribute doesn't affect the load
            var calendars = iCalendar.LoadFromFile(filename, Encoding.UTF8, serializer);
            Assert.IsNotNull(calendars);

            // Reset the file attributes and delete
            File.SetAttributes(filename, FileAttributes.Normal);
            File.Delete(filename);
        }
Exemplo n.º 23
0
        public void TIMEZONE1()
        {
            iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\TIMEZONE1.ics");
            
            DDay.iCal.Components.TimeZone tz = iCal.TimeZones[0];
            tz.Last_Modified = new Date_Time(2007, 1, 1);

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\Serialization\Temp\TIMEZONE1.ics");

            iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\Temp\TIMEZONE1.ics");
            tz = iCal.TimeZones[0];

            ContentLine cl = tz.Last_Modified.ContentLine;
            Assert.IsFalse(cl.Parameters.ContainsKey("VALUE"), "The \"VALUE\" parameter is not allowed on \"LAST-MODIFIED\"");
        }
Exemplo n.º 24
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 Bug3177278()
        {
            var calendar = new iCalendar();
            var serializer = new iCalendarSerializer();

            MemoryStream ms = new MemoryStream();
            serializer.Serialize(calendar, ms, Encoding.UTF8);

            Assert.IsTrue(ms.CanWrite);
        }
Exemplo n.º 26
0
        public void SERIALIZE28()
        {
            iCalendar iCal = new iCalendar();
            Event evt = iCal.Create<Event>();
            evt.Summary = "Test event";
            evt.Start = DateTime.Now;
            evt.Duration = TimeSpan.FromMinutes(30);
            evt.Organizer = new Cal_Address("*****@*****.**");
            evt.AddAttendee("*****@*****.**");
            evt.AddAttendee("*****@*****.**");
            evt.AddAttendee("*****@*****.**");

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\Serialization\SERIALIZE28.ics");

            SerializeTest("SERIALIZE28.ics", typeof(iCalendarSerializer));
        }
        public void Attendee3()
        {
            IICalendar iCal = new iCalendar();
            IEvent evt = iCal.Create<Event>();

            evt.Summary = "Test event";
            evt.Start = new iCalDateTime(2010, 7, 3, 8, 0, 0);
            evt.End = new iCalDateTime(2010, 7, 3, 9, 0, 0);

            IAttendee attendee = new Attendee("mailto:[email protected]");
            attendee.Members.Add("mailto:[email protected]");
            evt.Attendees.Add(attendee);

            iCalendarSerializer serializer = new iCalendarSerializer();
            serializer.Serialize(iCal, @"Calendars/Serialization/Attendee3.ics");

            // Ensure the loaded calendar and our original are identical
            IICalendar loadedCalendar = iCalendar.LoadFromFile(@"Calendars/Serialization/Attendee3.ics")[0];
            CompareCalendars(iCal, loadedCalendar);
        }
Exemplo n.º 28
0
        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");
        }
Exemplo n.º 29
0
        public void SERIALIZE20()
        {
            string iCalString = @"BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Computer\, Inc//iCal 1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
CREATED:20070404T211714Z
DTEND:20070407T010000Z
DTSTAMP:20070404T211714Z
DTSTART:20070406T230000Z
DURATION:PT2H
RRULE:FREQ=WEEKLY;UNTIL=20070801T070000Z;BYDAY=FR
SUMMARY:Friday Meetings
DTSTAMP:20040103T033800Z
SEQUENCE:1
UID:fd940618-45e2-4d19-b118-37fd7a8e3906
END:VEVENT
BEGIN:VEVENT
CREATED:20070404T204310Z
DTEND:20070416T030000Z
DTSTAMP:20070404T204310Z
DTSTART:20070414T200000Z
DURATION:P1DT7H
RRULE:FREQ=DAILY;COUNT=12;BYDAY=SA,SU
SUMMARY:Weekend Yea!
DTSTAMP:20040103T033800Z
SEQUENCE:1
UID:ebfbd3e3-cc1e-4a64-98eb-ced2598b3908
END:VEVENT
END:VCALENDAR
";
            StringReader sr = new StringReader(iCalString);
            iCalendar calendar = iCalendar.LoadFromStream(sr);

            Assert.IsTrue(calendar.Events.Count == 2, "There should be 2 events in the loaded iCalendar.");
            Assert.IsNotNull(calendar.Events["fd940618-45e2-4d19-b118-37fd7a8e3906"], "There should be an event with UID: fd940618-45e2-4d19-b118-37fd7a8e3906");
            Assert.IsNotNull(calendar.Events["ebfbd3e3-cc1e-4a64-98eb-ced2598b3908"], "There should be an event with UID: ebfbd3e3-cc1e-4a64-98eb-ced2598b3908");

            iCalendarSerializer serializer = new iCalendarSerializer(calendar);
            serializer.Serialize(@"Calendars\Serialization\SERIALIZE20.ics");

            SerializeTest("SERIALIZE20.ics", typeof(iCalendarSerializer));
        }
        public void Bug3485766()
        {
            IICalendar calendar = new iCalendar();
            IEvent evt = calendar.Create<Event>();
            evt.Start = new iCalDateTime(2012, 5, 23, 8, 0, 0);
            evt.Duration = TimeSpan.FromMinutes(30);

            // Ensure the DTStamp is in universal time to begin with
            Assert.IsTrue(evt.DTStamp.IsUniversalTime);

            // Convert to local time
            evt.DTStamp = new iCalDateTime(evt.DTStamp.Local);

            // Serialize the calendar
            var serializer = new iCalendarSerializer();
            var serialized = serializer.SerializeToString(calendar);
            IICalendarCollection calendars = serializer.Deserialize(new StringReader(serialized)) as IICalendarCollection;
            calendar = calendars.First();
            evt = calendar.Events[0];

            // Ensure the object was serialized as UTC
            Assert.IsTrue(evt.DTStamp.IsUniversalTime);
        }