本文整理汇总了C#中ImmutableArray.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableArray.ToArray方法的具体用法?C# ImmutableArray.ToArray怎么用?C# ImmutableArray.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableArray
的用法示例。
在下文中一共展示了ImmutableArray.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PublicKeyAddress
public PublicKeyAddress(ImmutableArray<byte> publicKeyBytes)
{
this.publicKeyBytes = publicKeyBytes;
var outputScript1 = new PayToPublicKeyBuilder().CreateOutput(publicKeyBytes.ToArray());
var outputScript2 = new PayToPublicKeyHashBuilder().CreateOutputFromPublicKey(publicKeyBytes.ToArray());
this.outputScript1Hash = new UInt256(SHA256Static.ComputeHash(outputScript1));
this.outputScript2Hash = new UInt256(SHA256Static.ComputeHash(outputScript2));
}
示例2: NetworkAddressKey
public NetworkAddressKey(ImmutableArray<byte> IPv6Address, UInt16 Port)
{
this.IPv6Address = IPv6Address;
this.Port = Port;
this._hashCode = Port.GetHashCode() ^ new BigInteger(IPv6Address.ToArray()).GetHashCode();
}
示例3: CreateAuthTicket
public static ImmutableArray<byte> CreateAuthTicket(ImmutableArray<byte> token, IPAddress ip) {
uint sessionSize = 4 + // unknown 1
4 + // unknown 2
4 + // external IP
4 + // filler
4 + // timestamp
4; // connection count
MemoryStream stream = new MemoryStream();
using (var writer = new BinaryWriter(stream)) {
writer.Write(token.Length);
writer.Write(token.ToArray());
writer.Write(sessionSize);
writer.Write(1);
writer.Write(2);
byte[] externalBytes = ip.GetAddressBytes();
writer.Write(externalBytes.Reverse().ToArray());
writer.Write((int) 0);
writer.Write(2038 /* ms since connected to steam? */);
writer.Write(1 /* connection count to steam? */);
}
return stream.ToArray().ToImmutableArray();
}
示例4: VerifyScript
public static bool VerifyScript(ImmutableArray<byte> txBytes, ImmutableArray<byte> prevTxOutputPublicScriptBytes, int inputIndex, verify_flags_type flags)
{
//TODO
if (!Environment.Is64BitProcess)
return true;
return verify_script(txBytes.ToArray(), (UIntPtr)txBytes.Length, prevTxOutputPublicScriptBytes.ToArray(), (UIntPtr)prevTxOutputPublicScriptBytes.Length, (uint)inputIndex, flags)
== verify_result_type.verify_result_eval_true;
}
示例5: UncompressSlotMap
private unsafe static ImmutableArray<LocalSlotDebugInfo> UncompressSlotMap(ImmutableArray<byte> compressedSlotMap)
{
if (compressedSlotMap.IsDefaultOrEmpty)
{
return default(ImmutableArray<LocalSlotDebugInfo>);
}
var mapBuilder = ArrayBuilder<LocalSlotDebugInfo>.GetInstance();
int syntaxOffsetBaseline = -1;
fixed (byte* compressedSlotMapPtr = &compressedSlotMap.ToArray()[0])
{
var blobReader = new BlobReader(compressedSlotMapPtr, compressedSlotMap.Length);
while (blobReader.RemainingBytes > 0)
{
byte b = blobReader.ReadByte();
if (b == SyntaxOffsetBaseline)
{
syntaxOffsetBaseline = -blobReader.ReadCompressedInteger();
continue;
}
if (b == 0)
{
// short-lived temp, no info
mapBuilder.Add(new LocalSlotDebugInfo(SynthesizedLocalKind.LoweringTemp, default(LocalDebugId)));
continue;
}
var kind = (SynthesizedLocalKind)((b & 0x3f) - 1);
bool hasOrdinal = (b & (1 << 7)) != 0;
int syntaxOffset;
if (!blobReader.TryReadCompressedInteger(out syntaxOffset))
{
// invalid data
return default(ImmutableArray<LocalSlotDebugInfo>);
}
syntaxOffset += syntaxOffsetBaseline;
int ordinal = 0;
if (hasOrdinal && !blobReader.TryReadCompressedInteger(out ordinal))
{
// invalid data
return default(ImmutableArray<LocalSlotDebugInfo>);
}
mapBuilder.Add(new LocalSlotDebugInfo(kind, new LocalDebugId(syntaxOffset, ordinal)));
}
}
return mapBuilder.ToImmutableAndFree();
}
示例6: LocalData
public void LocalData( ImmutableArray<Type> sut, ImmutableArray<Assembly> assemblies )
{
var items = sut.ToArray();
var expected = GetType().Adapt().WithNested().Concat( FormatterTypesAttribute.Types ).Fixed();
Assert.Equal( expected.Length, items.Length );
Assert.Equal( expected.OrderBy( type => type.FullName ), items.OrderBy( type => type.FullName ) );
var actual = assemblies.ToArray().ToImmutableHashSet();
Assert.Equal( expected.Assemblies().ToImmutableHashSet(), actual );
Assert.Contains( GetType().Assembly, actual );
}
示例7: UncompressSlotMap
/// <exception cref="InvalidDataException">Invalid data.</exception>
private unsafe static ImmutableArray<LocalSlotDebugInfo> UncompressSlotMap(ImmutableArray<byte> compressedSlotMap)
{
if (compressedSlotMap.IsDefaultOrEmpty)
{
return default(ImmutableArray<LocalSlotDebugInfo>);
}
var mapBuilder = ArrayBuilder<LocalSlotDebugInfo>.GetInstance();
int syntaxOffsetBaseline = -1;
fixed (byte* compressedSlotMapPtr = &compressedSlotMap.ToArray()[0])
{
var blobReader = new BlobReader(compressedSlotMapPtr, compressedSlotMap.Length);
while (blobReader.RemainingBytes > 0)
{
try
{
// Note: integer operations below can't overflow since compressed integers are in range [0, 0x20000000)
byte b = blobReader.ReadByte();
if (b == SyntaxOffsetBaseline)
{
syntaxOffsetBaseline = -blobReader.ReadCompressedInteger();
continue;
}
if (b == 0)
{
// short-lived temp, no info
mapBuilder.Add(new LocalSlotDebugInfo(SynthesizedLocalKind.LoweringTemp, default(LocalDebugId)));
continue;
}
var kind = (SynthesizedLocalKind)((b & 0x3f) - 1);
bool hasOrdinal = (b & (1 << 7)) != 0;
int syntaxOffset = blobReader.ReadCompressedInteger() + syntaxOffsetBaseline;
int ordinal = hasOrdinal ? blobReader.ReadCompressedInteger() : 0;
mapBuilder.Add(new LocalSlotDebugInfo(kind, new LocalDebugId(syntaxOffset, ordinal)));
}
catch (BadImageFormatException)
{
throw CreateInvalidDataException(compressedSlotMap, blobReader.Offset);
}
}
}
return mapBuilder.ToImmutableAndFree();
}
示例8: Create
internal static StrongNameKeys Create(ImmutableArray<byte> publicKey, CommonMessageProvider messageProvider)
{
Debug.Assert(!publicKey.IsDefaultOrEmpty);
if (MetadataHelpers.IsValidPublicKey(publicKey))
{
return new StrongNameKeys(default(ImmutableArray<byte>), publicKey, null, null);
}
else
{
return new StrongNameKeys(messageProvider.CreateDiagnostic(messageProvider.ERR_BadCompilationOptionValue, Location.None,
nameof(CompilationOptions.CryptoPublicKey), BitConverter.ToString(publicKey.ToArray())));
}
}
示例9: DiagnosticArguments
public DiagnosticArguments(
bool reportSuppressedDiagnostics,
bool logAnalyzerExecutionTime,
ProjectId projectId,
ImmutableArray<byte[]> hostAnalyzerChecksums,
string[] analyzerIds)
{
ReportSuppressedDiagnostics = reportSuppressedDiagnostics;
LogAnalyzerExecutionTime = logAnalyzerExecutionTime;
ProjectIdGuid = projectId.Id;
ProjectIdDebugName = projectId.DebugName;
HostAnalyzerChecksumsByteArray = hostAnalyzerChecksums.ToArray();
AnalyzerIds = analyzerIds;
}
示例10: DiagnosticArguments
public DiagnosticArguments(
bool reportSuppressedDiagnostics,
bool logAnalyzerExecutionTime,
ProjectId projectId,
Checksum optionSetChecksum,
ImmutableArray<Checksum> hostAnalyzerChecksums,
string[] analyzerIds)
{
ReportSuppressedDiagnostics = reportSuppressedDiagnostics;
LogAnalyzerExecutionTime = logAnalyzerExecutionTime;
ProjectId = projectId;
OptionSetChecksum = optionSetChecksum;
HostAnalyzerChecksums = hostAnalyzerChecksums.ToArray();
AnalyzerIds = analyzerIds;
}
示例11: CreateServerTicket
public static ImmutableArray<byte> CreateServerTicket(
SteamID id, ImmutableArray<byte> auth, byte[] ownershipTicket) {
long size = 8 + // steam ID
auth.Length +
4 + // length of ticket
ownershipTicket.Length;
MemoryStream stream = new MemoryStream();
using (var writer = new BinaryWriter(stream)) {
writer.Write((ushort) size);
writer.Write(id.ConvertToUInt64());
writer.Write(auth.ToArray());
writer.Write(ownershipTicket.Length);
writer.Write(ownershipTicket);
writer.Write(0);
}
return stream.ToArray().ToImmutableArray();
}
示例12: CastToBigInteger
private BigInteger CastToBigInteger(ImmutableArray<byte> value)
{
return new BigInteger(value.ToArray());
}
示例13: CreateReader
public static ISymUnmanagedReader CreateReader(ImmutableArray<byte> pdbImage, ImmutableArray<byte> peImageOpt = default(ImmutableArray<byte>))
{
return CreateReader(new MemoryStream(pdbImage.ToArray()), peImageOpt.IsDefault ? null : new MemoryStream(peImageOpt.ToArray()));
}
示例14: FormatSignature
private unsafe string FormatSignature(ImmutableArray<byte> signature)
{
// TODO:
// A null reference, the type is encoded in the signature.
// Ideally we would parse the signature and display the target type name.
// That requires MetadataReader vNext though.
return BitConverter.ToString(signature.ToArray());
}
示例15: SetPathsAsync
public async Task SetPathsAsync(ImmutableArray<string> referenceSearchPaths, ImmutableArray<string> sourceSearchPaths, string workingDirectory)
{
try
{
var result = await _interactiveHost.SetPathsAsync(referenceSearchPaths.ToArray(), sourceSearchPaths.ToArray(), workingDirectory).ConfigureAwait(false);
UpdateResolvers(result);
}
catch (Exception e) when (FatalError.Report(e))
{
throw ExceptionUtilities.Unreachable;
}
}