public bool Remove(Guid pluginId)
        {
            PluginRequirement req = Find(pluginId) as PluginRequirement;

            if (req != null)
            {
                Debug.Assert(req.Holder == this);
                if (!CanChange(ChangeStatus.Delete, req.PluginId, req.Requirement))
                {
                    return(false);
                }
                if (_first == req)
                {
                    _first = req.NextElement;
                }
                else
                {
                    this.First(r => r.NextElement == req).NextElement = req.NextElement;
                }
                req.Holder = null;
                --_count;
                Change(ChangeStatus.Delete, req.PluginId, req.Requirement);
            }
            return(true);
        }
        public IEnumerator <PluginRequirement> GetEnumerator()
        {
            PluginRequirement e = _first;

            while (e != null)
            {
                yield return(e);

                e = e.NextElement;
            }
        }
 public bool Clear()
 {
     if (!CanChange(ChangeStatus.ContainerClear, Guid.Empty, RunningRequirement.Optional))
     {
         return(false);
     }
     foreach (PluginRequirement r in this)
     {
         r.Holder = null;
     }
     _first = null;
     _count = 0;
     Change(ChangeStatus.ContainerClear, Guid.Empty, RunningRequirement.Optional);
     return(true);
 }
 public PluginRequirement AddOrSet( Guid pluginID, RunningRequirement requirement )
 {
     PluginRequirement req = this.FirstOrDefault( r => r.PluginId == pluginID );
     if( req != null ) 
     {
         if( req.Requirement != requirement && CanChange( ChangeStatus.Update, pluginID, requirement ) )
         {
             req.Requirement = requirement;
             Change( ChangeStatus.Update, pluginID, requirement );
         }
     }
     else if( CanChange( ChangeStatus.Add, pluginID, requirement ) )
     {
         req = new PluginRequirement( this, pluginID, requirement );
         req.NextElement = _first;
         _first = req;
         _count++;
         Change( ChangeStatus.Add, pluginID, requirement );
     }
     return req;
 }
        public PluginRequirement AddOrSet(Guid pluginID, RunningRequirement requirement)
        {
            PluginRequirement req = this.FirstOrDefault(r => r.PluginId == pluginID);

            if (req != null)
            {
                if (req.Requirement != requirement && CanChange(ChangeStatus.Update, pluginID, requirement))
                {
                    req.Requirement = requirement;
                    Change(ChangeStatus.Update, pluginID, requirement);
                }
            }
            else if (CanChange(ChangeStatus.Add, pluginID, requirement))
            {
                req             = new PluginRequirement(this, pluginID, requirement);
                req.NextElement = _first;
                _first          = req;
                _count++;
                Change(ChangeStatus.Add, pluginID, requirement);
            }
            return(req);
        }
 public bool Remove( Guid pluginId )
 {
     PluginRequirement req = Find( pluginId ) as PluginRequirement;
     if( req != null )
     {
         Debug.Assert( req.Holder == this );
         if( !CanChange( ChangeStatus.Delete, req.PluginId, req.Requirement ) ) return false;
         if( _first == req ) _first = req.NextElement;
         else this.First( r => r.NextElement == req ).NextElement = req.NextElement;
         req.Holder = null;
         --_count;
         Change( ChangeStatus.Delete, req.PluginId, req.Requirement );
     }
     return true;
 }
 public bool Clear()
 {
     if( !CanChange( ChangeStatus.ContainerClear, Guid.Empty, RunningRequirement.Optional ) ) return false;
     foreach( PluginRequirement r in this ) r.Holder = null;
     _first = null;
     _count = 0;
     Change( ChangeStatus.ContainerClear, Guid.Empty, RunningRequirement.Optional );
     return true;
 }
        public bool Contains(object item)
        {
            PluginRequirement e = item as PluginRequirement;

            return(e != null ? e.Holder == this : false);
        }