Пример #1
0
 public void UnregisterExtension(IWeaponExtension extension)
 {
     if (_extensions.ContainsValue(extension))
     {
         _extensions.Remove(_extensions.First(x => x.Value == extension).Key);
     }
     else
     {
         throw new ArgumentException($"Extension {extension.GetType().FullName} not yet registered");
     }
 }
Пример #2
0
        public void RegisterExtension(IWeaponExtension extension)
        {
            string extensionName = extension.GetType().FullName;

            if (!_extensions.ContainsKey(extensionName))
            {
                _extensions.Add(extensionName, extension);
            }
            else
            {
                throw new ArgumentException($"Extension: {extensionName} already registered");
            }
        }
Пример #3
0
 public bool HasExtension(IWeaponExtension extension)
 {
     return(_extensions.ContainsValue(extension));
 }