Files
rockfish/util/fetchkeycode.cs
2018-06-28 23:37:38 +00:00

35 lines
896 B
C#

using System;
namespace rockfishCore.Util
{
//Generate a random code for license key fetching
//doesn't have to be perfect, it's only temporary and
//requires knowledge of the customer / trial user
//email address to use it so it's kind of 2 factor
public static class FetchKeyCode
{
public static string generate()
{
//sufficient for this purpose
//https://stackoverflow.com/a/1344258/8939
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
var stringChars = new char[10];
var random = new Random();
for (int i = 0; i < stringChars.Length; i++)
{
stringChars[i] = chars[random.Next(chars.Length)];
}
var finalString = new String(stringChars);
return finalString;
}
}//eoc
}//eons