Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 4
0
        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);
        }