Created
February 6, 2018 14:03
-
-
Save variux/fa454754a173940df3774eab6bda65fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Esto va en el load | |
if (VerifyLicense() == false) | |
{ | |
MessageBox.Show("Licencia vencida contacte a ITCO para continuar"); | |
Environment.Exit(1); | |
} | |
//la funcion | |
private bool VerifyLicense() { | |
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://itco.space/activate.php"); | |
request.Method = "POST"; | |
request.ContentType = "application/x-www-form-urlencoded"; | |
string license = File.ReadLines(@"C:\Program Files (x86)\ITCO S.A\Factura Electronica\license.txt").First(); | |
string postData = "sn="+license; | |
byte[] data = Encoding.UTF8.GetBytes(postData); | |
Stream dataStream = request.GetRequestStream(); | |
dataStream.Write(data, 0, data.Length); | |
dataStream.Close(); | |
WebResponse response = request.GetResponse(); | |
dataStream = response.GetResponseStream(); | |
StreamReader reader = new StreamReader(dataStream); | |
// Read the content. | |
string responseFromServer = reader.ReadToEnd(); | |
reader.Close(); | |
dataStream.Close(); | |
response.Close(); | |
if (responseFromServer == "601") | |
{ | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
//ONexit reemplazar | |
Environment.Exit(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment