/// <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); } }
/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="CSF.Zpt.Tal.TalVisitor"/> class. /// </summary> /// <param name="handlers">A collection of <see cref="IAttributeHandler"/> to process.</param> /// <param name="errorHandler">An <see cref="IAttributeHandler"/> which should be used to handle any errors.</param> public TalVisitor(IAttributeHandler[] handlers = null, IAttributeHandler errorHandler = null) { _handlers = handlers?? new IAttributeHandler[] { new DefineAttributeHandler(), new ConditionAttributeHandler(), new RepeatAttributeHandler(), new ContentOrReplaceAttributeHandler(), new OmitTagAttributeHandler(), new AttributesAttributeHandler(), }; _errorHandler = errorHandler?? new OnErrorAttributeHandler(); }
/// <summary> /// ctor /// </summary> public PermissionHandleFilter(IAttributeHandler attributeHandler) { _attributeHandler = attributeHandler; }