Defaulting to short.MaxValue if user entry is blank

This commit is contained in:
Nagy László 2020-11-24 10:45:25 +01:00
parent c2edb61a45
commit 21ee454605
1 changed files with 10 additions and 3 deletions

View File

@ -119,12 +119,19 @@ namespace bitwardenSelfLicensor
{
WriteLineOver("Extra storage space for the user " + name + ". (max.: " + short.MaxValue + ") [storage]");
buff = Console.ReadLine();
if (checkStorage(buff)) storage = short.Parse(buff);
if (string.IsNullOrWhiteSpace(buff))
{
storage = short.MaxValue;
}
else
{
if (checkStorage(buff)) storage = short.Parse(buff);
}
}
if (licensetype == "user")
{
WriteLineOver("Confirm creation of \"user\" license for username: \"" + name + "\", email: \"" + email + "\", User-GUID: \"" + guid + "\"? Y/n");
WriteLineOver("Confirm creation of \"user\" license for username: \"" + name + "\", email: \"" + email + "\", Storage: \"" + storage + " GB\", User-GUID: \"" + guid + "\"? Y/n");
buff = Console.ReadLine();
if ( buff == "" || buff == "y" || buff == "Y" )
{
@ -138,7 +145,7 @@ namespace bitwardenSelfLicensor
}
else if (licensetype == "org")
{
WriteLineOver("Confirm creation of \"organization\" license for business name: \"" + businessname + "\", username: \"" + name + "\", email: \"" + email + "\", Install-ID: \"" + installid + "\"? Y/n");
WriteLineOver("Confirm creation of \"organization\" license for business name: \"" + businessname + "\", username: \"" + name + "\", email: \"" + email + "\", Storage: \"" + storage + " GB\", Install-ID: \"" + installid + "\"? Y/n");
buff = Console.ReadLine();
if ( buff == "" || buff == "y" || buff == "Y" )
{