private bool IsLeaseValid() { bool isLeaseValid = false; DongleGenerator dg = new DongleGenerator(); // we can pass to the dg a path where to look for if (dg.DongleExists()) { this.lease = dg.GetLease(); if (lease != null) { if (this.lease.ComputerName.ToUpper().Equals(Environment.MachineName.ToUpper())) { if (this.AreStartAndEndLeaseOk(this.lease.LeaseStart, this.lease.LeaseEnd)) { isLeaseValid = true; } else { isLeaseValid = false; this.message = "The license for this software has expired. Please contact Simprotek Corporation by email at [email protected] to extend it."; } } else { isLeaseValid = false; this.message = "Your current computer name doesn't match the one you registered in the license. Please contact Simprotek Corporation by email at [email protected] for a valid dongle file."; } } else { isLeaseValid = false; this.message = "You don't have a valid license for this software. Please contact Simprotek Corporation by email at [email protected] for one."; } } else { isLeaseValid = false; this.message = "You don't have a license for this software. Please contact Simprotek Corporation by email at [email protected] for one."; } return(isLeaseValid); }
public SoftwareProtectionManager() { this.message = ""; this.lease = null; }
public SoftwareProtectionManager() { this.message = ""; this.lease = null; hasValidLease = IsLeaseValid(); }