C
C#2y ago
Apex6554

❔ Failed to Activate License

I'm trying to make a License.key file for my program to read and to activate the license key but it's keep failing to activate the License key, if you need more detail let me know, also there is no error showing in my code so I'm at a lost.
17 Replies
leowest
leowest2y ago
would be really helpful if u dont post a image of code, either use https://paste.mod.gg/ or paste the code here so we can properly read it
BlazeBin
A tool for sharing your source code with the world!
Apex6554
Apex6554OP2y ago
BlazeBin - cdakxrzzhpgc
A tool for sharing your source code with the world!
leowest
leowest2y ago
no need to be sorry 😛 its just that images some times aren't as helpful as the code directly
Apex6554
Apex6554OP2y ago
Haha that’s true kinda have to squint to actually see the code
leowest
leowest2y ago
so where does it fail right now? line 36?
Apex6554
Apex6554OP2y ago
So when I click browse button to locate my License.key file I have the username, password, License key hash and the expiry date displayed in the text box then I click activate but I get a message saying failed to activate license been stuck on that part for some time now
leowest
leowest2y ago
ok so line 36 well I would start by breaking down your if condition so you can break point and see which is not matching
Apex6554
Apex6554OP2y ago
So insert a break point on line 36?
leowest
leowest2y ago
break it down first if ( username == inputusername) etc so that u can easily spot which one is wrong with everything in one condition it might make it hard for u to see which one is failing
if (inputLicenseKeyHash != storedLicenseKeyHash)
{
MessageBox.Show("Hash differ");
return;
}

if (inputExpiryDate > storedExpiryDate)
{
MessageBox.Show("Expired");
return;
}

if (inputUsername != storedUsername)
{
MessageBox.Show("Wrong username");
return;
}

if (inputPasswordHash != storedPasswordHash)
{
MessageBox.Show("Wrong password");
return;
}

MessageBox.Show("License activated successfully.");

this.Hide();

MainForm mainForm = new MainForm();
mainForm.ShowDialog();

this.Close();
if (inputLicenseKeyHash != storedLicenseKeyHash)
{
MessageBox.Show("Hash differ");
return;
}

if (inputExpiryDate > storedExpiryDate)
{
MessageBox.Show("Expired");
return;
}

if (inputUsername != storedUsername)
{
MessageBox.Show("Wrong username");
return;
}

if (inputPasswordHash != storedPasswordHash)
{
MessageBox.Show("Wrong password");
return;
}

MessageBox.Show("License activated successfully.");

this.Hide();

MainForm mainForm = new MainForm();
mainForm.ShowDialog();

this.Close();
Apex6554
Apex6554OP2y ago
so replace line 36 with the code you provided?
leowest
leowest2y ago
sure you can do that, that is just an example so you can see if there is anything wrong with any of those
leowest
leowest2y ago
if you replace it, u would have to remove all this but I am sure you understand that
Apex6554
Apex6554OP2y ago
Yeah because if I don’t it’ll give off lots of error The only thing that pops up is Hash differ
leowest
leowest2y ago
well then that is your issue inputLicenseKeyHash is not equal to storedLicenseKeyHash
Apex6554
Apex6554OP2y ago
The license key that is stored inside License.key file is the license key hash that is being entered how do I fix that if it’s not equal to storesLicenseKeyHash?
leowest
leowest2y ago
well try outputting the value of both and see I would assume something done at string inputLicenseKeyHash = ComputeHash(inputLicenseKey); is not right or missing
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server