Exemple #1
0
        /// <summary>
        /// Allows retrieving common properties through
        /// CommonPropertyNames enumerator.
        /// <para>
        /// The set operation for this indexer will throw an
        /// <see cref="ApplicationException"/> if the
        /// caller does not have the same namespace
        /// and assembly as this class.
        /// </para>
        /// <para>
        /// This property is effectively the same as the
        /// other indexer that takes a string.
        /// </para>
        /// </summary>
        /// <exception cref="ApplicationException">
        /// Thrown on a set-operation if the caller does
        /// is not defined in the same assembly and
        /// namespace as this class.
        /// </exception>
        public IList this[CommonPropertyNames prop]
        {
            get
            {
                IList retVal = null;

                int i = (int)prop;
                if (prop < CommonPropertyNames.DoNotUse)
                {
                    retVal = (IList)this[T[(_UPNP)i]];
                }
                else if (prop > CommonPropertyNames.DoNotUse)
                {
                    retVal = (IList)this[T[(_DC)i]];
                }

                return(retVal);
            }
            set
            {
                int i = (int)prop;
                if (prop < CommonPropertyNames.DoNotUse)
                {
                    this[T[(_UPNP)i]] = value;
                }
                else if (prop > CommonPropertyNames.DoNotUse)
                {
                    this[T[(_DC)i]] = value;
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Allows easy retrieval of strings formatted both with
 /// namespace and element name, given a value
 /// from the <see cref="CommonPropertyNames"/>
 /// enumerator.
 /// </summary>
 public string this[CommonPropertyNames tag]
 {
     get
     {
         StringBuilder sb = new StringBuilder(25);
         string        ns = "";
         if (tag > CommonPropertyNames.DoNotUse)
         {
             ns = "dc:";
         }
         else if (tag < CommonPropertyNames.DoNotUse)
         {
             ns = "upnp:";
         }
         else
         {
             throw new Exception("Bad Evil. Improper value used to index Tags.");
         }
         if (tag == CommonPropertyNames.Class)
         {
             sb.AppendFormat("{1}{0}", "class", ns);
         }
         else
         {
             sb.AppendFormat("{1}{0}", tag.ToString(), ns);
         }
         return(sb.ToString());
     }
 }
        /// <summary>
        /// Allows retrieving common properties through 
        /// CommonPropertyNames enumerator.
        /// <para>
        /// The set operation for this indexer will throw an
        /// <see cref="ApplicationException"/> if the
        /// caller does not have the same namespace
        /// and assembly as this class.
        /// </para>
        /// <para>
        /// This property is effectively the same as the
        /// other indexer that takes a string.
        /// </para>
        /// </summary>
        /// <exception cref="ApplicationException">
        /// Thrown on a set-operation if the caller does
        /// is not defined in the same assembly and
        /// namespace as this class.
        /// </exception>
        public IList this[CommonPropertyNames prop]
        {
            get
            {
                IList retVal = null;

                int i = (int)prop;
                if (prop < CommonPropertyNames.DoNotUse)
                {
                    retVal = (IList)this[T[(_UPNP)i]];
                }
                else if (prop > CommonPropertyNames.DoNotUse)
                {
                    retVal = (IList)this[T[(_DC)i]];
                }

                return retVal;
            }
            set
            {
                int i = (int)prop;
                if (prop < CommonPropertyNames.DoNotUse)
                {
                    this[T[(_UPNP)i]] = value;
                }
                else if (prop > CommonPropertyNames.DoNotUse)
                {
                    this[T[(_DC)i]] = value;
                }
            }
        }
Exemple #4
0
		/// <summary>
		/// Allows easy retrieval of strings formatted both with
		/// namespace and element name, given a value
		/// from the <see cref="CommonPropertyNames"/>
		/// enumerator.
		/// </summary>
		public string this[CommonPropertyNames tag]
		{
			get
			{
				StringBuilder sb = new StringBuilder(25);
				string ns = "";
				if (tag > CommonPropertyNames.DoNotUse)
				{
					ns = "dc:";
				}
				else if (tag < CommonPropertyNames.DoNotUse)
				{
					ns = "upnp:";
				}
				else
				{
					throw new Exception("Bad Evil. Improper value used to index Tags.");
				}
				if (tag == CommonPropertyNames.Class)
				{
					sb.AppendFormat("{1}{0}", "class", ns);
				}
				else
				{
					sb.AppendFormat("{1}{0}", tag.ToString(), ns);
				}
				return sb.ToString();
			}
		}