Beispiel #1
0
        /// <summary>
        /// <para>
        /// This method merges the standard metadata properties of a referring item
        /// and the metadat properties of an underlying item.
        /// </para>
        /// </summary>
        /// <param name="baseProps">metadata properties of this/referring item</param>
        /// <param name="refProps">metadata properties of the underlying/referred item</param>
        /// <returns></returns>
        private MediaProperties MergeProperties(IMediaProperties baseProps, IMediaProperties refProps)
        {
            MediaProperties mergedProps = new MediaProperties();

            ICollection basePropNames = baseProps.PropertyNames;
            ICollection refPropNames  = refProps.PropertyNames;

            // The referring item's metadata is always appended to the
            // underlying item's metadata.
            //
            foreach (string basePropName in basePropNames)
            {
                ArrayList al = this.GetMergedValues(basePropName, mergedProps, baseProps);
                mergedProps[basePropName] = al;
            }

            foreach (string refPropName in refPropNames)
            {
                ArrayList al = this.GetMergedValues(refPropName, mergedProps, refProps);
                mergedProps[refPropName] = al;
            }


            return(mergedProps);
        }
 /// <summary>
 /// Method executes when m_Properties.OnMetadataChanged fires.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="stateNumber"></param>
 protected override void Sink_OnMediaPropertiesChanged(MediaProperties sender, int stateNumber)
 {
     base.UpdateCache();
     this.NotifyRootOfChange();
 }
 /// <summary>
 /// Special ISerializable constructor.
 /// Do basic initialization and then serialize from the info object.
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected MediaObject(SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
     System.Threading.Interlocked.Increment(ref ObjectCounter);
     //OpenSource.Utilities.InstanceTracker.Add(this);
     Init();
     this.m_bools = (BitArray) info.GetValue("m_bools", typeof(BitArray));
     this.m_Desc = (ArrayList) info.GetValue("m_Desc", typeof(ArrayList));
     this.m_ID = info.GetString("m_ID");
     this.m_Properties = (MediaProperties) info.GetValue("m_Properties", typeof(MediaProperties));
     this.m_Resources = (ArrayList) info.GetValue("m_Resources", typeof(ArrayList));
     this._Tag = info.GetValue("_Tag", typeof(object));
 }
        /// <summary>
        /// Completely clears the media object of its
        /// reources and properties.
        /// </summary>
        private void ResetProperties()
        {
            if (this.m_Properties != null)
            {
                this.m_Properties.ClearProperties();
            }
            else
            {
                this.m_Properties = new MediaProperties();
                this.m_Properties.OnMetadataChanged += new MediaProperties.Delegate_OnMetadataChanged(this.Sink_OnMediaPropertiesChanged);
            }

            try
            {
                //this.m_LockDesc.AcquireWriterLock(-1);
                this.m_Properties.RWLock.AcquireWriterLock(-1);
                this.m_Desc = null;
            }
            finally
            {
                //this.m_LockDesc.ReleaseWriterLock();
                this.m_Properties.RWLock.ReleaseWriterLock();
            }
        }
 /// <summary>
 /// Method executes when m_Properties.OnMetadataChanged fires.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="stateNumber"></param>
 protected virtual void Sink_OnMediaPropertiesChanged(MediaProperties sender, int stateNumber)
 {
     this.UpdateCache();
 }
Beispiel #6
0
		/// <summary>
		/// <para>
		/// This method merges the standard metadata properties of a referring item 
		/// and the metadat properties of an underlying item.
		/// </para>
		/// </summary>
		/// <param name="baseProps">metadata properties of this/referring item</param>
		/// <param name="refProps">metadata properties of the underlying/referred item</param>
		/// <returns></returns>
		private MediaProperties MergeProperties(IMediaProperties baseProps, IMediaProperties refProps)
		{
			MediaProperties mergedProps = new MediaProperties();

			ICollection basePropNames = baseProps.PropertyNames;
			ICollection refPropNames = refProps.PropertyNames;

			// The referring item's metadata is always appended to the
			// underlying item's metadata.
			// 
			foreach (string basePropName in basePropNames)
			{
				ArrayList al = this.GetMergedValues(basePropName, mergedProps, baseProps);
				mergedProps[basePropName] = al;
			}

			foreach (string refPropName in refPropNames)
			{
				ArrayList al = this.GetMergedValues(refPropName, mergedProps, refProps);
				mergedProps[refPropName] = al;
			}


			return mergedProps;
		}