当前位置: 首页>>代码示例>>C#>>正文


C# BinaryWriter.WriteVarBytes方法代码示例

本文整理汇总了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);
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:5,代码来源:NodeEncoder.cs

示例2: Append

		internal void Append(BinaryWriter wr)
		{
			wr.WriteVarBytes(_certificateHash);
			wr.WriteVarBytes(AES.IV);
			wr.WriteVarBytes(_encryptedKey);
		}
开发者ID:cssack,项目名称:CsGlobals,代码行数:6,代码来源:CipherBlock.cs

示例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);
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:9,代码来源:DataEncoder.cs

示例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);
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:10,代码来源:DataEncoder.cs

示例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);
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:7,代码来源:DataEncoder.cs

示例6: EncodeTxOutput

 public static void EncodeTxOutput(BinaryWriter writer, TxOutput txOutput)
 {
     writer.WriteUInt64(txOutput.Value);
     writer.WriteVarBytes(txOutput.ScriptPublicKey.ToArray());
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:5,代码来源:DataEncoder.cs

示例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);
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:8,代码来源:DataEncoder.cs

示例8: WriteToStream

		internal void WriteToStream(BinaryWriter wr)
		{
			wr.Write(Type);
			wr.WriteVarBytes(Preamble);
			wr.WriteVarBytes(Data);
		}
开发者ID:cssack,项目名称:CsGlobals,代码行数:6,代码来源:SessionVariables.cs

示例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();
            }
        }
开发者ID:holinov,项目名称:BitSharp,代码行数:25,代码来源:DataCalculator.cs

示例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());
     }
 }
开发者ID:knocte,项目名称:BitSharp,代码行数:8,代码来源:NetworkEncoder.cs

示例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);
     }
 }
开发者ID:knocte,项目名称:BitSharp,代码行数:10,代码来源:NetworkEncoder.cs


注:本文中的System.IO.BinaryWriter.WriteVarBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。