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


C# BitcoinStream.ReadWriteAsCompactVarInt方法代码示例

本文整理汇总了C#中BitcoinStream.ReadWriteAsCompactVarInt方法的典型用法代码示例。如果您正苦于以下问题:C# BitcoinStream.ReadWriteAsCompactVarInt方法的具体用法?C# BitcoinStream.ReadWriteAsCompactVarInt怎么用?C# BitcoinStream.ReadWriteAsCompactVarInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitcoinStream的用法示例。


在下文中一共展示了BitcoinStream.ReadWriteAsCompactVarInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadWrite

		public void ReadWrite(BitcoinStream stream)
		{
			if(stream.Serializing)
			{
				uint o = (uint)(nHeight * 2 + (fCoinBase ? 1 : 0));
				stream.ReadWriteAsCompactVarInt(ref o);
				if(nHeight > 0)
					stream.ReadWriteAsCompactVarInt(ref nVersion);
				TxOutCompressor compressor = new TxOutCompressor(txout);
				stream.ReadWrite(ref compressor);
			}
			else
			{
				uint nCode = 0;
				stream.ReadWriteAsCompactVarInt(ref nCode);
				nHeight = nCode / 2;
				fCoinBase = (nCode & 1) != 0;
				if(nHeight > 0)
					stream.ReadWriteAsCompactVarInt(ref nVersion);
				TxOutCompressor compressor = new TxOutCompressor();
				stream.ReadWrite(ref compressor);
				txout = compressor.TxOut;
			}
		}
开发者ID:crowar,项目名称:NBitcoin,代码行数:24,代码来源:BlockUndo.cs

示例2: ReadWrite

 public void ReadWrite(BitcoinStream stream)
 {
     if(stream.Serializing)
     {
         var compr = Compress();
         if(compr != null)
         {
             stream.ReadWrite(ref compr);
             return;
         }
         uint nSize = (uint)_Script.Length + nSpecialScripts;
         stream.ReadWriteAsCompactVarInt(ref nSize);
         stream.ReadWrite(ref _Script);
     }
     else
     {
         uint nSize = 0;
         stream.ReadWriteAsCompactVarInt(ref nSize);
         if(nSize < nSpecialScripts)
         {
             byte[] vch = new byte[GetSpecialSize(nSize)];
             stream.ReadWrite(ref vch);
             _Script = Decompress(nSize, vch).ToRawScript();
             return;
         }
         nSize -= nSpecialScripts;
         _Script = new byte[nSize];
         stream.ReadWrite(ref _Script);
     }
 }
开发者ID:royosherove,项目名称:NBitcoin,代码行数:30,代码来源:Transaction.cs

示例3: ReadWrite

 public void ReadWrite(BitcoinStream stream)
 {
     stream.ReadWrite(ref _Add);
     stream.ReadWriteAsCompactVarInt(ref _HeightOrBackstep);
     if(_Add)
     {
         stream.ReadWrite(ref _BlockHeader);
     }
 }
开发者ID:royosherove,项目名称:NBitcoin,代码行数:9,代码来源:Chain.cs


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