Skip to content

Commit

Permalink
(chocolateyGH-1075) Add Architect license type SKU
Browse files Browse the repository at this point in the history
Add the sku for Chocolatey for Architect edition and update
Rhino.Licensing.dll in the project.

Clean up the method of discovering the license so that it automatically
flips between the rhino license type and Chocolatey's license type.
  • Loading branch information
ferventcoder authored and Russell Mora committed Jan 23, 2017
1 parent b3f2360 commit 1255507
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
Binary file modified lib/Rhino.Licensing/Rhino.Licensing.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public enum ChocolateyLicenseType
Foss,
Professional,
BusinessTrial,
Architect,
ManagedServiceProvider,
Educational,
Business,
Expand Down
36 changes: 17 additions & 19 deletions src/chocolatey/infrastructure/licensing/LicenseValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,26 @@ public static ChocolateyLicense validate()
"chocolatey".Log().Error("A license was found for a licensed version of Chocolatey, but is invalid:{0} {1}".format_with(Environment.NewLine, e.Message));
}

switch (license.LicenseType)
var chocolateyLicenseType = ChocolateyLicenseType.Unknown;
try
{
Enum.TryParse(license.LicenseType.to_string(), true, out chocolateyLicenseType);
}
catch (Exception)
{
chocolateyLicenseType = ChocolateyLicenseType.Unknown;
}

if (license.LicenseType == LicenseType.Trial)
{
chocolateyLicenseType = ChocolateyLicenseType.BusinessTrial;
}
else if (license.LicenseType == LicenseType.Education)
{
case LicenseType.Professional :
chocolateyLicense.LicenseType = ChocolateyLicenseType.Professional;
break;
case LicenseType.Trial:
chocolateyLicense.LicenseType = ChocolateyLicenseType.BusinessTrial;
break;
case LicenseType.ManagedServiceProvider:
chocolateyLicense.LicenseType = ChocolateyLicenseType.ManagedServiceProvider;
break;
case LicenseType.Education:
chocolateyLicense.LicenseType = ChocolateyLicenseType.Educational;
break;
case LicenseType.Business :
chocolateyLicense.LicenseType = ChocolateyLicenseType.Business;
break;
case LicenseType.Enterprise :
chocolateyLicense.LicenseType = ChocolateyLicenseType.Enterprise;
break;
chocolateyLicenseType = ChocolateyLicenseType.Educational;
}

chocolateyLicense.LicenseType = chocolateyLicenseType;
chocolateyLicense.ExpirationDate = license.ExpirationDate;
chocolateyLicense.Name = license.Name;
chocolateyLicense.Id = license.UserId.to_string();
Expand Down

0 comments on commit 1255507

Please sign in to comment.