public void ComponentEndHandler( Object sender, iCalParserEventArgs args ) { if( this.Parent != null ){ this.Parent.AddChild( this.Current ); } this.Current = this.Current.Parent; this.Parent = this.Current.Parent; }
public void ComponentStartHandler( Object sender, iCalParserEventArgs args ) { iCalLineContent content = args.Content; this.Parent = this.Current; this.Current = factory.Create( content.Value ); this.Current.Parent = this.Parent; }
public iCalendarCollection ParseStream(TextReader reader) { iCalSimpleParser sParser = new iCalSimpleParser(); sParser.ComponentStart += this.ComponentStartHandler; sParser.ComponentEnd += this.ComponentEndHandler; sParser.Property += this.PropertyHandler; this.Collection = new iCalendarCollection(); this.Current = this.Collection; this.Parent = null; this.factory = new iCalComponentFactory(); sParser.ParseStream( reader ); return this.Collection; }
public override void AddChild( iCalComponent child ){ if( child is iCalEvent ){ this.EventList.Add( (iCalEvent)child ); } else if( child is iCalToDo ){ this.ToDoList.Add( (iCalToDo)child ); } else if( child is iCalJournal ){ this.JournalList.Add( (iCalJournal)child ); } else if( child is iCalFreeBusy ){ this.FreeBusyList.Add( (iCalFreeBusy) child ); } else if( child is iCalTimeZone ){ iCalTimeZone timezone = (iCalTimeZone)child; String id = timezone.TimeZoneId.Value; this.TimeZones[ id ] = timezone; } else { this.OtherList.Add( child ); } }
public iCalendarCollection ParseFile( String filename ) { iCalSimpleParser sParser = new iCalSimpleParser(); sParser.ComponentStart += this.ComponentStartHandler; sParser.ComponentEnd += this.ComponentEndHandler; sParser.Property += this.PropertyHandler; this.Collection = new iCalendarCollection(); this.Current = this.Collection; this.Parent = null; this.factory = new iCalComponentFactory(); sParser.ParseFile( filename ); return this.Collection; }
public override void AddChild( iCalComponent child ){ iCalendar calendar = child as iCalendar; if( calendar != null ){ this.CalendarList.Add( calendar ); } }