public static bool RegisterReporter(SoundSizeAggregator __instance, ISizeReporter newRep)
 {
     lock (reporters(__instance))
     {
         reporters(__instance).Add(newRep);
     }
     return(false);
 }
 public static bool RegisterReporter(SoundSizeAggregator __instance, ISizeReporter newRep)
 {
     lock (__instance.reporters)             //added lock
     {
         __instance.reporters.Add(newRep);
     }
     return(false);
 }
 public static bool RemoveReporter(SoundSizeAggregator __instance, ISizeReporter oldRep)
 {
     lock (reporters(__instance))
     {
         reporters(__instance).Remove(oldRep);
     }
     return(false);
 }
 public static bool RemoveReporter(SoundSizeAggregator __instance, ISizeReporter oldRep)
 {
     lock (reporters(__instance))
     {
         List <ISizeReporter> newReporters = new List <ISizeReporter>(reporters(__instance));
         newReporters.Remove(oldRep);
         reporters(__instance) = newReporters;
     }
     return(false);
 }
 public static bool RemoveReporter(SoundSizeAggregator __instance, ISizeReporter oldRep)
 {
     lock (__instance.reporters)
     {
         List <ISizeReporter> newReporters = new List <ISizeReporter>(__instance.reporters); //safe copy remove
         newReporters.Remove(oldRep);
         __instance.reporters = newReporters;
     }
     return(false);
 }
        public static bool get_AggregateSize(SoundSizeAggregator __instance, ref float __result)
        {
            if (__instance.reporters.Count == 0)
            {
                __result = __instance.testSize;
                return(false);
            }
            float num = 0f;

            foreach (ISizeReporter reporter in __instance.reporters)
            {
                if (reporter != null)                // added check for null
                {
                    num += reporter.CurrentSize();
                }
            }
            __result = num;
            return(false);
        }
        public static bool get_AggregateSize(SoundSizeAggregator __instance, ref float __result)
        {
            if (reporters(__instance).Count == 0)
            {
                __result = testSize(__instance);
                return(false);
            }

            float num = 0f;

            for (int i = 0; i < reporters(__instance).Count; i++)
            {
                ISizeReporter reporter = reporters(__instance)[i];
                if (reporter != null)
                {
                    num += reporter.CurrentSize();
                }
            }

            __result = num;
            return(false);
        }