/// <summary>
 ///     Adds a Packer Format to the system
 /// </summary>
 /// <param name="formatProvider">The format to be added.</param>
 public static void AddAttributeHandler(IAttributeHandler <Attribute> formatProvider)
 {
     if (Handlers.All(x => x.GetType() != formatProvider.GetType()))
     {
         PluginManager.SendLog($"Adding Attribute Handler: {formatProvider.GetType().Name}");
         Handlers.Add(formatProvider);
     }
 }
 /// <summary>
 ///     Removes a Packer Format from the system
 /// </summary>
 /// <param name="formatProvider">The format to be removed.</param>
 public static void RemoveAttributeHandler(IAttributeHandler <Attribute> formatProvider)
 {
     if (Handlers.Contains(formatProvider))
     {
         PluginManager.SendLog($"Removing Attribute Handler: {formatProvider.GetType().Name}");
         Handlers.Remove(formatProvider);
     }
 }
Exemple #3
0
        /// <summary>
        /// Adds a handler for a custom attribute that cannot be made to implement <see cref="IAttributeHandler"/>.
        /// </summary>
        /// <param name="handler">The handler.</param>
        public static void AddHandler(IAttributeHandler handler)
        {
            var handlerType = handler.GetType();

            if (_handlers.Any(h => h.GetType() == handlerType))
            {
                return;
            }

            _handlers.Add(handler);
        }