当前位置: 首页>>代码示例>>C#>>正文


C# IEmitter.Emit方法代码示例

本文整理汇总了C#中IEmitter.Emit方法的典型用法代码示例。如果您正苦于以下问题:C# IEmitter.Emit方法的具体用法?C# IEmitter.Emit怎么用?C# IEmitter.Emit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEmitter的用法示例。


在下文中一共展示了IEmitter.Emit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteYaml

        public void WriteYaml(IEmitter emitter, object value, Type type)
        {
            var dateTime = (DateTime)value;

            // if datetime has a time specified
            if (dateTime.Ticks != dateTime.Date.Ticks)
            {
                emitter.Emit(new Scalar(dateTime.ToString("g")));  // e.g. 2015-03-08 11:50
            }
            else
            {
                emitter.Emit(new Scalar(dateTime.ToShortDateString())); // e.g. 2015-03-08
            }
        }
开发者ID:encel,项目名称:Encel,代码行数:14,代码来源:DateTimeConverter.cs

示例2: EmitDocument

        private void EmitDocument(IEmitter emitter, IObjectDescriptor graph)
        {
            var traversalStrategy = CreateTraversalStrategy();
            var eventEmitter = CreateEventEmitter(emitter);
            var emittingVisitor = CreateEmittingVisitor(emitter, traversalStrategy, eventEmitter, graph);

            emitter.Emit(new StreamStart());
            emitter.Emit(new DocumentStart());

            traversalStrategy.Traverse(graph, emittingVisitor);

            emitter.Emit(new DocumentEnd(true));
            emitter.Emit(new StreamEnd());
        }
开发者ID:vwxyzh,项目名称:Zhenway.YamlSerializations,代码行数:14,代码来源:YamlSerializer.cs

示例3: foreach

		/// <summary>
		/// Writes this object's state to a YAML emitter.
		/// </summary>
		/// <param name="emitter"></param>
		void IYamlSerializable.WriteYaml(IEmitter emitter)
		{
			foreach (var item in events)
			{
				emitter.Emit(item);
			}
		}
开发者ID:Cyberbanan,项目名称:Projeny,代码行数:11,代码来源:StreamFragment.cs

示例4: WriteYaml

        public void WriteYaml(IEmitter emitter, object value, Type type)
        {
            if (emitter == null)
                throw new ArgumentNullException(nameof(emitter));
            if (value == null)
                throw new ArgumentNullException(nameof(value));
            if (type == null)
                throw new ArgumentNullException(nameof(type));

            emitter.Emit(new Scalar(value.ToString()));
        }
开发者ID:isbtech,项目名称:CloudFlare.NET,代码行数:11,代码来源:JsonYamlTypeConverter.cs

示例5: WriteYaml

 public void WriteYaml(IEmitter emitter, object value, Type type)
 {
     var bytes = (byte[])value;
     emitter.Emit(new YamlDotNet.Core.Events.Scalar(
         null,
         "tag:yaml.org,2002:binary",
         Convert.ToBase64String(bytes),
         ScalarStyle.Plain,
         false,
         false
     ));
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:12,代码来源:RepresentationModelSerializationTests.cs

示例6: Serializer

 public Serializer(IEmitter emitter, YamlOptions opts) {
     _emitter = emitter;
     _useExplicitStart = opts.ExplicitStart;
     _useExplicitEnd = opts.ExplicitEnd;
     if (opts.UseVersion) {
         _useVersion = opts.Version;
     }
     _explicitTypes = opts.ExplicitTypes;
     _useTags = opts.UseHeader;
     _anchorTemplate = opts.AnchorFormat ?? "id{0:000}";
     _emitter.Emit(StreamStartEvent.Instance);
 }
开发者ID:bclubb,项目名称:ironruby,代码行数:12,代码来源:Serializer.cs

示例7: Save

        internal void Save(IEmitter emitter)
        {
            AssignAnchors();

            emitter.Emit(new DocumentStart());
            RootNode.Save(emitter, new EmitterState());
            emitter.Emit(new DocumentEnd(false));
        }
开发者ID:vasily-kirichenko,项目名称:SharpYaml,代码行数:8,代码来源:YamlDocument.cs

示例8: EmitDocument

        private void EmitDocument(IEmitter emitter, object graph, Type type)
        {
            emitter.Emit(new StreamStart());
            emitter.Emit(new DocumentStart());

            IValueSerializer actualValueSerializer = backwardsCompatibleConfiguration ?? valueSerializer;
            actualValueSerializer.SerializeValue(emitter, graph, type);

            emitter.Emit(new DocumentEnd(true));
            emitter.Emit(new StreamEnd());
        }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:11,代码来源:Serializer.cs

示例9: foreach

 /// <summary>
 /// Writes this object's state to a YAML emitter.
 /// </summary>
 void IYamlConvertible.Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer)
 {
     foreach (var item in events)
     {
         emitter.Emit(item);
     }
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:10,代码来源:StreamFragment.cs

示例10: SequenceEnd

 void IEventEmitter.Emit(SequenceEndEventInfo eventInfo, IEmitter emitter)
 {
     emitter.Emit(new SequenceEnd());
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:4,代码来源:WriterEventEmitter.cs

示例11: SequenceStart

 void IEventEmitter.Emit(SequenceStartEventInfo eventInfo, IEmitter emitter)
 {
     emitter.Emit(new SequenceStart(eventInfo.Anchor, eventInfo.Tag, eventInfo.IsImplicit, eventInfo.Style));
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:4,代码来源:WriterEventEmitter.cs

示例12: MappingEnd

 void IEventEmitter.Emit(MappingEndEventInfo eventInfo, IEmitter emitter)
 {
     emitter.Emit(new MappingEnd());
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:4,代码来源:WriterEventEmitter.cs

示例13: MappingStart

 void IEventEmitter.Emit(MappingStartEventInfo eventInfo, IEmitter emitter)
 {
     emitter.Emit(new MappingStart(eventInfo.Anchor, eventInfo.Tag, eventInfo.IsImplicit, eventInfo.Style));
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:4,代码来源:WriterEventEmitter.cs

示例14: Scalar

 void IEventEmitter.Emit(ScalarEventInfo eventInfo, IEmitter emitter)
 {
     emitter.Emit(new Scalar(eventInfo.Anchor, eventInfo.Tag, eventInfo.RenderedValue, eventInfo.Style, eventInfo.IsPlainImplicit, eventInfo.IsQuotedImplicit));
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:4,代码来源:WriterEventEmitter.cs

示例15: AnchorAlias

 void IEventEmitter.Emit(AliasEventInfo eventInfo, IEmitter emitter)
 {
     emitter.Emit(new AnchorAlias(eventInfo.Alias));
 }
开发者ID:aaubry,项目名称:YamlDotNet,代码行数:4,代码来源:WriterEventEmitter.cs


注:本文中的IEmitter.Emit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。