private bool LoadCheckLicense() { bool IsValid = false; Licensing.LicenseResponse resp = new Licensing.LicenseResponse(); try { MyPropertyManager.OnLoad(); //call only once !!! string LocalTID = (string)MyPropertyManager.GetProperty("TID"); try { Microsoft.Win32.RegistryKey key; key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("YTRLicense", true); if (key == null) { key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("YTRLicense"); } else { LocalTID = key.GetValue("tid") == null ? "" : key.GetValue("tid").ToString(); } key.Close(); } catch { } if (LocalTID.Length > 0) { Task.Factory.StartNew(() => { Thread.Sleep(100); }); SetMessage("Checking license...", Color.Black);; Http request = new Http(); resp = Licensing.CheckLicense(request, LocalTID); } else { pLicense.Invoke((MethodInvoker) delegate { pLicense.Visible = true; }); SetMessage("Enter your License ID " + Environment.NewLine + "and Click 'Verify'", Color.Black); } IsValid = resp.IsValid; if (!IsValid) { SetMessage(resp.Message, resp.color); pLicense.Invoke((MethodInvoker) delegate { pLicense.Visible = true; }); } } catch (Exception) { MessageBox.Show("Error SF100. Please contact support [email protected]."); return(false); } return(IsValid); }
public TimestampClient(string librarySerialNumberLicense) { try { Licensing.CheckLicense(librarySerialNumberLicense); } catch (Exception exception) { throw new ArgumentException(string.Concat("Licensing error: ", exception.Message)); } this.TimeStamping = new TimestampSettings(); this.TimestampFormat = TimestampFormat.DetachedTimestamp; }
private void btnSubmit_Click(object sender, EventArgs e) { /*bgw = new BackgroundWorker(); * bgw.DoWork += submission; * bgw.RunWorkerAsync(); */ string TID = txtLicense.Text.Trim().Replace("'", "").Replace("?", "").Replace("&", "").Replace(":", ""); if (TID.Length == 0) { SetMessage("License ID is empty.", Color.Red); txtLicense.Focus(); return; } try { btnStartTrial.Enabled = btnSubmit.Enabled = false; SetMessage("Checking License...", Color.Red); Http request = new Http(); Licensing.LicenseResponse resp = Licensing.CheckLicense(request, TID); if (resp.IsValid) { //PREMIUM = true; SetMessage("Starting YTR...", Color.Green); validation = true; bgw = new BackgroundWorker(); bgw.DoWork += load; bgw.RunWorkerAsync(); return; } else { SetMessage(resp.Message, resp.color); } } catch { } finally { btnStartTrial.Enabled = btnSubmit.Enabled = true; } }
/// <summary> /// Initializes a new instance of X509CertificateGenerator class. /// </summary> /// <param name="librarySerialNumberLicense">The serial number provided to register the library.</param> public X509CertificateGenerator(string librarySerialNumberLicense) { try { Licensing.CheckLicense(librarySerialNumberLicense); } catch (Exception exception) { throw new ArgumentException(string.Concat("Licensing error: ", exception.Message)); } this.Extensions = new Extensions(); this.ValidFrom = DateTime.Now; this.ValidTo = this.ValidFrom.AddYears(1); this.KeySize = KeySize.KeySize1024Bit; this.SignatureAlgorithm = SignatureAlgorithm.SHA1WithRSA; this.FriendlyName = string.Empty; this.SerialNumber = -9223372036854775808L; this.rootCert = null; this.rootKeyPair = null; this.attrs = new Hashtable(); this.ord = new ArrayList(); }