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


C# Key.AddToken方法代码示例

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


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

示例3: Test10_8_Gen3ParB16Bit55555

 public void Test10_8_Gen3ParB16Bit55555()
 {
     try
     {
         int lopcnt;
         for (lopcnt = 1; lopcnt < 30; lopcnt++)
         {
             var gkey = new Key("vvvvppppxxxxxxxxxxxx-wwwwwwwwxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
             gkey.AddToken(new SimpleToken('v', 1));
             gkey.AddToken(new SimpleToken('p', 2));
             gkey.AddToken(new SimpleToken('w', "QR"));
             var finalkey = gkey.CreateKey();
             if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4) / 4))
             {
                 throw new Exception("Keys are not the same length");
             }
         }
     }
     catch (Exception e)
     {
         Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
     }
 }
开发者ID:RossMerr,项目名称:LicenseKey2,代码行数:23,代码来源:IntegrationTests.cs

示例4: Test10_Gen3ParB16Bit55555

        public void Test10_Gen3ParB16Bit55555()
        {
            int lopcnt;

            try
            {
                Key gkey;
                string finalkey;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    gkey =
                        new Key(
                            "vvvvppppxxxxxxxxxxxx-wwwwwwwwxxxxxxxxxxxx-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.Character, "QR");
                    finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4)/4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
开发者ID:RossMerr,项目名称:LicenseKey2,代码行数:29,代码来源:IntegrationTests.cs

示例5: Test0_5_Gen2ParB16Bit55555

        public void Test0_5_Gen2ParB16Bit55555()
        {
            int lopcnt;

            try
            {
                Key gkey;
                string finalkey;

                for (lopcnt = 1; lopcnt < 30; lopcnt++)
                {
                    gkey =
                        new Key(
                            "vvvvvvvvppppxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx");
                    gkey.AddToken(new SimpleToken('v', "11"));
                    gkey.AddToken(new SimpleToken('p', "2"));
                    finalkey = gkey.CreateKey();
                    if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4)/4))
                    {
                        throw new Exception("Keys are not the same length");
                    }
                }
            }
            catch (Exception e)
            {
                Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message);
            }
        }
开发者ID:RossMerr,项目名称:LicenseKey2,代码行数:28,代码来源:IntegrationTests.cs


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