Exemplo n.º 1
0
 private void Weave(Pointcut pointcut)
 {
     if (this.m_Dictionary.ContainsKey(pointcut))
     {
         return;
     }
     lock (Aspect.Resource)
     {
         this.m_Weaving.Add(new Weave(this, pointcut));
         this.m_Dictionary.Add(pointcut, new Aspect.Listener(this, pointcut));
     }
 }
Exemplo n.º 2
0
            public Listener(Aspect aspect, Pointcut pointcut)
            {
                this.m_Aspect   = aspect;
                this.m_Pointcut = pointcut;
                var _listener = new Listener <MethodBase>(_Method =>
                {
                    if (this.m_Pointcut.Match(_Method))
                    {
                        aspect.Weave(_Method);
                    }
                });

                this.m_Audition = Metadata.Functions.Accept(_listener);
            }
Exemplo n.º 3
0
 private void Release(Pointcut pointcut)
 {
     if (this.m_Dictionary.TryGetValue(pointcut, out var _listener))
     {
         _listener.Dispose();
         lock (Aspect.Resource)
         {
             foreach (var _weaving in this.m_Weaving.Where(_Weaving => _Weaving.Pointcut == pointcut).ToArray())
             {
                 this.m_Weaving.Remove(_weaving);
             }
             this.m_Dictionary.Remove(pointcut);
             foreach (var _connection in this.m_Network.Where(_Connection => _Connection.Aspect == this && pointcut.Match(_Connection.Method)).ToArray())
             {
                 this.m_Network.Remove(_connection);
             }
         }
     }
 }
Exemplo n.º 4
0
 internal Weave(Aspect aspect, Pointcut pointcut)
 {
     this.m_Aspect   = aspect;
     this.m_Pointcut = pointcut;
 }