subscription license code additions

This commit is contained in:
2022-08-17 03:03:48 +00:00
parent 7d2076d1c7
commit b9d33ff036
11 changed files with 91 additions and 25 deletions

View File

@@ -41,8 +41,8 @@ namespace AyaNova.Core
private const string LICENSE_SERVER_URL_ROCKFISH = "https://rockfish.ayanova.com/";
#endif
//CRITICAL PROBLEM IF THIS IS TRUE
#if(DEVELOPMENT_TEST_ROCKFISH && !DEBUG)
//CRITICAL PROBLEM IF THIS IS TRUE
#if (DEVELOPMENT_TEST_ROCKFISH && !DEBUG)
#error ### HOLDUP: DEVELOPMENT_TEST_ROCKFISH is defined in a RELEASE BUILD!!!!
#endif
@@ -51,7 +51,7 @@ namespace AyaNova.Core
private const string LICENSE_SERVER_URL_EUROPA = "https://europa.ayanova.com/";
private const string LICENSE_SERVER_URL_CALLISTO = "https://callisto.ayanova.com/";
internal const string LICENSE_MISMATCH_TO_BUILD_ERROR = "E1020 - Not licensed for this version of AyaNova. Fix: revert to previous version used or contact technical support for options";
//Unlicensed token
private const string UNLICENSED_TOKEN = "UNLICENSED";
@@ -417,6 +417,7 @@ namespace AyaNova.Core
serverDbId = ServerDbId,
licensedTo = ActiveKey.RegisteredTo,
dbId = ActiveKey.DbId,
perpetual = ActiveKey.Perpetual,
keySerial = ActiveKey.Id,
licenseExpiration = ActiveKey.LicenseExpiration,
licenseWillExpire = ActiveKey.WillExpire,
@@ -902,7 +903,10 @@ EQIDAQAB
key.Id = (string)token.SelectToken("Key.Id");
key.RegisteredTo = (string)token.SelectToken("Key.RegisteredTo");
key.DbId = (string)token.SelectToken("Key.DBID");
key.Perpetual = (bool)token.SelectToken("Key.Perpetual");
if (token.SelectToken("Key.Perpetual") != null)
key.Perpetual = (bool)token.SelectToken("Key.Perpetual");
else
key.Perpetual = true;
if (key.DbId != ServerDbId)
throw new ApplicationException($"E1020 - License.Parse -> License key does not match this server");
@@ -932,11 +936,29 @@ EQIDAQAB
//Check if attempting to use a build of AyaNova that is newer than maintenance subscription expiry
if (MExBB(Util.FileUtil.GetLinkerTimestampUtc(System.Reflection.Assembly.GetExecutingAssembly()), key))
{
Console.WriteLine("E1020 - Not licensed for this version of AyaNova. Fix: downgrade back to previous version in use or contact technical support for options.");
Console.WriteLine(LICENSE_MISMATCH_TO_BUILD_ERROR);
//NOTE: VERSION-TOO-NEW bit below is checked for in startup.cs DO NOT remove this without fixing the side effects
throw new ApplicationException("E1020 VERSION-TOO-NEW - Not licensed for this version of AyaNova. Fix: downgrade back to previous version in use or contact technical support for options.");
//NOTE: LICENSE_MISMATCH_TO_BUILD_ERROR matched for in startup.cs DO NOT change this without fixing the side effects
throw new ApplicationException(LICENSE_MISMATCH_TO_BUILD_ERROR);
}
//Subscription licenses only for subscription builds and Perpetual licenses only for Perpetual builds
#if (SUBSCRIPTION_BUILD)
if(key.Perpetual){
Console.WriteLine(LICENSE_MISMATCH_TO_BUILD_ERROR);
//NOTE: LICENSE_MISMATCH_TO_BUILD_ERROR bit below is checked for in startup.cs DO NOT remove this without fixing the side effects
throw new ApplicationException(LICENSE_MISMATCH_TO_BUILD_ERROR);
}
#else
if (!key.Perpetual)
{
Console.WriteLine(LICENSE_MISMATCH_TO_BUILD_ERROR);
//NOTE: LICENSE_MISMATCH_TO_BUILD_ERROR bit below is checked for in startup.cs DO NOT remove this without fixing the side effects
throw new ApplicationException(LICENSE_MISMATCH_TO_BUILD_ERROR);
}
#endif
//All is well return key
return key;