Example #1
0
        public void RegisterValueProcessor( ITemplateValueProcessor processor )
        {
            lock ( this ) {
                foreach ( ITemplateValueProcessor item in ValueProcessors ) {
                    if ( item.GetType().FullName.Equals( processor.GetType().FullName, System.StringComparison.OrdinalIgnoreCase ) )
                        return;

                    if ( item.Key.Equals( processor.Key, System.StringComparison.OrdinalIgnoreCase ) )
                        throw new ArgumentException( "You cannot register two ITemplateValueProcessor's with the same key value.", "processor" );
                }

                // Register this engine with the value processor and register
                // as a value processor for this engine.
                processor.TemplateEngine = this;

                ValueProcessors.Add( processor );
            }
        }
Example #2
0
 public void RemoveValueProcessor( ITemplateValueProcessor processor )
 {
     lock ( this ) {
         foreach ( ITemplateValueProcessor item in ValueProcessors ) {
             if ( item.GetType().FullName.Equals( processor.GetType().FullName, System.StringComparison.OrdinalIgnoreCase ) ) {
                 ValueProcessors.Remove( item );
                 return;
             }
         }
     }
 }