本文整理汇总了C#中Roslyn.Utilities.ObjectReader.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectReader.ReadByte方法的具体用法?C# ObjectReader.ReadByte怎么用?C# ObjectReader.ReadByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roslyn.Utilities.ObjectReader
的用法示例。
在下文中一共展示了ObjectReader.ReadByte方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeChecksumWithChildren
private ChecksumWithChildren DeserializeChecksumWithChildren(ObjectReader reader, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var kind = reader.ReadString();
var checksum = Checksum.ReadFrom(reader);
var childrenCount = reader.ReadInt32();
var children = new object[childrenCount];
for (var i = 0; i < childrenCount; i++)
{
var childKind = reader.ReadByte();
if (childKind == ChecksumKind)
{
children[i] = Checksum.ReadFrom(reader);
continue;
}
if (childKind == ChecksumWithChildrenKind)
{
children[i] = DeserializeChecksumWithChildren(reader, cancellationToken);
continue;
}
throw ExceptionUtilities.UnexpectedValue(childKind);
}
var checksums = s_creatorMap[kind](children);
Contract.ThrowIfFalse(checksums.Checksum == checksum);
return checksums;
}
示例2: ReadBitArray
private static BitArray ReadBitArray(ObjectReader reader)
{
// TODO: find a way to use pool
var length = reader.ReadInt32();
var bytes = new byte[length];
for (var i = 0; i < bytes.Length; i++)
{
bytes[i] = reader.ReadByte();
}
return new BitArray(bytes);
}
示例3: ReadEncodingFrom
public override Encoding ReadEncodingFrom(ObjectReader reader, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var serialized = reader.ReadByte();
if (serialized == EncodingSerialization)
{
var array = (byte[])reader.ReadValue();
var formatter = new BinaryFormatter();
return (Encoding)formatter.Deserialize(new MemoryStream(array));
}
return ReadEncodingFrom(serialized, reader, cancellationToken);
}
示例4: ReadFrom
internal static DeclaredSymbolInfo ReadFrom(ObjectReader reader)
{
try
{
var name = reader.ReadString();
var immediateContainer = reader.ReadString();
var entireContainer = reader.ReadString();
var kind = (DeclaredSymbolInfoKind)reader.ReadByte();
var spanStart = reader.ReadInt32();
var spanLength = reader.ReadInt32();
var parameterCount = reader.ReadUInt16();
var typeParameterCount = reader.ReadUInt16();
return new DeclaredSymbolInfo(name, immediateContainer, entireContainer, kind, new TextSpan(spanStart, spanLength), parameterCount, typeParameterCount);
}
catch
{
return default(DeclaredSymbolInfo);
}
}
示例5: ReadFrom
internal static DeclaredSymbolInfo ReadFrom(ObjectReader reader)
{
try
{
var name = reader.ReadString();
var immediateContainer = reader.ReadString();
var entireContainer = reader.ReadString();
var kind = (DeclaredSymbolInfoKind)reader.ReadByte();
var spanStart = reader.ReadInt32();
var spanLength = reader.ReadInt32();
var parameterCount = reader.ReadUInt16();
var typeParameterCount = reader.ReadUInt16();
var inheritanceNamesLength = reader.ReadInt32();
var builder = ImmutableArray.CreateBuilder<string>(inheritanceNamesLength);
for (var i = 0; i < inheritanceNamesLength; i++)
{
builder.Add(reader.ReadString());
}
return new DeclaredSymbolInfo(
name, immediateContainer, entireContainer, kind, new TextSpan(spanStart, spanLength),
builder.MoveToImmutable(),
parameterCount, typeParameterCount);
}
catch
{
return default(DeclaredSymbolInfo);
}
}