Ejemplo n.º 1
0
 internal void Render()
 {
     if (GetObjects == null)
     {
         TriangleTest();
     }
     else
     {
         GL.PushMatrix();
         SetupCamera();
         foreach (LatipiumObject obj in GetObjects())
         {
             Com.Latipium.Core.Tuple <object, object> data = obj.InvokeFunction <LatipiumObject>("Type")
                                                             .InvokeFunction <LatipiumObject, Com.Latipium.Core.Tuple <object, object> >("GetRenderData", obj);
             if (data != null)
             {
                 IObjectRenderer objectR = FindObjectRenderer(data);
                 if (objectR == null)
                 {
                     continue;
                 }
                 IColorRenderer colorR = FindColorRenderer(data);
                 GL.PushMatrix();
                 RenderObject(obj, data, objectR, colorR);
                 GL.PopMatrix();
             }
         }
         GL.PopMatrix();
     }
 }
Ejemplo n.º 2
0
        private string GetSafeRenderedFormat(object message, string stringRepresentationOfNull = "")
        {
            if (message == null)
            {
                return(stringRepresentationOfNull);
            }

            string str = message as string;

            if (str != null)
            {
                return(str);
            }

            if (_logger.Repository != null)
            {
                //try to escape the default renderer
                IObjectRenderer renderer = _logger.Repository.RendererMap.Get(message);
                if (renderer != null && renderer != _logger.Repository.RendererMap.DefaultRenderer)
                {
                    StringWriter stringWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
                    renderer.RenderObject(_logger.Repository.RendererMap, message, stringWriter);
                    return(stringWriter.ToString());
                }

                return(message.ToString());
            }

            return(message.ToString());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Parses an object renderer.
        /// </summary>
        /// <param name="element">The renderer element.</param>
        /// <remarks>
        /// <para>
        /// Parse an XML element that represents a renderer.
        /// </para>
        /// </remarks>
        protected void ParseRenderer(XmlElement element)
        {
            string renderingClassName = element.GetAttribute(RENDERING_TYPE_ATTR);
            string renderedClassName  = element.GetAttribute(RENDERED_TYPE_ATTR);

            LogLog.Debug(declaringType, "Rendering class [" + renderingClassName + "], Rendered class [" + renderedClassName + "].");
            IObjectRenderer renderer = (IObjectRenderer)OptionConverter.InstantiateByClassName(renderingClassName, typeof(IObjectRenderer), null);

            if (renderer == null)
            {
                LogLog.Error(declaringType, "Could not instantiate renderer [" + renderingClassName + "].");
                return;
            }
            else
            {
                try
                {
                    m_hierarchy.RendererMap.Put(SystemInfo.GetTypeFromString(renderedClassName, true, true), renderer);
                }
                catch (Exception e)
                {
                    LogLog.Error(declaringType, "Could not find class [" + renderedClassName + "].", e);
                }
            }
        }
Ejemplo n.º 4
0
        protected void ParseRenderer(XmlElement element)
        {
            string attribute = element.GetAttribute("renderingClass");
            string typeName  = element.GetAttribute("renderedClass");

            string[] textArray1 = new string[] { "Rendering class [", attribute, "], Rendered class [", typeName, "]." };
            LogLog.Debug(declaringType, string.Concat(textArray1));
            IObjectRenderer renderer = (IObjectRenderer)OptionConverter.InstantiateByClassName(attribute, typeof(IObjectRenderer), null);

            if (renderer == null)
            {
                LogLog.Error(declaringType, "Could not instantiate renderer [" + attribute + "].");
            }
            else
            {
                try
                {
                    this.m_hierarchy.RendererMap.Put(SystemInfo.GetTypeFromString(typeName, true, true), renderer);
                }
                catch (Exception exception)
                {
                    LogLog.Error(declaringType, "Could not find class [" + typeName + "].", exception);
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the renderer for the specified type
        /// </summary>
        /// <param name="type">the type to lookup the renderer for</param>
        /// <returns>the renderer for the specified type</returns>
        /// <remarks>
        /// <para>
        /// Returns the renderer for the specified type.
        /// If no specific renderer has been defined the
        /// <see cref="P:log4net.ObjectRenderer.RendererMap.DefaultRenderer" /> will be returned.
        /// </para>
        /// </remarks>
        public IObjectRenderer Get(Type type)
        {
            if ((object)type == null)
            {
                throw new ArgumentNullException("type");
            }
            IObjectRenderer objectRenderer = null;

            objectRenderer = (IObjectRenderer)m_cache[type];
            if (objectRenderer == null)
            {
                Type type2 = type;
                while ((object)type2 != null)
                {
                    objectRenderer = SearchTypeAndInterfaces(type2);
                    if (objectRenderer != null)
                    {
                        break;
                    }
                    type2 = type2.GetTypeInfo().BaseType;
                }
                if (objectRenderer == null)
                {
                    objectRenderer = s_defaultRenderer;
                }
                m_cache[type] = objectRenderer;
            }
            return(objectRenderer);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the renderer for the specified type
        /// </summary>
        /// <param name="type">the type to lookup the renderer for</param>
        /// <returns>the renderer for the specified type</returns>
        public IObjectRenderer Get(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            IObjectRenderer result = null;

            for (Type cur = type; cur != null; cur = cur.BaseType)
            {
                // Look for the specific type in the map
                result = (IObjectRenderer)m_map[cur];
                if (result != null)
                {
                    break;
                }

                // Search the type's interfaces
                result = SearchInterfaces(cur);
                if (result != null)
                {
                    break;
                }
            }

            // if not set then use the default renderer
            if (result == null)
            {
                result = s_defaultRenderer;
            }

            return(result);
        }
Ejemplo n.º 7
0
        public IObjectRenderer Get(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            IObjectRenderer renderer = null;

            renderer = (IObjectRenderer)this.m_cache[type];
            if (renderer == null)
            {
                Type baseType = type;
                while (true)
                {
                    if (baseType != null)
                    {
                        renderer = this.SearchTypeAndInterfaces(baseType);
                        if (renderer == null)
                        {
                            baseType = baseType.BaseType;
                            continue;
                        }
                    }
                    renderer ??= s_defaultRenderer;
                    this.m_cache[type] = renderer;
                    break;
                }
            }
            return(renderer);
        }
Ejemplo n.º 8
0
 public void FluentBuilderExamples()
 {
     _myFilter       = null; // TODO
     _myAppender     = Append.To.Console(c => c.Targeting.ConsoleOut());
     _myLayout       = Layout.Using.ExceptionMessage();
     _myErrorHandler = Handle.Errors.OnlyOnce(h => h.PrefixedBy("ERROR"));
     _myRenderer     = null; // TODO
 }
            /// <summary>
            /// Defines the <see cref="IObjectRenderer"/> responsible for rendering the type.
            /// </summary>
            /// <param name="renderer">An <see cref="IObjectRenderer"/> instance.</param>
            /// <returns>The current <see cref="RenderingConfiguration"/> instance.</returns>
            public Log4NetConfiguration Using(IObjectRenderer renderer)
            {
                if (renderer == null)
                {
                    throw new ArgumentNullException("renderer", "Renderer cannot be null.");
                }

                _renderer = renderer;
                return(_log4NetConfiguration);
            }
Ejemplo n.º 10
0
 public virtual void AddRenderer(Type typeToRender, IObjectRenderer rendererInstance)
 {
     if (typeToRender == null)
     {
         throw new ArgumentNullException("typeToRender");
     }
     if (rendererInstance == null)
     {
         throw new ArgumentNullException("rendererInstance");
     }
     this.m_rendererMap.Put(typeToRender, rendererInstance);
 }
            /// <summary>
            /// Defines the <see cref="IObjectRenderer"/> responsible for rendering the type.
            /// </summary>
            /// <param name="rendererType">A type that implements <see cref="IObjectRenderer"/>.</param>
            /// <returns>The current <see cref="RenderingConfiguration"/> instance.</returns>
            public Log4NetConfiguration Using(Type rendererType)
            {
                const string invalidType = "Type {0} must implement IObjectRenderer to be configured as a renderer.";

                if (!typeof(IObjectRenderer).IsAssignableFrom(rendererType))
                {
                    throw new ArgumentException(String.Format(invalidType, rendererType.FullName));
                }

                _renderer = (IObjectRenderer)Activator.CreateInstance(rendererType, true);
                return(_log4NetConfiguration);
            }
 private static void RenderValue(RendererMap rendererMap, TextWriter writer, object value)
 {
     if (value is string)
     {
         writer.Write(value);
     }
     else
     {
         IObjectRenderer keyRenderer = rendererMap.Get(value.GetType());
         keyRenderer.RenderObject(rendererMap, value, writer);
     }
 }
Ejemplo n.º 13
0
 public void Put(Type typeToRender, IObjectRenderer renderer)
 {
     this.m_cache.Clear();
     if (typeToRender == null)
     {
         throw new ArgumentNullException("typeToRender");
     }
     if (renderer == null)
     {
         throw new ArgumentNullException("renderer");
     }
     this.m_map[typeToRender] = renderer;
 }
 public ConditionalRenderingWrapper(Func <ObjectRenderingRequest, bool> test, IObjectRenderer renderer)
 {
     if (test == null)
     {
         throw new ArgumentNullException("test");
     }
     if (renderer == null)
     {
         throw new ArgumentNullException("renderer");
     }
     _renderer = renderer;
     _test     = test;
 }
        /// <summary>
        /// Adds an object renderer for a specific class.
        /// </summary>
        /// <param name="classToRender">The type that will be rendered by the renderer supplied.</param>
        /// <param name="objectRenderer">The object renderer used to render the object.</param>
        virtual public void AddRenderer(Type classToRender, IObjectRenderer objectRenderer)
        {
            if (classToRender == null)
            {
                throw new ArgumentNullException("classToRender");
            }
            if (objectRenderer == null)
            {
                throw new ArgumentNullException("objectRenderer");
            }

            m_rendererMap.Put(classToRender, objectRenderer);
        }
Ejemplo n.º 16
0
        static object RenderObject(AssertionData data, object obj, IObjectRenderer renderer)
        {
            var req = new ObjectRenderingRequest(data, renderer, obj);

            // we pretty much are only doing this to clear out the cycle detector betweeen rendering different components
            var state = renderer.SaveState(req);

            try {
                return(renderer.Render(req));
            } finally {
                renderer.RestoreState(req, state);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Loads the resources for this scene.
        /// </summary>
        public override void Load()
        {
            var container = new GraphicStreamContainer();
            var positions = container.Create(GraphicStreamUsage.Position, CreatePositions());
            var colors = container.Create(GraphicStreamUsage.Color, CreateColors());
            var indices = container.Create(GraphicStreamUsage.Index, CreateIndices());

            IBufferService bufferService = new OpenTKBufferService();

            var bufferBindings = new[]
            {
                bufferService.CreateFor(positions),
             //   bufferService.CreateFor(colors),
                bufferService.CreateFor(indices)
            };

            mRenderer = new OpenTKObjectRenderer(bufferBindings);
        }
Ejemplo n.º 18
0
        private IObjectRenderer SearchTypeAndInterfaces(Type type)
        {
            IObjectRenderer renderer = (IObjectRenderer)this.m_map[type];

            if (renderer != null)
            {
                return(renderer);
            }
            foreach (Type type2 in type.GetInterfaces())
            {
                renderer = this.SearchTypeAndInterfaces(type2);
                if (renderer != null)
                {
                    return(renderer);
                }
            }
            return(null);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Internal function to recursively search interfaces
        /// </summary>
        /// <param name="type">the type to lookup the renderer for</param>
        /// <returns>the renderer for the specified type</returns>
        private IObjectRenderer SearchTypeAndInterfaces(Type type)
        {
            IObjectRenderer objectRenderer = (IObjectRenderer)m_map[type];

            if (objectRenderer != null)
            {
                return(objectRenderer);
            }
            Type[] interfaces = type.GetInterfaces();
            foreach (Type type2 in interfaces)
            {
                objectRenderer = SearchTypeAndInterfaces(type2);
                if (objectRenderer != null)
                {
                    return(objectRenderer);
                }
            }
            return(null);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Retorna una clase que puede representar en formato XML el cabezal de
        /// mensajes.
        /// </summary>
        /// <param name="renderingMap">Es un mapa con todas las clases que
        /// representan objetos.</param>
        /// <returns>Una clase que puede representar en formato XML el cabezal de
        /// mensajes.
        /// </returns>
        public override MessagingComponentXmlRendering XmlRendering(
            RendererMap renderingMap)
        {
            IObjectRenderer objectRendering = renderingMap.Get(typeof(MessageHeader));

            if (objectRendering == null)
            {
                // Add renderer to map.
                objectRendering = new MessageHeaderXmlRendering();
                renderingMap.Put(typeof(MessageHeader), objectRendering);
            }
            else
            if (!(objectRendering is MessageHeaderXmlRendering))
            {
                objectRendering = new MessageHeaderXmlRendering();
            }

            return(( MessagingComponentXmlRendering)objectRendering);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Internal function to recursively search interfaces
        /// </summary>
        /// <param name="type">the type to lookup the renderer for</param>
        /// <returns>the renderer for the specified type</returns>
        private static IObjectRenderer SearchTypeAndInterfaces(Type type)
        {
            IObjectRenderer r = (IObjectRenderer)m_map[type];

            if (r != null)
            {
                return(r);
            }
            else
            {
                foreach (Type t in type.GetInterfaces())
                {
                    r = SearchTypeAndInterfaces(t);
                    if (r != null)
                    {
                        return(r);
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Loads the resources for this scene.
        /// </summary>
        public override void Load()
        {
            var container = new GraphicStreamContainer();
            var positions = container.Create(GraphicStreamUsage.Position, CreatePositions());
            var colors = container.Create(GraphicStreamUsage.Color, CreateColors());

            IBufferService bufferService = new SlimDXBufferService(RenderWindow.Device);

            var bufferBindings = new[]
            {
                bufferService.CreateFor(positions),
                bufferService.CreateFor(colors)
            };

            mEffect = new SlimDXEffectCompiler(RenderWindow.Device).Compile("MyShader10.fx");

            mRenderer = new SlimDXObjectRenderer(RenderWindow.Device,
                mEffect, bufferBindings);

            mWorldViewProjectionParameter = new SlimDXMatrixEffectParameter("WorldViewProjection");
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Gets the renderer for the specified type.
        /// </summary>
        /// <param name="type">the type to lookup the renderer for.</param>
        /// <returns>the renderer for the specified type.</returns>
        /// <remarks>
        /// <para>
        /// Returns the renderer for the specified type.
        /// If no specific renderer has been defined the
        /// <see cref="DefaultRenderer"/> will be returned.
        /// </para>
        /// </remarks>
        public IObjectRenderer Get(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            IObjectRenderer result = null;

            // Check cache
            result = (IObjectRenderer)this.m_cache[type];

            if (result == null)
            {
#if NETSTANDARD1_3
                for (Type cur = type; cur != null; cur = cur.GetTypeInfo().BaseType)
#else
                for (Type cur = type; cur != null; cur = cur.BaseType)
#endif
                {
                    // Search the type's interfaces
                    result = this.SearchTypeAndInterfaces(cur);
                    if (result != null)
                    {
                        break;
                    }
                }

                // if not set then use the default renderer
                if (result == null)
                {
                    result = s_defaultRenderer;
                }

                // Add to cache
                this.m_cache[type] = result;
            }

            return(result);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Loads the resources for this scene.
        /// </summary>
        public override void Load()
        {
            var container = new GraphicStreamContainer();
            var positions = container.Create(GraphicStreamUsage.Position, CreatePositions());
            var colors = container.Create(GraphicStreamUsage.Color, CreateColors());

            IBufferService bufferService = new XnaBufferService(RenderWindow.Device);

            var bufferBindings = new[]
            {
                bufferService.CreateFor(colors),
                bufferService.CreateFor(positions),
            };

            mEffect = new XnaEffectCompiler(RenderWindow.Device).Compile("MyShader.fx");
            mRenderer = new XnaObjectRenderer(RenderWindow.Device, mEffect, bufferBindings);

            mWorldViewProjectionParameter = new XnaMatrixEffectParameter("WorldViewProjection");

            mCamera = new Camera(new Stand(), new PerspectiveProjectionLense());
            mCamera.Stand.Position = new Vector3(0, 0, 3);

            SetupKeysAndActions();
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Parses an object renderer.
        /// </summary>
        /// <param name="element">The renderer element.</param>
        /// <remarks>
        /// <para>
        /// Parse an XML element that represents a renderer.
        /// </para>
        /// </remarks>
        protected void ParseRenderer(XmlElement element)
        {
            string attribute  = element.GetAttribute("renderingClass");
            string attribute2 = element.GetAttribute("renderedClass");

            LogLog.Debug(declaringType, "Rendering class [" + attribute + "], Rendered class [" + attribute2 + "].");
            IObjectRenderer objectRenderer = (IObjectRenderer)OptionConverter.InstantiateByClassName(attribute, typeof(IObjectRenderer), null);

            if (objectRenderer == null)
            {
                LogLog.Error(declaringType, "Could not instantiate renderer [" + attribute + "].");
            }
            else
            {
                try
                {
                    m_hierarchy.RendererMap.Put(SystemInfo.GetTypeFromString(GetType().GetTypeInfo().Assembly, attribute2, throwOnError: true, ignoreCase: true), objectRenderer);
                }
                catch (Exception exception)
                {
                    LogLog.Error(declaringType, "Could not find class [" + attribute2 + "].", exception);
                }
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Gets the renderer for the specified type
        /// </summary>
        /// <param name="type">the type to lookup the renderer for</param>
        /// <returns>the renderer for the specified type</returns>
        /// <remarks>
        /// <para>
        /// Returns the renderer for the specified type.
        /// If no specific renderer has been defined the
        /// <see cref="DefaultRenderer"/> will be returned.
        /// </para>
        /// </remarks>
        public static IObjectRenderer Get(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            IObjectRenderer result = null;

            // Check cache
            result = (IObjectRenderer)m_cache[type];

            if (result == null)
            {
                for (Type cur = type; cur != null; cur = cur.BaseType)
                {
                    // Search the type's interfaces
                    result = SearchTypeAndInterfaces(cur);
                    if (result != null)
                    {
                        break;
                    }
                }

                // if not set then use the default renderer
                if (result == null)
                {
                    result = s_defaultRenderer;
                }

                // Add to cache
                m_cache[type] = result;
            }

            return(result);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Register an <see cref="IObjectRenderer"/> for <paramref name="typeToRender"/>. 
        /// </summary>
        /// <param name="typeToRender">the type that will be rendered by <paramref name="renderer"/></param>
        /// <param name="renderer">the renderer for <paramref name="typeToRender"/></param>
        /// <remarks>
        /// <para>
        /// Register an object renderer for a specific source type.
        /// This renderer will be returned from a call to <see cref="Get(Type)"/>
        /// specifying the same <paramref name="typeToRender"/> as an argument.
        /// </para>
        /// </remarks>
        public void Put(Type typeToRender, IObjectRenderer renderer)
        {
            m_cache.Clear();

            if (typeToRender == null)
                throw new ArgumentNullException("typeToRender");
            if (renderer == null)
                throw new ArgumentNullException("renderer");

            m_map[typeToRender] = renderer;
        }
Ejemplo n.º 28
0
        private void RenderObject(LatipiumObject obj, Com.Latipium.Core.Tuple <object, object> data, IObjectRenderer objectR, IColorRenderer colorR)
        {
            Com.Latipium.Core.Tuple <float, float, float> position = obj.InvokeFunction <Com.Latipium.Core.Tuple <float, float, float>, Com.Latipium.Core.Tuple <float, float, float> >("Position", null);
            float[] transform = obj.InvokeFunction <float[], float[]>("Transform", null);
            if (position != null)
            {
                GL.Translate(position.Object1, position.Object2, position.Object3);
            }
            if (transform != null)
            {
                GL.MultMatrix(transform);
            }
            int len = objectR.Start(data.Object1);

            if (colorR == null)
            {
                for (int i = 0; i < len; ++i)
                {
                    objectR.Vertex(i);
                }
            }
            else
            {
                colorR.Start(data.Object2);
                for (int i = 0; i < len; ++i)
                {
                    colorR.Color(i);
                    objectR.Vertex(i);
                }
            }
            objectR.End();
        }
 public ThrowableRenderer(RendererMap rendererMap)
 {
     this.fallback = rendererMap.Get(typeof(Throwable));
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Adds an object renderer for a specific class. 
        /// </summary>
        /// <param name="typeToRender">The type that will be rendered by the renderer supplied.</param>
        /// <param name="rendererInstance">The object renderer used to render the object.</param>
        /// <remarks>
        /// <para>
        /// Adds an object renderer for a specific class. 
        /// </para>
        /// </remarks>
        public virtual void AddRenderer(Type typeToRender, IObjectRenderer rendererInstance)
        {
            if (typeToRender == null)
                throw new ArgumentNullException("typeToRender");
            if (rendererInstance == null)
                throw new ArgumentNullException("rendererInstance");

            m_rendererMap.Put(typeToRender, rendererInstance);
        }
Ejemplo n.º 31
0
 public void FluentBuilderExamples()
 {
     _myFilter = null; // TODO
     _myAppender = Append.To.Console(c => c.Targeting.ConsoleOut());
     _myLayout = Layout.Using.ExceptionMessage();
     _myErrorHandler = Handle.Errors.OnlyOnce(h => h.PrefixedBy("ERROR"));
     _myRenderer = null; // TODO
 }
        /// <summary>
        /// Arrange <see cref="Fetcher"/>'s members if possible, if it is an <see cref="IRawArrangedLayout"/>.
        /// </summary>
        /// <param name="arrangement">arangement to use, can be null</param>
        /// <param name="converters">converters to consider, can be null</param>
        /// <param name="fetcher">fetches an object from a logging event</param>
        /// <param name="renderer">serializes the object</param>
        /// <param name="decorators">decorates the object before serialization</param>
        public virtual void SetUp(IArrangement arrangement, IEnumerable <ConverterInfo> converters, IRawLayout fetcher, IObjectRenderer renderer, IEnumerable <IDecorator> decorators)
        {
            var decoratorsArray = decorators == null ? null : Enumerable.ToArray(decorators);

            Fetcher    = fetcher ?? Fetcher ?? CreateFetcher();
            Decorators = decoratorsArray ?? Decorators ?? CreateDecorators();
            Renderer   = renderer ?? Renderer ?? CreateRenderer();
            Arrange(arrangement, converters);
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Add <see cref="PatternConverter.Properties"/> or make use of <see cref="ISerializingPatternConverter.SetUp"/>,
        /// call <see cref="IOptionHandler.ActivateOptions"/>
        /// </summary>
        /// <param name="conv">serializer to be set up, see also <seealso cref="ISerializingPatternConverter"/></param>
        /// <param name="converters">converters to be used collected from parent class</param>
        /// <param name="arrangement">arrangement to be used collected from parent class</param>
        /// <param name="fetcher">fetcher to use</param>
        /// <param name="renderer">renderer to use</param>
        /// <param name="decorators">decorators to use</param>
        /// <remarks>
        /// <para>
        /// Please note that properties are only supported with log4net 1.2.11 and above.
        /// </para>
        /// </remarks>
        protected virtual void SetUpSerializingConverter(PatternConverter conv, ConverterInfo[] converters, IArrangement arrangement, IRawLayout fetcher, IObjectRenderer renderer, IDecorator[] decorators)
        {
            var serializedConv = conv as ISerializingPatternConverter;

            if (serializedConv != null)
            {
                serializedConv.SetUp(arrangement, converters, fetcher, renderer, decorators);
            }
#if !LOG4NET_1_2_10_COMPATIBLE
            else
            {
                LogLog.Warn(GetType(), String.Format("Converter is not a ISerializingPatternConverter: {0}. Passing fetcher, renderer, decorators, arrangement and converters as properties.", conv));
                conv.Properties["arrangement"] = arrangement;
                conv.Properties["converters"]  = converters;
                conv.Properties["fetcher"]     = fetcher;
                conv.Properties["renderer"]    = renderer;
                conv.Properties["decorators"]  = decorators;
            }
 public ObjectRenderingRequest(AssertionData assertion, IObjectRenderer renderer, object renderTarget)
     : base(assertion, renderer)
 {
     RenderTarget = renderTarget;
 }
 public ObjectRenderingContext(AssertionData assertion, IObjectRenderer renderer)
 {
     Assertion = assertion;
     Renderer  = renderer;
 }
Ejemplo n.º 36
0
		/// <summary>
		/// Register an <see cref="IObjectRenderer"/> for <paramref name="typeToRender"/>. 
		/// </summary>
		/// <param name="typeToRender">the type that will be rendered by <paramref name="renderer"/></param>
		/// <param name="renderer">the renderer for <paramref name="typeToRender"/></param>
		public void Put(Type typeToRender, IObjectRenderer renderer) 
		{
			if (typeToRender == null)
			{
				throw new ArgumentNullException("typeToRender");
			}
			if (renderer == null)
			{
				throw new ArgumentNullException("renderer");
			}

			m_map[typeToRender] = renderer;
		}	
Ejemplo n.º 37
0
 /// <summary>
 /// Add renderer to be passed to serializing pattern converter
 /// </summary>
 /// <param name="value">renderer</param>
 /// <remarks>
 /// This method will be most useful for XML configuration.
 /// </remarks>
 public virtual void AddRenderer(IObjectRenderer value)
 {
     m_renderer = value;
 }