コード例 #1
0
        public override object Deserialize(TextReader tr)
        {
            if (tr == null)
            {
                return(null);
            }

            using (tr)
            {
                var ctx      = SerializationContext;
                var contents = tr.ReadToEnd();

                using (var normalized = TextUtil.Normalize(contents, ctx))
                {
                    var lexer  = new IcalLexer(normalized);
                    var parser = new IcalParser(lexer);

                    // Parse the iCalendar(s)!
                    var iCalendars = parser.icalendar(SerializationContext);

                    // Return the parsed iCalendar(s)
                    return(iCalendars);
                }
            }
        }
コード例 #2
0
        public override object Deserialize(TextReader tr)
        {
            if (tr == null)
            {
                return(null);
            }

            using (tr)
            {
                var ctx      = SerializationContext;
                var contents = tr.ReadToEnd();

                using (var normalized = TextUtil.Normalize(contents, ctx))
                {
                    // Create a lexer for our text stream
                    var lexer  = new IcalLexer(normalized);
                    var parser = new IcalParser(lexer);

                    // Get a serializer factory from our serialization services
                    var sf = GetService <ISerializerFactory>();

                    // Get a calendar component factory from our serialization services
                    var cf = GetService <ICalendarComponentFactory>();

                    var parsedComponent = parser.component(ctx, sf, cf, null);
                    return(parsedComponent);
                }
            }
        }
コード例 #3
0
 public override object Deserialize(TextReader tr)
 {
     using (tr)
     {
         var lexer  = new IcalLexer(tr);
         var parser = new IcalParser(lexer);
         var p      = parser.parameter(SerializationContext, null);
         return(p);
     }
 }
コード例 #4
0
ファイル: EventParser.cs プロジェクト: ovravna/PU_Application
        public static ObservableRangeCollection <Item> Parse(string username)
        {
            var items    = IcalParser.Parse(username);
            var lectures = HtmlReader.GetLectures(username);

            foreach (var item in items)
            {
                var idNum = item.Id.Split('-')[1];
                item.Lecture = lectures[idNum];
                item.MazeUrl = item.Lecture.mazeUrl.Replace("&amp;", "&") + "&newtablink=false";
                item.Time    = item.Lecture.tid;
                item.Day     = item.Lecture.day;
                item.Room    = item.Lecture.rom;
            }

            return(items);
        }