protected void OnItemRemoved(ICalendarParameter p)
 {
     if (ItemRemoved != null)
     {
         ItemRemoved(this, new ObjectEventArgs <ICalendarParameter>(p));
     }
 }
 public bool Contains(ICalendarParameter item)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
     {
         return(m_AssociatedContainer.Parameters.Contains(item));
     }
     return(m_Parameters.Contains(item));
 }
 public int IndexOf(ICalendarParameter item)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
     {
         return(m_AssociatedContainer.Parameters.IndexOf(item));
     }
     return(m_Parameters.IndexOf(item));
 }
        public bool Remove(ICalendarParameter item)
        {
            int index = IndexOf(item);

            if (index >= 0)
            {
                RemoveAt(index);
                return(true);
            }
            return(false);
        }
 public void Insert(int index, ICalendarParameter item)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
     {
         m_AssociatedContainer.Parameters.Insert(index, item);
     }
     else
     {
         m_Parameters.Insert(index, item);
     }
 }
 public void Add(ICalendarParameter item)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
     {
         m_AssociatedContainer.Parameters.Add(item);
     }
     else
     {
         m_Parameters.Add(item);
     }
 }
示例#7
0
 private void MoveNextParameter()
 {
     m_CurrentListEnumerator = null;
     while (m_ParameterIndex + 1 < m_ParameterList.Count)
     {
         ICalendarParameter p = m_ParameterList[++m_ParameterIndex];
         if (string.Equals(p.Name, m_ParameterName))
         {
             List<string> list = new List<string>(p.Values);                        
             m_CurrentListEnumerator = list.GetEnumerator();
             return;
         }
     }
 }
        public override void CopyFrom(ICopyable c)
        {
            base.CopyFrom(c);

            ICalendarParameter p = c as ICalendarParameter;

            if (p != null)
            {
                if (p.Values != null)
                {
                    _Values = new List <string>(p.Values);
                }
            }
        }
        public override void CopyFrom(ICopyable c)
        {
            base.CopyFrom(c);

            ICalendarParameter p = c as ICalendarParameter;

            if (p != null)
            {
                if (p.Values != null)
                {
                    Values = new string[p.Values.Length];
                    Array.Copy(p.Values, Values, p.Values.Length);
                }
            }
        }
示例#10
0
        public void RemoveAt(int index)
        {
            if (IsReadOnly)
                throw new NotSupportedException();
            if (index < 0 || index >= Count)
                throw new ArgumentOutOfRangeException("index");

            int parameterIndex, indexInParameter;
            ICalendarParameter p = ParameterForIndex(index, out parameterIndex, out indexInParameter);
            if (p != null)
            {
                List<string> values = new List<string>(p.Values);
                values.RemoveAt(indexInParameter);
                p.Values = values.ToArray();
            }
        }
示例#11
0
        public override object Deserialize(TextReader tr)
        {
            // Create a lexer for our text stream
            iCalLexer  lexer  = new iCalLexer(tr);
            iCalParser parser = new iCalParser(lexer);

            // Get our serialization context
            ISerializationContext ctx = SerializationContext;

            // Parse the component!
            ICalendarParameter p = parser.parameter(ctx, null);

            // Close our text stream
            tr.Close();

            // Return the parsed parameter
            return(p);
        }
示例#12
0
        public override string SerializeToString(object obj)
        {
            ICalendarParameter p = obj as ICalendarParameter;

            if (p != null)
            {
                string result = p.Name + "=";
                string value  = string.Join(",", p.Values);
                // Surround the parameter value with double quotes, if the value
                // contains any problematic characters.
                if (value.IndexOfAny(new char[] { '"', ';', ':', ',' }) >= 0)
                {
                    value = "\"" + value + "\"";
                }
                return(result + value);
            }
            return(string.Empty);
        }
示例#13
0
        public override string SerializeToString(object obj)
        {
            ICalendarParameter p = obj as ICalendarParameter;

            if (p != null)
            {
                string result = p.Name + "=";
                string value  = string.Join(",", p.Values);

                // "Section 3.2:  Property parameter values MUST NOT contain the DQUOTE character."
                // Therefore, let's strip any double quotes from the value.
                value = value.Replace("\"", string.Empty);

                // Surround the parameter value with double quotes, if the value
                // contains any problematic characters.
                if (value.IndexOfAny(new char[] { ';', ':', ',' }) >= 0)
                {
                    value = "\"" + value + "\"";
                }
                return(result + value);
            }
            return(string.Empty);
        }
示例#14
0
 public string this[int index]
 {
     get
     {
         int parameterIndex, indexInParameter;
         ICalendarParameter p = ParameterForIndex(index, out parameterIndex, out indexInParameter);
         if (p != null)
             return p.Values[indexInParameter];
         return null;
     }
     set
     {
         int parameterIndex, indexInParameter;
         ICalendarParameter p = ParameterForIndex(index, out parameterIndex, out indexInParameter);
         if (p != null)
         {
             List<string> values = new List<string>(p.Values);
             values[indexInParameter] = value;
             p.Values = values.ToArray();
             // FIXME: Call OnItemAdded()/OnItemRemoved() here?
         }
     }
 }
示例#15
0
 public bool Remove(string value)
 {
     int itemIndex, indexInParameter;
     ICalendarParameter p = ParameterForValue(value, out itemIndex, out indexInParameter);
     if (p != null &&
         p.Values != null)
     {
         if (p.Values.Length == 1 && indexInParameter == 0)
         {
             // Remove the parameter itself
             m_ParameterList.RemoveAt(itemIndex);
         }
         else
         {
             // Remove the value from the parameter
             List<string> values = new List<string>(p.Values);
             values.RemoveAt(indexInParameter);
             p.Values = values.ToArray();
         }
         return true;
     }
     return false;
 }
 public void Add(ICalendarParameter item)
 {
     Parameters.Add(item);
 }
示例#17
0
 /// <summary>
 /// Adds a parameter to the iCalendar object.
 /// </summary>
 virtual public void AddParameter(ICalendarParameter p)
 {
     Parameters.Add(p);
 }
示例#18
0
 /// <summary>
 /// Adds a parameter to the iCalendar object.
 /// </summary>
 virtual public void AddParameter(ICalendarParameter p)
 {
     Parameters.Add(p);
 }
 public void Insert(int index, ICalendarParameter item)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
         m_AssociatedContainer.Parameters.Insert(index, item);
     else
         m_Parameters.Insert(index, item);
 }
 public void Add(ICalendarParameter item)
 {
     Parameters.Add(item);
 }
 public void CopyTo(ICalendarParameter[] array, int arrayIndex)
 {
     Parameters.CopyTo(array, arrayIndex);
 }
 protected void OnItemRemoved(ICalendarParameter p)
 {
     if (ItemRemoved != null)
         ItemRemoved(this, new ObjectEventArgs<ICalendarParameter>(p));
 }
 public void Insert(int index, ICalendarParameter item)
 {
     Parameters.Insert(index, item);
 }
 public void CopyTo(ICalendarParameter[] array, int arrayIndex)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
         m_AssociatedContainer.Parameters.CopyTo(array, arrayIndex);
     else
         m_Parameters.CopyTo(array, arrayIndex);
 }
 public bool Contains(ICalendarParameter item)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
         return m_AssociatedContainer.Parameters.Contains(item);
     return m_Parameters.Contains(item);
 }
 public void Add(ICalendarParameter item)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
         m_AssociatedContainer.Parameters.Add(item);
     else
         m_Parameters.Add(item);
 }
 public void Insert(int index, ICalendarParameter item)
 {
     Parameters.Insert(index, item);
 }
 public int IndexOf(ICalendarParameter item)
 {
     return(Parameters.IndexOf(item));
 }
 public bool Contains(ICalendarParameter item)
 {
     return(Parameters.Contains(item));
 }
 public bool Contains(ICalendarParameter item)
 {
     return Parameters.Contains(item);
 }
示例#31
0
        public ICalendarParameter  parameter(

            ISerializationContext ctx,
            ICalendarParameterCollectionContainer container

            ) //throws RecognitionException, TokenStreamException
        {
            ICalendarParameter p = null;;

            IToken n = null;
            IToken m = null;

            string        v;
            List <string> values = new List <string>();


            {
                switch (LA(1))
                {
                case IANA_TOKEN:
                {
                    n = LT(1);
                    match(IANA_TOKEN);
                    p = new CalendarParameter(n.getText());
                    break;
                }

                case X_NAME:
                {
                    m = LT(1);
                    match(X_NAME);
                    p = new CalendarParameter(m.getText());
                    break;
                }

                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                }
            }

            // Push the parameter onto the serialization context stack
            ctx.Push(p);

            match(EQUAL);
            v = param_value();
            values.Add(v);
            {        // ( ... )*
                for (;;)
                {
                    if ((LA(1) == COMMA))
                    {
                        match(COMMA);
                        v = param_value();
                        values.Add(v);
                    }
                    else
                    {
                        goto _loop30_breakloop;
                    }
                }
                _loop30_breakloop :;
            }        // ( ... )*

            p.SetValue(values);

            if (container != null)
            {
                container.Parameters.Add(p);
            }

            // Notify that the parameter has been loaded
            p.OnLoaded();

            // Pop the parameter off the serialization context stack
            ctx.Pop();

            return(p);
        }
 public bool Remove(ICalendarParameter item)
 {
     int index = IndexOf(item);
     if (index >= 0)
     {
         RemoveAt(index);
         return true;
     }
     return false;
 }
 public int IndexOf(ICalendarParameter item)
 {
     if (m_AssociatedContainer != null &&
         m_AssociatedContainer.Parameters != null)
         return m_AssociatedContainer.Parameters.IndexOf(item);
     return m_Parameters.IndexOf(item);
 }
示例#34
0
 public int IndexOf(string value)
 {
     int itemIndex, indexInParameter;
     ICalendarParameter p = ParameterForValue(value, out itemIndex, out indexInParameter);
     return itemIndex;
 }
 public int IndexOf(ICalendarParameter item)
 {
     return Parameters.IndexOf(item);
 }