本文整理汇总了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);
}
}
示例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);
}
}