本文整理汇总了C#中Key.ToActualString方法的典型用法代码示例。如果您正苦于以下问题:C# Key.ToActualString方法的具体用法?C# Key.ToActualString怎么用?C# Key.ToActualString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Key
的用法示例。
在下文中一共展示了Key.ToActualString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button2_Click
private void button2_Click(object sender, EventArgs e)
{
bool toReturn = false;
if (tbRandomNumber.Text == string.Empty)
toReturn = true;
if (tbNumOfUsers.Text == string.Empty)
toReturn = true;
if (tbMinorVersion.Text == string.Empty)
toReturn = true;
if (tbMajorVersion.Text == string.Empty)
toReturn = true;
if (toReturn)
{
MessageBox.Show("Missing required field.");
return;
}
if (Convert.ToInt32(tbNumOfUsers.Text) > 255)
{
MessageBox.Show("Too many bits (255 Max)");
return;
}
StringBuilder inputString = new StringBuilder();
//[_DDD][04][01][2007][10][10][2][A8][RAND]
try
{
inputString.Append(productKeyMapping[Convert.ToString(cbProductName.SelectedItem)]);
}
catch
{
MessageBox.Show("Error trying to handle product code.");
return;
}
try
{
if (tbMajorVersion.Text.Length == 1)
inputString.Append("0");
inputString.Append(tbMajorVersion.Text);
if (tbMinorVersion.Text.Length == 1)
inputString.Append("0");
inputString.Append(tbMinorVersion.Text);
inputString.AppendFormat("{0:yyyyMMdd}", dtExpirationDate.Value);
inputString.Append(cbLicenseType.SelectedIndex);
inputString.Append(AptimaLicenseVerifier.ConvertNumberStringToHex(tbNumOfUsers.Text));
inputString.Append(tbRandomNumber.Text);
}
catch
{
throw new Exception("Error trying to create input string");
}
labelInputString.Text = inputString.ToString();
labelLength2.Text = String.Format("Length: {0}", labelInputString.Text.Length);
//tbLicenseKey.Text = AptimaLicenseVerifier.GenerateLicenseKey(labelInputString.Text);
_licenseKey = new Key(AptimaLicenseVerifier.GenerateLicenseKey(labelInputString.Text));
tbLicenseKey.Text = _licenseKey.ToString();
labelLength.Text = String.Format("Length: {0}", _licenseKey.ToActualString().Length);
}