本文整理汇总了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
}
}
示例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());
}
示例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);
}
}
示例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()));
}
示例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
));
}
示例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);
}
示例7: Save
internal void Save(IEmitter emitter)
{
AssignAnchors();
emitter.Emit(new DocumentStart());
RootNode.Save(emitter, new EmitterState());
emitter.Emit(new DocumentEnd(false));
}
示例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());
}
示例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);
}
}
示例10: SequenceEnd
void IEventEmitter.Emit(SequenceEndEventInfo eventInfo, IEmitter emitter)
{
emitter.Emit(new SequenceEnd());
}
示例11: SequenceStart
void IEventEmitter.Emit(SequenceStartEventInfo eventInfo, IEmitter emitter)
{
emitter.Emit(new SequenceStart(eventInfo.Anchor, eventInfo.Tag, eventInfo.IsImplicit, eventInfo.Style));
}
示例12: MappingEnd
void IEventEmitter.Emit(MappingEndEventInfo eventInfo, IEmitter emitter)
{
emitter.Emit(new MappingEnd());
}
示例13: MappingStart
void IEventEmitter.Emit(MappingStartEventInfo eventInfo, IEmitter emitter)
{
emitter.Emit(new MappingStart(eventInfo.Anchor, eventInfo.Tag, eventInfo.IsImplicit, eventInfo.Style));
}
示例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));
}
示例15: AnchorAlias
void IEventEmitter.Emit(AliasEventInfo eventInfo, IEmitter emitter)
{
emitter.Emit(new AnchorAlias(eventInfo.Alias));
}