internal bool Parse(CalendarParameterReader parameterReader)
        {
            this.parameterId   = parameterReader.ParameterId;
            this.parameterName = parameterReader.Name;
            this.value         = null;
            List <object> list = new List <object>();

            while (parameterReader.ReadNextValue())
            {
                if (this.value == null)
                {
                    this.value = parameterReader.ReadValue();
                }
                else if (list == null)
                {
                    list = new List <object>();
                    list.Add(this.value);
                    this.value = list;
                }
                else
                {
                    list.Add(this.value);
                }
            }
            return(this.value != null);
        }
        internal bool Parse(CalendarPropertyReader propertyReader)
        {
            this.calendarPropertyId = new CalendarPropertyId(propertyReader.PropertyId, propertyReader.Name);
            this.value      = null;
            this.valueType  = propertyReader.ValueType;
            this.parameters = new List <CalendarParameter>();
            CalendarParameterReader parameterReader = propertyReader.ParameterReader;

            while (parameterReader.ReadNextParameter())
            {
                CalendarParameter calendarParameter = new CalendarParameter();
                if (!calendarParameter.Parse(parameterReader) || !this.ProcessParameter(calendarParameter))
                {
                    return(false);
                }
                this.parameters.Add(calendarParameter);
            }
            this.valueType = propertyReader.ValueType;
            SchemaInfo schemaInfo;

            if (VEvent.GetConversionSchema().TryGetValue(this.calendarPropertyId.Key, out schemaInfo) && schemaInfo.IsMultiValue)
            {
                List <object> list = new List <object>();
                while (propertyReader.ReadNextValue())
                {
                    object item = this.ReadValue(propertyReader);
                    list.Add(item);
                }
                this.value = list;
            }
            else
            {
                this.value = this.ReadValue(propertyReader);
            }
            return(this.Validate());
        }
 internal void Load(CalendarReader reader, Charset charset)
 {
     while (reader.ReadNextComponent())
     {
         if (ComponentId.VEvent == reader.ComponentId)
         {
             CalendarPropertyReader propertyReader = reader.PropertyReader;
             while (propertyReader.ReadNextProperty())
             {
                 PropertyId propertyId = propertyReader.PropertyId;
                 if (this.dirty.ContainsKey(propertyId) && !this.properties.ContainsKey(propertyId))
                 {
                     if (PropertyId.Description == propertyId || PropertyId.Comment == propertyId)
                     {
                         byte[] array = null;
                         TemporaryDataStorage temporaryDataStorage = new TemporaryDataStorage();
                         using (Stream stream = temporaryDataStorage.OpenWriteStream(true))
                         {
                             using (Stream valueReadStream = propertyReader.GetValueReadStream())
                             {
                                 DataStorage.CopyStreamToStream(valueReadStream, stream, long.MaxValue, ref array);
                             }
                         }
                         BodyData bodyData = new BodyData();
                         bodyData.SetFormat(BodyFormat.Text, InternalBodyFormat.Text, charset);
                         bodyData.SetStorage(temporaryDataStorage, 0L, long.MaxValue);
                         temporaryDataStorage.Release();
                         this.properties[propertyId] = bodyData;
                     }
                     else if (PropertyId.Attendee == propertyId)
                     {
                         CalendarParameterReader parameterReader = propertyReader.ParameterReader;
                         while (parameterReader.ReadNextParameter())
                         {
                             if (parameterReader.ParameterId == ParameterId.ParticipationStatus)
                             {
                                 this.properties[propertyId] = parameterReader.ReadValue();
                             }
                         }
                     }
                     else
                     {
                         this.properties[propertyId] = propertyReader.ReadValue();
                     }
                 }
             }
         }
         if (ComponentId.VCalendar == reader.ComponentId)
         {
             CalendarPropertyReader propertyReader2 = reader.PropertyReader;
             while (propertyReader2.ReadNextProperty())
             {
                 PropertyId propertyId2 = propertyReader2.PropertyId;
                 if (PropertyId.Method == propertyId2)
                 {
                     this.properties[propertyId2] = propertyReader2.ReadValue();
                 }
             }
         }
     }
 }