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