How do I Check serial numbers in two different lists ?

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))


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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();
 
}
Last edited on
Topic archived. No new replies allowed.