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


C# Script.ToString方法代码示例

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


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

示例1: BIP65_tests

		public void BIP65_tests()
		{
			BIP65_testsCore(
				Utils.UnixTimeToDateTime(510000000),
				Utils.UnixTimeToDateTime(509999999),
				false);
			BIP65_testsCore(
				Utils.UnixTimeToDateTime(510000000),
				Utils.UnixTimeToDateTime(510000000),
				true);
			BIP65_testsCore(
				Utils.UnixTimeToDateTime(510000000),
				Utils.UnixTimeToDateTime(510000001),
				true);

			BIP65_testsCore(
				1000,
				999,
				false);
			BIP65_testsCore(
				1000,
				1000,
				true);
			BIP65_testsCore(
				1000,
				1001,
				true);

			//Bad comparison
			BIP65_testsCore(
				1000,
				Utils.UnixTimeToDateTime(510000001),
				false);
			BIP65_testsCore(
				Utils.UnixTimeToDateTime(510000001),
				1000,
				false);

			Script s = new Script(OpcodeType.OP_CHECKLOCKTIMEVERIFY);
			Assert.Equal("OP_CLTV", s.ToString());
			s = new Script("OP_CHECKLOCKTIMEVERIFY");
			Assert.Equal("OP_CLTV", s.ToString());

			s = new Script("OP_NOP2");
			Assert.Equal("OP_CLTV", s.ToString());

			s = new Script("OP_HODL");
			Assert.Equal("OP_CLTV", s.ToString());
		}
开发者ID:vebin,项目名称:NBitcoin,代码行数:49,代码来源:script_tests.cs

示例2: P2PKHScriptSigShouldNotBeMistakenForP2SHScriptSig

		public void P2PKHScriptSigShouldNotBeMistakenForP2SHScriptSig()
		{
			var p2pkhScriptSig = new Script("304402206e3f2f829644ffe78b56ec8d0ea3715aee66e533a8195220bdea1526dc6ed3b202205eabcae791abfea55d54f8ec4e6de1bad1f7aa90e91687e81150b411e457025701 029f4485fddb359aeed82d71dc8df2fb0e83e31601c749d468ea92c99c13c5558b");
			p2pkhScriptSig.ToString();
			var result = PayToScriptHashTemplate.Instance.ExtractScriptSigParameters(p2pkhScriptSig);

			Assert.Null(result);
		}
开发者ID:vebin,项目名称:NBitcoin,代码行数:8,代码来源:script_tests.cs

示例3: Script

        /// <summary>
        /// For use with Append() and AppendLine()
        /// </summary>
        /// <param name="script">The script style to apply to the last appended text.</param>
        /// <returns>This Paragraph with the last appended text's script style changed.</returns>
        /// <example>
        /// Append text to this Paragraph and then set it to superscript.
        /// <code>
        /// // Create a document.
        /// using (DocX document = DocX.Create(@"Test.docx"))
        /// {
        ///     // Insert a new Paragraph.
        ///     Paragraph p = document.InsertParagraph();
        ///
        ///     p.Append("I am ")
        ///     .Append("superscript").Script(Script.superscript)
        ///     .Append(" I am not");
        ///        
        ///     // Save this document.
        ///     document.Save();
        /// }// Release this document from memory.
        /// </code>
        /// </example>
        public Paragraph Script(Script script)
        {
            switch (script)
            {
                case Novacode.Script.none:
                    break;

                default:
                    {
                        ApplyTextFormattingProperty(XName.Get("vertAlign", DocX.w.NamespaceName), string.Empty, new XAttribute(XName.Get("val", DocX.w.NamespaceName), script.ToString()));
                        break;
                    }
            }

            return this;
        }
开发者ID:kozanid,项目名称:DocX,代码行数:39,代码来源:Paragraph.cs

示例4: CanParseAndGeneratePayToPubKeyScript

		public void CanParseAndGeneratePayToPubKeyScript()
		{
			var scriptPubKey = new Script("OP_DUP OP_HASH160 b72a6481ec2c2e65aa6bd9b42e213dce16fc6217 OP_EQUALVERIFY OP_CHECKSIG");
			var pubKey = PayToPubkeyHashTemplate.Instance.ExtractScriptPubKeyParameters(scriptPubKey);
			Assert.Equal("b72a6481ec2c2e65aa6bd9b42e213dce16fc6217", pubKey.ToString());
			var scriptSig = new Script("3044022064f45a382a15d3eb5e7fe72076eec4ef0f56fde1adfd710866e729b9e5f3383d02202720a895914c69ab49359087364f06d337a2138305fbc19e20d18da78415ea9301 0364bd4b02a752798342ed91c681a48793bb1c0853cbcd0b978c55e53485b8e27c");

			var sigResult = PayToPubkeyHashTemplate.Instance.ExtractScriptSigParameters(scriptSig);
			Assert.Equal("3044022064f45a382a15d3eb5e7fe72076eec4ef0f56fde1adfd710866e729b9e5f3383d02202720a895914c69ab49359087364f06d337a2138305fbc19e20d18da78415ea9301", Encoders.Hex.EncodeData(sigResult.TransactionSignature.ToBytes()));
			Assert.Equal("0364bd4b02a752798342ed91c681a48793bb1c0853cbcd0b978c55e53485b8e27c", sigResult.PublicKey.ToString());

			Assert.Equal(PayToPubkeyHashTemplate.Instance.GenerateScriptSig(sigResult.TransactionSignature, sigResult.PublicKey).ToString(), scriptSig.ToString());
			Assert.Equal(PayToPubkeyHashTemplate.Instance.GenerateScriptPubKey(pubKey).ToString(), scriptPubKey.ToString());

			scriptSig = new Script("0 0364bd4b02a752798342ed91c681a48793bb1c0853cbcd0b978c55e53485b8e27c");

			sigResult = PayToPubkeyHashTemplate.Instance.ExtractScriptSigParameters(scriptSig);
			Assert.Null(sigResult.TransactionSignature);

			var scriptSig2 = PayToPubkeyHashTemplate.Instance.GenerateScriptSig(sigResult);
			Assert.Equal(scriptSig.ToString(), scriptSig2.ToString());
		}
开发者ID:vebin,项目名称:NBitcoin,代码行数:22,代码来源:script_tests.cs

示例5: CanParseColorMarker

		public void CanParseColorMarker()
		{
			var script = new Script(Encoders.Hex.DecodeData("6a104f41010003ac0200e58e260412345678"));
			var marker = ColorMarker.TryParse(script);
			Assert.NotNull(marker);
			Assert.Equal(1, marker.Version);
			Assert.Equal(3, marker.Quantities.Length);
			Assert.True(marker.Quantities.SequenceEqual(new ulong[] { 300, 0, 624485 }));
			Assert.True(marker.Metadata.SequenceEqual(new byte[] { 0x12, 0x34, 0x56, 0x78 }));
			Assert.Equal(script.ToString(), marker.GetScript().ToString());
		}
开发者ID:hu53yin,项目名称:NBitcoin,代码行数:11,代码来源:ColoredCoinsTests.cs


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