This project has moved. For the latest updates, please go here.

IsOnRightMachine not working


Hi, here is example code to reproduce issue:
 SKGL.Generate CreateAKey = new SKGL.Generate(); // creating an object
CreateAKey.secretPhase = "Password"; // adding password
 var z = CreateAKey.doKey(30);
Console.WriteLine(z); // generating a key; 30 is the time left.
Console.WriteLine("CreateAKey.MachineCode : " + CreateAKey.MachineCode);
SKGL.Validate ValidateAKey = new SKGL.Validate();// create an object
 ValidateAKey.secretPhase = "Password"; // the passsword
ValidateAKey.Key = z; // enter a valid key
Console.WriteLine("ValidateAKey.MachineCode : " + ValidateAKey.MachineCode);
Console.WriteLine("KeyIsValid: " + ValidateAKey.IsValid.ToString());
Console.WriteLine("KeyIsValid and OnRightMachine: " + (ValidateAKey.IsValid && ValidateAKey.IsOnRightMachine).ToString());
and here is my output:
CreateAKey.MachineCode : 97324
ValidateAKey.MachineCode : 97324
KeyIsValid: True
KeyIsValid and OnRightMachine: False

is there something I understand wrong ?

thanks in advance


brunweb wrote Nov 11, 2015 at 8:57 AM

Hi, sorry, it is my mistake : i did not understand that machine code whas a random if not specified. but i understand it makes sens.

So changing my code to:
 string z = CreateAKey.doKey(30, CreateAKey.MachineCode);
everything now works as expected.

Thanks for this great lib