private static string GetMachineCode() { // machine code CryptoLicense license = new CryptoLicense(); return(license.GetLocalMachineCodeAsString()); }
} //readLicenseFile public void readLicenseFile(String strFileName) { // Loads from license file all necessary information if (File.Exists(strFileName)) // License file exists - read from file { setLicenseFromFile(strFileName); } else // License file doesn't exist - auto generated license { if (!m_isAllowBuiltInLicense) { return; } m_objLicence = new CryptoLicense(m_cnstLicCode, cProperties.ProjectKey); m_objLicence.StorageMode = LicenseStorageMode.None; } cLicenseParams.CompID = m_objLicence.GetLocalMachineCodeAsString(); cLicenseParams.setUserData(m_objLicence.UserData); cLicenseParams.DaysLeft = m_objLicence.RemainingUsageDays; cLicenseParams.DateExpires = m_objLicence.DateExpires; //cProperties.isWithQA = cLicenseParams.AllowQA; cProperties.NumBondOpts = cLicenseParams.BondOptNum; cProperties.NumOptimizations = cLicenseParams.OptimizationNum; //cProperties.isWithBondOpt = cLicenseParams.AllowBondOpt; //cProperties.isIsraelOnly = cLicenseParams.isIsraelOnly; setAllowedExchanges(cLicenseParams.Exchanges); }//loadFromFile
private void ParseLicenseInfosForThanks() { System.Collections.Hashtable dataFields = cryptoLicense.ParseUserData("#"); this.LicenseThanks_HardwareID = cryptoLicense.GetLocalMachineCodeAsString(); this.LicenseThanks_Organisation = dataFields["Organisation"] as string; this.LicenseThanks_Name = dataFields["Name"] as string; this.LicenseThanks_Mail = dataFields["Mail"] as string; if (dataFields["Liteversion"] as string == "True") { this.LicenseThanks_Version = "Lite"; } else { this.LicenseThanks_Version = "Basic"; } this.LicenseThanks_FeatureMailOn = cryptoLicense.IsFeaturePresentEx(1); this.LicenseThanks_FeatureMapOn = cryptoLicense.IsFeaturePresentEx(2); this.LicenseThanks_FeatureAlarmappOn = cryptoLicense.IsFeaturePresentEx(3); this.LicenseThanks_DateExpires = cryptoLicense.DateExpires.ToString(); if (!cryptoLicense.HasDateExpires) { this.LicenseThanks_DateExpires = "Unbegrenzt"; } }
public override void AfterConstruction() { base.AfterConstruction(); CryptoLicense license = new CryptoLicense(); // Place here your initialization code. Code = license.GetLocalMachineCodeAsString(); }
private void frmLicense_Load(object sender, EventArgs e) { lblDateTime.Text = DateTime.Now.ToLongDateString();//GetNistTime().ToLongDateString(); license = new CryptoLicense(ValidationKey); txtMachineCode.Text = license.GetLocalMachineCodeAsString(); txtWinName.Text = Environment.MachineName; //txtWinVer.Text = Environment.OSVersion.ToString(); txtWinVer.Text = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", "").ToString(); if (CheckForInternetConnection()) { lblInternetStatus.Text = "متصل"; lblInternetStatus.ForeColor = Color.Green; } else { lblInternetStatus.Text = "قطع"; lblInternetStatus.ForeColor = Color.DarkRed; } }
private void AddClient() { //Should Make MachineCode MachineCode = license.GetLocalMachineCodeAsString(); if (manifestWS.InsertClient(MachineCode , Environment.MachineName , Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", "").ToString() , Environment.UserName , txtLineCode.Text.Trim())) { Properties.Settings.Default.LineCode = txtLineCode.Text.Trim(); Properties.Settings.Default.Company = manifestWS.CompanyName(txtLineCode.Text.Trim()); Properties.Settings.Default.Save(); MessageBox.Show("با موفقیت اضافه گردید. لطفا برنامه را دوباره اجرا کنید."); Application.Exit(); } else { MessageBox.Show("عملیات با اشکال روبرو شد. اگر مطمئن هستید از تعداد لایسنس شما باقی مانده است، لطفا با مسئول برنامه تماس حاصل کنید" , "Register Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign); } }