예제 #1
0
        public TDelegate GetOrDefault(IndirectionInfo info)
        {
            var method = default(TDelegate);

            TryGet(info, out method);
            return(method);
        }
예제 #2
0
        public Work AddOrUpdate(IndirectionInfo info, Work method)
        {
            var holder = LooseCrossDomainAccessor.GetOrRegister <GenericHolder <TaggedBag <BodyOfNonPublicMethod, Dictionary <string, Work> > > >();

            if (holder.Source.Value == null)
            {
                holder.Source = TaggedBagFactory <BodyOfNonPublicMethod> .Make(new Dictionary <string, Work>());
            }

            var dict = holder.Source.Value;

            lock (dict)
            {
                using (InstanceGetters.DisableProcessing())
                {
                    var key = info + "";
                    holder.Source.Value[key] = method;

                    var wrapAndInvoke = CreateWrapAndInvokeMethod(IndirectionDelegate, key);
                    m_holder.AddOrUpdate(info, wrapAndInvoke);

                    dict[key] = method;
                    return(method);
                }
            }
        }
예제 #3
0
        public bool TryRemove(IndirectionInfo info, out Work method)
        {
            method = default(Work);

            var holder = LooseCrossDomainAccessor.GetOrRegister <GenericHolder <TaggedBag <BodyOfNonPublicMethod, Dictionary <string, Work> > > >();

            if (holder.Source.Value == null)
            {
                return(false);
            }

            var dict = holder.Source.Value;

            lock (dict)
            {
                using (InstanceGetters.DisableProcessing())
                {
                    var _ = default(Delegate);
                    if (!m_holder.TryRemove(info, out _))
                    {
                        return(false);
                    }

                    var key = info + "";
                    if (!dict.ContainsKey(key))
                    {
                        return(false);
                    }

                    method = dict[key];
                    dict.Remove(key);
                    return(true);
                }
            }
        }
예제 #4
0
        public Work GetOrDefault(IndirectionInfo info)
        {
            var method = default(Work);

            TryGet(info, out method);
            return(method);
        }
예제 #5
0
 public TDelegate AddOrUpdate(IndirectionInfo info, TDelegate method)
 {
     lock (m_dict)
     {
         using (InstanceGetters.DisableProcessing())
         {
             var key = info + "";
             m_dict[key] = method;
             return(method);
         }
     }
 }
예제 #6
0
        public bool TryRemove(IndirectionInfo info, out TDelegate method)
        {
            method = default(TDelegate);

            lock (m_dict)
            {
                using (InstanceGetters.DisableProcessing())
                {
                    var key = info + "";
                    if (!m_dict.ContainsKey(key))
                    {
                        return(false);
                    }

                    method = m_dict[key];
                    m_dict.Remove(key);
                    return(true);
                }
            }
        }
예제 #7
0
        public bool Remove(IndirectionInfo info)
        {
            var method = default(TDelegate);

            return(TryRemove(info, out method));
        }