Beispiel #1
0
 public void Fire(object o)
 {
     if (!this.source.Any())
     {
         if (this.batchEvents)
         {
             lock (this)
             {
                 InstrumentedAssembly.TypeInfo typeInfo = this;
                 int num  = typeInfo.currentIndex;
                 int num1 = num;
                 typeInfo.currentIndex = num + 1;
                 this.convertFunctionsBatch[num1](o);
                 this.wbemObjects[this.currentIndex - 1] = (IntPtr)this.fieldInfo.GetValue(this.convertFunctionsBatch[this.currentIndex - 1].Target);
                 if (this.cleanupThread != null)
                 {
                     if (this.currentIndex == this.batchSize)
                     {
                         this.source.IndicateEvents(this.currentIndex, this.wbemObjects);
                         this.currentIndex = 0;
                         this.lastFire     = Environment.TickCount;
                     }
                 }
                 else
                 {
                     int tickCount = Environment.TickCount;
                     if (tickCount - this.lastFire >= 0x3e8)
                     {
                         this.source.IndicateEvents(this.currentIndex, this.wbemObjects);
                         this.currentIndex = 0;
                         this.lastFire     = tickCount;
                     }
                     else
                     {
                         this.lastFire      = Environment.TickCount;
                         this.cleanupThread = new Thread(new ThreadStart(this.Cleanup));
                         this.cleanupThread.SetApartmentState(ApartmentState.MTA);
                         this.cleanupThread.Start();
                     }
                 }
             }
         }
         else
         {
             lock (this)
             {
                 this.convertFunctionNoBatch(o);
                 this.wbemObjects[0] = (IntPtr)this.fieldInfo.GetValue(this.convertFunctionNoBatch.Target);
                 this.source.IndicateEvents(1, this.wbemObjects);
             }
         }
         return;
     }
     else
     {
         return;
     }
 }
Beispiel #2
0
 private InstrumentedAssembly.TypeInfo GetTypeInfo(Type t)
 {
     InstrumentedAssembly.TypeInfo typeInfo;
     lock (this.mapTypeToTypeInfo)
     {
         if (this.lastType != t)
         {
             this.lastType = t;
             InstrumentedAssembly.TypeInfo item = (InstrumentedAssembly.TypeInfo) this.mapTypeToTypeInfo[t];
             if (item == null)
             {
                 item = new InstrumentedAssembly.TypeInfo(this.source, this.naming, (Type)this.mapTypeToConverter[t]);
                 this.mapTypeToTypeInfo.Add(t, item);
             }
             this.lastTypeInfo = item;
             typeInfo          = item;
         }
         else
         {
             typeInfo = this.lastTypeInfo;
         }
     }
     return(typeInfo);
 }
Beispiel #3
0
		private InstrumentedAssembly.TypeInfo GetTypeInfo(Type t)
		{
			InstrumentedAssembly.TypeInfo typeInfo;
			lock (this.mapTypeToTypeInfo)
			{
				if (this.lastType != t)
				{
					this.lastType = t;
					InstrumentedAssembly.TypeInfo item = (InstrumentedAssembly.TypeInfo)this.mapTypeToTypeInfo[t];
					if (item == null)
					{
						item = new InstrumentedAssembly.TypeInfo(this.source, this.naming, (Type)this.mapTypeToConverter[t]);
						this.mapTypeToTypeInfo.Add(t, item);
					}
					this.lastTypeInfo = item;
					typeInfo = item;
				}
				else
				{
					typeInfo = this.lastTypeInfo;
				}
			}
			return typeInfo;
		}
Beispiel #4
0
 public void Fire(Type t, object o)
 {
     InstrumentedAssembly.TypeInfo typeInfo = this.GetTypeInfo(t);
     typeInfo.Fire(o);
 }