• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Serialization.iCalendarSerializer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DDay.iCal.Serialization.iCalendarSerializer的典型用法代码示例。如果您正苦于以下问题:C# iCalendarSerializer类的具体用法?C# iCalendarSerializer怎么用?C# iCalendarSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



iCalendarSerializer类属于DDay.iCal.Serialization命名空间,在下文中一共展示了iCalendarSerializer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RulesetValidator

        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);
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:25,代码来源:RulesetValidator.cs


示例2: SerializeTest

        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);
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:13,代码来源:Serialize.cs


示例3: SerializeTest

        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);
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:16,代码来源:Serialize.cs


示例4: Main

        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");
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:20,代码来源:Program.cs


示例5: Main

        /// <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));
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:44,代码来源:Program.cs


示例6: WriteFile

        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);
        }
开发者ID:jasonlin,项目名称:dapperDinner,代码行数:21,代码来源:iCalResult.cs


示例7: Main

        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);
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:23,代码来源:Program.cs


示例8: SERIALIZE17

        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));
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:14,代码来源:Serialize.cs


示例9: SERIALIZE18

        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");
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:27,代码来源:Serialize.cs


示例10: Bug3512192

        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);
        }
开发者ID:nachocove,项目名称:DDay-iCal-Xamarin,代码行数:34,代码来源:SerializationTest.cs


示例11: SERIALIZE16

        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));
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:20,代码来源:Serialize.cs


示例12: ADDEVENT1

        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 = "[email protected]";

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

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\General\Temp\GEO1_Serialized.ics");
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:18,代码来源:Program.cs


示例13: Validate

        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];            
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:92,代码来源:RulesetValidator.cs


示例14: FreeBusy2

        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));
        }
开发者ID:nachocove,项目名称:DDay-iCal-Xamarin,代码行数:27,代码来源:SerializationTest.cs


示例15: TIMEZONE2

        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");
            }
        }
开发者ID:MaitreDede,项目名称:dday-ical,代码行数:45,代码来源:Serialize.cs


示例16: Event5

        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));
        }
开发者ID:nachocove,项目名称:DDay-iCal-Xamarin,代码行数:31,代码来源:SerializationTest.cs


示例17: FreeBusy1

        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));
        }
开发者ID:nachocove,项目名称:DDay-iCal-Xamarin,代码行数:18,代码来源:SerializationTest.cs


示例18: CalendarParameters1

        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));
        }
开发者ID:nachocove,项目名称:DDay-iCal-Xamarin,代码行数:10,代码来源:SerializationTest.cs


示例19: BugFromForumTopic3355446

        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"));
        }
开发者ID:nachocove,项目名称:DDay-iCal-Xamarin,代码行数:20,代码来源:SerializationTest.cs


示例20: Bug3534283

        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));
        }
开发者ID:nachocove,项目名称:DDay-iCal-Xamarin,代码行数:20,代码来源:SerializationTest.cs



注:本文中的DDay.iCal.Serialization.iCalendarSerializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Framework.Token类代码示例发布时间:2022-05-24
下一篇:
C# DataTypes.iCalDateTime类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap