I am trying to check the serial input on 2 different serial lists. There are two serial lists;
Bundle serials (stores and checks the file in "../Individual_RegistrationInfo.js" )
Individual serials (stores and checks the file in "../Bundle_RegistrationInfo.js" )
It doesn't check the serials in given lists properly, what am I missing?
(This code is a language that is a mixture of java and C++ But any C++ logic should work. I would be appreciated if you give the lacking thing. It is HISE engine (creates vst plugins))
namespace Authorisation
{
const var SerialInput = Content.getComponent("SerialInput");
const var AuthorisationDialogue = Content.getComponent("AuthorisationDialogue");
inline function onSubmitButtonControl(component, value)
{
if(!value)
return;
local v = SerialInput.getValue();
Console.print(v);
// Checks if it's in the Individual Serial sList
if(Individual_serials.Data.contains(v))
{
Console.print("Serial number found");
local data =
{
"Serial": v
};
// Saves as Individual_RegistrationInfo.js
Engine.dumpAsJSON(data, "../Individual_RegistrationInfo.js");
setValidLicense(true);
}
// Checks if it's in the Bundle Serial sList
if(Bundle_serials.Data.contains(v))
{
Console.print("Serial number found");
local data =
{
"Serial": v
};
// Saves as Bundle_RegistrationInfo.js
Engine.dumpAsJSON(data, "../Bundle_RegistrationInfo.js");
setValidLicense(true);
}
else
{
Console.print("Invalid serial number");
Description.set("text", "INVALID KEY THAT DOES NOT MATCH WITH YOUR LICENSE");
setValidLicense(false);
}
};
Content.getComponent("SubmitButton").setControlCallback(onSubmitButtonControl);
inline function setValidLicense(isValid)
{
if(isValid)
{
// My action
}
else
{
// My action
}
}
inline function checkOnLoad()
{
SerialInput.set("text", "");
// Load the serial from the stored files
local pData_Individual = Engine.loadFromJSON("../Individual_RegistrationInfo.js");
local pData_Bundle = Engine.loadFromJSON("../Bundle_RegistrationInfo.js");
Console.print("Checking serial");
// Individual serials
if(pData_Individual)
{
local v = pData_Individual.Serial;
Console.print("Restored serial: " + v);
if(Individual_serials.Data.contains(v))
{
setValidLicense(true);
return;
}
}
// Bundle serials
if(pData_Bundle)
{
local v = pData_Bundle.Serial;
Console.print("Restored serial: " + v);
if(Bundle_serials.Data.contains(v))
{
setValidLicense(true);
return;
}
}
setValidLicense(false);
}
// Call this on startup
checkOnLoad();
}