當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。