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


C# Key.DisassembleKey方法代码示例

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


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

示例1: Test17_Gen5DisParB16BitChk255555

        public void Test17_Gen5DisParB16BitChk255555()
        {
            int lopcnt;

            try
            {
                string result;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    var gkey = new Key("vvvvvvvvppppxxxxxxxx-wwwwxxxxxxxxxxxxxxxx-ssssssssxxxxxxxxxxxx-xxxxxxxxxxxxcccccccc-xxxxxxxxxxxxxxxxrrrr", Checksum.ChecksumType.Type2);
                    gkey.AddToken(0, "v", Key.TokenTypes.Number, "34");
                    gkey.AddToken(1, "p", Key.TokenTypes.Number, "6");
                    gkey.AddToken(2, "w", Key.TokenTypes.Number, "8");
                    gkey.AddToken(3, "s", Key.TokenTypes.Number, "AB");
                    gkey.AddToken(4, "r", Key.TokenTypes.Number, "3");
                    var finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4)/4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                    result = gkey.DisassembleKey("v");
                    if (result != "34")
                    {
                        throw new Exception("The first tokens are not equal");
                    }
                    result = gkey.DisassembleKey("p");
                    if (result != "6")
                    {
                        throw new Exception("The second tokens are not equal");
                    }
                    result = gkey.DisassembleKey("w");
                    if (result != "8")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                    result = gkey.DisassembleKey("s");
                    if (result != "AB")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                    result = gkey.DisassembleKey("r");
                    if (result != "3")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
开发者ID:RossMerr,项目名称:LicenseKey2,代码行数:53,代码来源:IntegrationTests.cs

示例2: Test14_Gen3DisParB16Bit55555

        public void Test14_Gen3DisParB16Bit55555()
        {
            int lopcnt;

            try
            {
                Key gkey;
                string finalkey;
                string result;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    gkey =
                        new Key(
                            "vvvvppppxxxxxxxxxxxx-wwwwxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
                    gkey.AddToken(0, "v", Key.TokenTypes.Number, "1");
                    gkey.AddToken(1, "p", Key.TokenTypes.Number, "2");
                    gkey.AddToken(2, "w", Key.TokenTypes.Number, "6");
                    finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4)/4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                    result = gkey.DisassembleKey("v");
                    if (result != "1")
                    {
                        throw new Exception("The first tokens are not equal");
                    }
                    result = gkey.DisassembleKey("p");
                    if (result != "2")
                    {
                        throw new Exception("The second tokens are not equal");
                    }
                    result = gkey.DisassembleKey("w");
                    if (result != "6")
                    {
                        throw new Exception("The third tokens are not equal");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
开发者ID:RossMerr,项目名称:LicenseKey2,代码行数:45,代码来源:IntegrationTests.cs


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