本文整理汇总了C#中System.IO.BinaryWriter.WriteVarBytes方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WriteVarBytes方法的具体用法?C# BinaryWriter.WriteVarBytes怎么用?C# BinaryWriter.WriteVarBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WriteVarBytes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EncodeNetworkAddressKey
public static void EncodeNetworkAddressKey(BinaryWriter writer, NetworkAddressKey networkAddressKey)
{
writer.WriteVarBytes(networkAddressKey.IPv6Address.ToArray());
writer.Write(networkAddressKey.Port);
}
示例2: Append
internal void Append(BinaryWriter wr)
{
wr.WriteVarBytes(_certificateHash);
wr.WriteVarBytes(AES.IV);
wr.WriteVarBytes(_encryptedKey);
}
示例3: EncodePrevTxOutput
public static void EncodePrevTxOutput(BinaryWriter writer, PrevTxOutput txOutput)
{
writer.WriteUInt64(txOutput.Value);
writer.WriteVarBytes(txOutput.ScriptPublicKey.ToArray());
writer.WriteInt32(txOutput.BlockHeight);
writer.WriteInt32(txOutput.TxIndex);
writer.WriteUInt32(txOutput.TxVersion);
writer.WriteBool(txOutput.IsCoinbase);
}
示例4: EncodeUnspentTx
public static void EncodeUnspentTx(BinaryWriter writer, UnspentTx unspentTx)
{
writer.WriteUInt256(unspentTx.TxHash);
writer.WriteInt32(unspentTx.BlockIndex);
writer.WriteInt32(unspentTx.TxIndex);
writer.WriteUInt32(unspentTx.TxVersion);
writer.WriteBool(unspentTx.IsCoinbase);
writer.WriteVarBytes(unspentTx.OutputStates.ToByteArray());
writer.WriteInt32(unspentTx.OutputStates.Length);
}
示例5: EncodeTxInput
public static void EncodeTxInput(BinaryWriter writer, TxInput txInput)
{
writer.WriteUInt256(txInput.PrevTxOutputKey.TxHash);
writer.WriteUInt32(txInput.PrevTxOutputKey.TxOutputIndex);
writer.WriteVarBytes(txInput.ScriptSignature.ToArray());
writer.WriteUInt32(txInput.Sequence);
}
示例6: EncodeTxOutput
public static void EncodeTxOutput(BinaryWriter writer, TxOutput txOutput)
{
writer.WriteUInt64(txOutput.Value);
writer.WriteVarBytes(txOutput.ScriptPublicKey.ToArray());
}
示例7: EncodeChainedHeader
public static void EncodeChainedHeader(BinaryWriter writer, ChainedHeader chainedHeader)
{
writer.WriteUInt256(chainedHeader.Hash);
EncodeBlockHeader(writer, chainedHeader.BlockHeader);
writer.WriteInt32(chainedHeader.Height);
writer.WriteVarBytes(chainedHeader.TotalWork.ToByteArray());
writer.WriteInt64(chainedHeader.DateSeen.UtcTicks);
}
示例8: WriteToStream
internal void WriteToStream(BinaryWriter wr)
{
wr.Write(Type);
wr.WriteVarBytes(Preamble);
wr.WriteVarBytes(Data);
}
示例9: EncodeTransaction
public static byte[] EncodeTransaction(UInt32 Version, ImmutableArray<TxInput> Inputs, ImmutableArray<TxOutput> Outputs, UInt32 LockTime)
{
var stream = new MemoryStream();
using (var writer = new BinaryWriter(stream))
{
writer.Write4Bytes(Version);
writer.WriteVarInt((UInt64)Inputs.Length);
foreach (var input in Inputs)
{
writer.Write32Bytes(input.PreviousTxOutputKey.TxHash);
writer.Write4Bytes(input.PreviousTxOutputKey.TxOutputIndex);
writer.WriteVarBytes(input.ScriptSignature.ToArray());
writer.Write4Bytes(input.Sequence);
}
writer.WriteVarInt((UInt64)Outputs.Length);
foreach (var output in Outputs)
{
writer.Write8Bytes(output.Value);
writer.WriteVarBytes(output.ScriptPublicKey.ToArray());
}
writer.Write4Bytes(LockTime);
return stream.ToArray();
}
}
示例10: EncodeTxOutput
public static void EncodeTxOutput(Stream stream, TxOutput txOutput)
{
using (var writer = new BinaryWriter(stream, Encoding.ASCII, leaveOpen: true))
{
writer.Write8Bytes(txOutput.Value);
writer.WriteVarBytes(txOutput.ScriptPublicKey.ToArray());
}
}
示例11: EncodeTxInput
public static void EncodeTxInput(Stream stream, TxInput txInput)
{
using (var writer = new BinaryWriter(stream, Encoding.ASCII, leaveOpen: true))
{
writer.Write32Bytes(txInput.PreviousTxOutputKey.TxHash);
writer.Write4Bytes(txInput.PreviousTxOutputKey.TxOutputIndex);
writer.WriteVarBytes(txInput.ScriptSignature.ToArray());
writer.Write4Bytes(txInput.Sequence);
}
}