Exemple #1
0
 public static bool TryRemoveEnchantment(this Biota biota, int spellId, out BiotaPropertiesEnchantmentRegistry entity, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterUpgradeableReadLock();
     try
     {
         entity = biota.BiotaPropertiesEnchantmentRegistry.FirstOrDefault(x => x.SpellId == spellId);
         if (entity != null)
         {
             rwLock.EnterWriteLock();
             try
             {
                 biota.BiotaPropertiesEnchantmentRegistry.Remove(entity);
                 entity.Object = null;
                 return(true);
             }
             finally
             {
                 rwLock.ExitWriteLock();
             }
         }
         return(false);
     }
     finally
     {
         rwLock.ExitUpgradeableReadLock();
     }
 }
Exemple #2
0
 public static void AddEnchantment(this Biota biota, BiotaPropertiesEnchantmentRegistry entity, ReaderWriterLockSlim rwLock)
 {
     rwLock.EnterWriteLock();
     try
     {
         biota.BiotaPropertiesEnchantmentRegistry.Add(entity);
     }
     finally
     {
         rwLock.ExitWriteLock();
     }
 }