/*** Check if a valid license file is available. ***/ public bool IsValidLicenseAvailable() { return License.Status.Licensed; }
/*** Check the license status of Hardware Lock ***/ public void CheckHardwareLock() { bool lock_enabled = License.Status.Hardware_Lock_Enabled; if (lock_enabled) { /* Get Hardware ID which is stored inside the license file */ string lic_hardware_id = License.Status.License_HardwareID; } }
/*** Get Hardware ID of the current machine ***/ public string GetHardwareID() { return License.Status.HardwareID; }
/*** Compare current Hardware ID with Hardware ID stored in License File ***/ public bool CompareHardwareID() { if (License.Status.HardwareID == License.Status.License_HardwareID) return true; else return false; }I think that explains it pretty well.
. And yes, it seems clear that if the license is valid then Licence.Status.HardwareID should equal Licence.Status.License_HardwareID.
I used the same master key to protect the file as I did to create the license file. I did this all on my development machine. The hardware ID that is created by running HID.exe does not match the one in Licence.Status.License_HardwareID. That makes zero sense. How can you test if the hardware matches if they are not equal.
/*** Create a License File ***/ public void CreateLicenseFile(string project_filename) { LicenseGenerator licensegen = new LicenseGenerator(project_filename); licensegen.AdditonalLicenseInformation.Add("Name", "John Doe"); licensegen.AdditonalLicenseInformation.Add("Company", "Acme"); licensegen.HardwareLock_Enabled = true; licensegen.HardwareID = "1234-1234-1234-1234-1234"; licensegen.CreateLicenseFile(@"C:\MyProject\newlicense.license"); }If they are the same string then there is either a bug or something else is wrong.
>From the help:
/*** Check if a valid license file is available. ***/
public bool IsValidLicenseAvailable()
{
return License.Status.Licensed;
}
It seems that this just plain means that the license is valid.
To be fair, the help file is very much lacking in clarity.
What exactly does the above mean? There's no explanation that I can find that makes this clear. I would expect that it checks whatever requirements there are in my protected exe and the license file that's sitting there with it to see if everything matches up okay.
It's going to be sure a trial hasn't expired, if the hardware ID's match, and so on. if all it does is check for the existence of a license file, then that's kind of silly. I can do that with just general vb.net methods.
So logically, if License.Status.Licensed = true then all the other requirements must have been met as well and the program can be run.
It appears that the protected project contains the hardware ID somewhere. That makes no sense.
But test it. I protected an exe with the hardware id of my computer.
Then i chagned the hardware id
and created a license file. I ran my code and displayed the 2 values. They were identical.
I would have expected them to be different. THen when I reprotected the exe (without changing the hardware id - remember, it's the wrong one), it showed 2 different ID's in my code. That the hardware ID impacts the protected file makes no sense.
To make matters worse, the countdown isn't working right. I set my
project up for 2 uses. The following code did what I expected:
max_uses = License.Status.Number_Of_Uses
current_uses =
License.Status.Number_Of_Uses_Current
MessageBox.Show("max: " & max_uses.ToString & ";
used: " & current_uses.ToString)
In the first use, it showed max: 2; used: 1
In the 2nd use it showed max: 2; used 2
But then on the third use, it showed this: max 2; used: 1.
It's as if the counter resets after it decides the license is expired.
But I want to show the user why it expired. I want to say "you've used
up all your uses". How can I do that if "used" resets to 1 after it's
all used up?
I've spent way to much time now trying to figure out how this thing works (and doesn't work). Very frustrated. And 9 days now since my first question was emailed to support with no answers at all. Out of the box, I'm sure it does what it should but license.dll seems like it doesn't behave properly at all and the help is far too terse.
This also makes some sense to me as well, even if it is annoying to you.
By the way, how did you ascertain that
License_Status.Number_Of_Uses_Current returns 1 after both uses were
used up.