本文整理汇总了C#中Roslyn.Utilities.ObjectWriter.WriteValue方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectWriter.WriteValue方法的具体用法?C# ObjectWriter.WriteValue怎么用?C# ObjectWriter.WriteValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roslyn.Utilities.ObjectWriter
的用法示例。
在下文中一共展示了ObjectWriter.WriteValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteTo
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(_child0);
writer.WriteValue(_child1);
writer.WriteValue(_child2);
}
示例2: WriteTo
public override void WriteTo(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken)
{
WriteCompilationOptionsTo(options, writer, cancellationToken);
var csharpOptions = (CSharpCompilationOptions)options;
writer.WriteValue(csharpOptions.Usings.ToArray());
writer.WriteBoolean(csharpOptions.AllowUnsafe);
}
示例3: SerializeDocumentSnapshotInfo
public void SerializeDocumentSnapshotInfo(DocumentChecksumObjectInfo info, ObjectWriter writer, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
SerializeDocumentId(info.Id, writer, cancellationToken);
writer.WriteString(info.Name);
writer.WriteValue(info.Folders.ToArray());
writer.WriteInt32((int)info.SourceCodeKind);
writer.WriteString(info.FilePath);
writer.WriteBoolean(info.IsGenerated);
}
示例4: WriteTo
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
// PERF: Write the array out manually.Profiling shows that this is cheaper than converting to
// an array in order to use writer.WriteValue.
writer.WriteInt32(this.children.Length);
for (var i = 0; i < this.children.Length; i++)
{
writer.WriteValue(this.children[i].Value);
}
}
示例5: WriteCompilationOptionsTo
protected void WriteCompilationOptionsTo(CompilationOptions options, ObjectWriter writer, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
writer.WriteInt32((int)options.OutputKind);
writer.WriteBoolean(options.ReportSuppressedDiagnostics);
writer.WriteString(options.ModuleName);
writer.WriteString(options.MainTypeName);
writer.WriteString(options.ScriptClassName);
writer.WriteInt32((int)options.OptimizationLevel);
writer.WriteBoolean(options.CheckOverflow);
// REVIEW: is it okay this being not part of snapshot?
writer.WriteString(options.CryptoKeyContainer);
writer.WriteString(options.CryptoKeyFile);
writer.WriteValue(options.CryptoPublicKey.ToArray());
writer.WriteBoolean(options.DelaySign.HasValue);
if (options.DelaySign.HasValue)
{
writer.WriteBoolean(options.DelaySign.Value);
}
writer.WriteInt32((int)options.Platform);
writer.WriteInt32((int)options.GeneralDiagnosticOption);
writer.WriteInt32(options.WarningLevel);
// REVIEW: I don't think there is a guarantee on ordering of elements in the immutable dictionary.
// unfortunately, we need to sort them to make it deterministic
writer.WriteInt32(options.SpecificDiagnosticOptions.Count);
foreach (var kv in options.SpecificDiagnosticOptions.OrderBy(o => o.Key))
{
writer.WriteString(kv.Key);
writer.WriteInt32((int)kv.Value);
}
writer.WriteBoolean(options.ConcurrentBuild);
writer.WriteBoolean(options.Deterministic);
writer.WriteBoolean(options.PublicSign);
// REVIEW: What should I do with these. we probably need to implement either out own one
// or somehow share these as service....
//
// XmlReferenceResolver xmlReferenceResolver
// SourceReferenceResolver sourceReferenceResolver
// MetadataReferenceResolver metadataReferenceResolver
// AssemblyIdentityComparer assemblyIdentityComparer
// StrongNameProvider strongNameProvider
}
示例6: WriteTo
private unsafe void WriteTo(MetadataReader reader, ObjectWriter writer, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var length = reader.MetadataLength;
// TODO: any way to avoid allocating byte array here?
var bytes = new byte[length];
Marshal.Copy((IntPtr)reader.MetadataPointer, bytes, 0, length);
writer.WriteValue(bytes);
}
示例7: WriteMvidTo
private void WriteMvidTo(ModuleMetadata metadata, ObjectWriter writer, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
writer.WriteInt32((int)metadata.Kind);
var metadataReader = metadata.GetMetadataReader();
var mvidHandle = metadataReader.GetModuleDefinition().Mvid;
var guid = metadataReader.GetGuid(mvidHandle);
writer.WriteValue(guid.ToByteArray());
}
示例8: WriteTo
protected virtual void WriteTo(ObjectWriter writer)
{
writer.WriteValue(_messageProvider);
writer.WriteCompressedUInt((uint)_errorCode);
writer.WriteInt32((int)_effectiveSeverity);
writer.WriteInt32((int)_defaultSeverity);
int count = (_arguments != null) ? _arguments.Length : 0;
writer.WriteCompressedUInt((uint)count);
if (count > 0)
{
foreach (var arg in _arguments)
{
writer.WriteString(arg.ToString());
}
}
}
示例9: SerializeProjectReference
public void SerializeProjectReference(ProjectReference reference, ObjectWriter writer, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
reference.ProjectId.WriteTo(writer);
writer.WriteValue(reference.Aliases.ToArray());
writer.WriteBoolean(reference.EmbedInteropTypes);
}
示例10: WriteTo
internal virtual void WriteTo(ObjectWriter writer)
{
var kindBits = (UInt16)_kind;
var hasDiagnostics = this.GetDiagnostics().Length > 0;
var hasAnnotations = this.GetAnnotations().Length > 0;
if (hasDiagnostics || hasAnnotations)
{
kindBits |= ExtendedSerializationInfoMask;
}
writer.WriteUInt16(kindBits);
if (hasDiagnostics || hasAnnotations)
{
writer.WriteValue(hasDiagnostics ? this.GetDiagnostics() : null);
writer.WriteValue(hasAnnotations ? this.GetAnnotations() : null);
}
}
示例11: WriteTo
public void WriteTo(ObjectWriter writer)
{
Id.WriteTo(writer);
writer.WriteString(Name);
writer.WriteValue(Folders.ToArray());
writer.WriteInt32((int)SourceCodeKind);
writer.WriteString(FilePath);
writer.WriteBoolean(IsGenerated);
}
示例12: WriteTo
private void WriteTo(MetadataReader reader, ObjectWriter writer, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var blockFieldInfo = reader.GetType().GetTypeInfo().GetDeclaredField("Block");
var block = blockFieldInfo.GetValue(reader);
// TODO: once things become public API, change it to copy stream over byte* and length from metadata reader
var toArrayFieldInfo = block.GetType().GetTypeInfo().GetDeclaredMethod("ToArray");
var array = (byte[])toArrayFieldInfo.Invoke(block, null);
writer.WriteValue(array);
}
示例13: WriteTo
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(this.LeadingField);
writer.WriteValue(this.TrailingField);
}
示例14: WriteTo
internal override void WriteTo(ObjectWriter writer)
{
base.WriteTo(writer);
writer.WriteValue(_leading);
writer.WriteValue(_trailing);
}
示例15: SerializeDocumentId
public static void SerializeDocumentId(DocumentId documentId, ObjectWriter writer, CancellationToken cancellationToken)
{
SerializeProjectId(documentId.ProjectId, writer, cancellationToken);
writer.WriteValue(documentId.Id.ToByteArray());
writer.WriteString(documentId.DebugName);
}