Esempio n. 1
0
        ///////////////////////////////////////////////////////////////////////
        #region Public Methods

        /// <summary>
        /// Adds a new offset to the collection.
        /// </summary>
        /// <param name="value">The offset value.</param>
        /// <param name="type">The offset type.</param>
        public int Add(int value, TsCHdaRelativeTime type)
        {
            TsCHdaTimeOffset offset = new TsCHdaTimeOffset {
                Value = value, Type = type
            };

            return(base.Add(offset));
        }
Esempio n. 2
0
        /// <summary>
        /// Returns a String that represents the current Object.
        /// </summary>
        /// <returns>A String that represents the current Object.</returns>
        public override string ToString()
        {
            StringBuilder buffer = new StringBuilder(256);

            foreach (TsCHdaTimeOffset offset in (ICollection)this)
            {
                if (offset.Value >= 0)
                {
                    buffer.Append("+");
                }

                buffer.AppendFormat("{0}", offset.Value);
                buffer.Append(TsCHdaTimeOffset.OffsetTypeToString(offset.Type));
            }

            return(buffer.ToString());
        }
Esempio n. 3
0
        ///////////////////////////////////////////////////////////////////////
        #region Private Methods

        /// <summary>
        /// Creates a new offset object from the components extracted from a string.
        /// </summary>
        private static TsCHdaTimeOffset CreateOffset(bool positive, int magnitude, string units)
        {
            foreach (TsCHdaRelativeTime offsetType in Enum.GetValues(typeof(TsCHdaRelativeTime)))
            {
                if (offsetType == TsCHdaRelativeTime.Now)
                {
                    continue;
                }

                if (units == TsCHdaTimeOffset.OffsetTypeToString(offsetType))
                {
                    TsCHdaTimeOffset offset = new TsCHdaTimeOffset {
                        Value = (positive) ? magnitude : -magnitude, Type = offsetType
                    };

                    return(offset);
                }
            }

            throw new ArgumentOutOfRangeException("units", units, "String is not a valid offset time type.");
        }
Esempio n. 4
0
 /// <summary>
 /// Adds an item to the IList.
 /// </summary>
 /// <param name="value">The Object to add to the IList. </param>
 /// <returns>The position into which the new element was inserted.</returns>
 public int Add(TsCHdaTimeOffset value)
 {
     return(Add((object)value));
 }
Esempio n. 5
0
 /// <summary>
 /// Determines the index of a specific item in the IList.
 /// </summary>
 /// <param name="value">The Object to locate in the IList.</param>
 /// <returns>The index of value if found in the list; otherwise, -1.</returns>
 public int IndexOf(TsCHdaTimeOffset value)
 {
     return(IndexOf((object)value));
 }
Esempio n. 6
0
 /// <summary>
 /// Determines whether the IList contains a specific value.
 /// </summary>
 /// <param name="value">The Object to locate in the IList.</param>
 /// <returns>true if the Object is found in the IList; otherwise, false.</returns>
 public bool Contains(TsCHdaTimeOffset value)
 {
     return(Contains((object)value));
 }
Esempio n. 7
0
 /// <summary>
 /// Removes the first occurrence of a specific object from the IList.
 /// </summary>
 /// <param name="value">The Object to remove from the IList.</param>
 public void Remove(TsCHdaTimeOffset value)
 {
     Remove((object)value);
 }
Esempio n. 8
0
        ///////////////////////////////////////////////////////////////////////
        #region IList Members

        /// <summary>
        /// Inserts an item to the IList at the specified position.
        /// </summary>
        /// <param name="index">The zero-based index at which value should be inserted.</param>
        /// <param name="value">The Object to insert into the IList. </param>
        public void Insert(int index, TsCHdaTimeOffset value)
        {
            Insert(index, (object)value);
        }