public bool Reactivate() { bool result = false; try { productID = ""; productID = GetProductId(); //combination of a company name and guid productID = Encryption.Boring(Encryption.InverseByBase(productID, 10)); licenseKey = Encryption.MakePassword(productID, identifier); if (userPassword == licenseKey) { string[] hideInfo = FileReadWrite.ReadFile(hideFilePath).Split(';'); for (int i = 4; i < hideInfo.Length; i++) { if (hideInfo[i] == identifier) { MessageBox.Show("You've already tried with the activation code.\nTry to get another identifier with a valid activation code.", "Failed to activate.", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } } string hideData; hideData = DateTime.Now.Ticks.ToString(); for (int i = 1; i < hideInfo.Length; i++) { hideData += ";" + hideInfo[i]; } hideData += ";" + identifier; if (File.Exists(hideFilePath)) { File.Delete(hideFilePath); } FileReadWrite.WriteFile(hideFilePath, hideData); trialDays = 90; result = true; } else { MessageBox.Show("The password is incorrect.\n Please enter a valid activation code.", "Incorrect Password", MessageBoxButtons.OK, MessageBoxIcon.Hand); result = false; } return(result); } catch (Exception ex) { MessageBox.Show("Failed to reactivate the BCF Reader.\n" + ex.Message, "TrialMaker:Reactivate", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
private void MakeHideFile() { try { string HideInfo; trialDays = 90; int tempRunTimes = 10000; HideInfo = DateTime.Now.Ticks + ";"; HideInfo += trialDays + ";" + tempRunTimes + ";" + productID + ";" + identifier; FileReadWrite.WriteFile(hideFilePath, HideInfo); } catch (Exception ex) { MessageBox.Show("Failed to make a hide file.\n" + ex.Message, "TrialMaker:MakeHideFile", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }