コード例 #1
0
ファイル: Serializer.cs プロジェクト: imgen/YamlDotNet
        private IObjectGraphVisitor CreateEmittingVisitor(Emitter emitter, SerializationOptions options, IObjectGraphTraversalStrategy traversalStrategy, IEventEmitter eventEmitter, object graph, Type type)
        {
            IObjectGraphVisitor emittingVisitor = new EmittingObjectGraphVisitor(eventEmitter);

            emittingVisitor = new CustomSerializationObjectGraphVisitor(emitter, emittingVisitor, converters);

            if ((options & SerializationOptions.DisableAliases) == 0)
            {
                var anchorAssigner = new AnchorAssigner();
                traversalStrategy.Traverse(graph, type, anchorAssigner);

                emittingVisitor = new AnchorAssigningObjectGraphVisitor(emittingVisitor, eventEmitter, anchorAssigner);
            }

            if ((options & SerializationOptions.EmitDefaults) == 0)
            {
                emittingVisitor = new DefaultExclusiveObjectGraphVisitor(emittingVisitor);
            }

            return(emittingVisitor);
        }
コード例 #2
0
ファイル: Serializer.cs プロジェクト: bennidhamma/YamlDotNet
        private IObjectGraphVisitor CreateEmittingVisitor(Emitter emitter, SerializationOptions options, IObjectGraphTraversalStrategy traversalStrategy, IEventEmitter eventEmitter, object graph, Type type)
        {
            IObjectGraphVisitor emittingVisitor = new EmittingObjectGraphVisitor(eventEmitter);

            emittingVisitor = new CustomSerializationObjectGraphVisitor(emitter, emittingVisitor, converters);

            if ((options & SerializationOptions.DisableAliases) == 0)
            {
                var anchorAssigner = new AnchorAssigner();
                traversalStrategy.Traverse(graph, type, anchorAssigner);

                emittingVisitor = new AnchorAssigningObjectGraphVisitor(emittingVisitor, eventEmitter, anchorAssigner);
            }

            if ((options & SerializationOptions.EmitDefaults) == 0)
            {
                emittingVisitor = new DefaultExclusiveObjectGraphVisitor(emittingVisitor);
            }

            return emittingVisitor;
        }