許可證.dll
使用 .NET 庫(kù)“License.dll”,您可以在運(yùn)行時(shí)確定鎖定軟件的當(dāng)前許可證狀態(tài)。你只需要在你的項(xiàng)目中引用這個(gè)庫(kù)并訪問(wèn)相應(yīng)的方法和屬性即可。所有方法和屬性都應(yīng)該是不言自明的。您無(wú)需選擇許可證文件。如果有可用的有效許可證文件,它將自動(dòng)用于更新許可證狀態(tài)。
請(qǐng)注意,“License.dll”的方法和屬性只有在保護(hù)您的軟件后才會(huì)返回正確的值。保護(hù)后,不再需要庫(kù)“License.dll”。這意味著您可以在沒(méi)有 License.dll 的情況下運(yùn)送受保護(hù)的軟件
如何示例:
- License.dll 的引用命名空間
- 檢查是否有有效的許可證文件可用
- 從許可證中讀取附加許可證信息
- 檢查評(píng)估鎖的許可狀態(tài)
- 檢查到期日期鎖定的許可證狀態(tài)
- 檢查使用次數(shù)鎖定的許可狀態(tài)
- 檢查 Number Of Instances Lock 的許可狀態(tài)
- 檢查硬件鎖的許可證狀態(tài)
- 獲取當(dāng)前機(jī)器的硬件ID
- 將當(dāng)前硬件 ID 與許可證文件中存儲(chǔ)的硬件 ID 進(jìn)行比較
- 使許可證無(wú)效
- 檢查確認(rèn)碼是否有效
- 重新激活許可證
- 使用文件名手動(dòng)加載許可證
- 使用字節(jié)數(shù)組手動(dòng)加載許可證
- 以字節(jié)數(shù)組的形式獲取加載的許可證(如果可用)
如何示例代碼:
License.dll 的參考命名空間:
// Reference Namespace of License.dll using License;
檢查是否有有效的許可證文件可用:
// Check if a valid license file is available public bool IsValidLicenseAvailable() { return License.Status.Licensed; }
從許可證 license 中讀取額外的許可證信息:
// Read additonal license information from a license license public void ReadAdditonalLicenseInformation() { // Check first if a valid license file is found if (License.Status.Licensed) { // Read additional license information for (int i = 0; i < License.Status.KeyValueList.Count; i++) { string key = License.Status.KeyValueList.GetKey(i).ToString(); string value = License.Status.KeyValueList.GetByIndex(i).ToString(); } } }
查看 Evaluation Lock 的許可狀態(tài):
// Check the license status of Evaluation Lock public void CheckEvaluationLock() { bool lock_enabled = License.Status.Evaluation_Lock_Enabled; EvaluationType ev_type = License.Status.Evaluation_Type; int time = License.Status.Evaluation_Time; int time_current = License.Status.Evaluation_Time_Current; }
檢查到期日期鎖定的許可證狀態(tài)
// Check the license status of Expiration Date Lock public void CheckExpirationDateLock() { bool lock_enabled = License.Status.Expiration_Date_Lock_Enable; System.DateTime expiration_date = License.Status.Expiration_Date; }
檢查使用次數(shù)鎖定的許可狀態(tài)
// Check the license status of Number Of Uses Lock public void CheckNumberOfUsesLock() { bool lock_enabled = License.Status.Number_Of_Uses_Lock_Enable; int max_uses = License.Status.Number_Of_Uses; int current_uses = License.Status.Number_Of_Uses_Current; }
檢查 Number Of Instances Lock 的許可狀態(tài)
// Check the license status of Number Of Instances Lock public void CheckNumberOfInstancesLock() { bool lock_enabled = License.Status.Number_Of_Instances_Lock_Enable; int max_instances = License.Status.Number_Of_Instances; }
檢查硬件鎖的許可證狀態(tài)
// Check the license status of Hardware Lock public void CheckHardwareLock() { bool lock_enabled = License.Status.Hardware_Lock_Enabled; if (lock_enabled) { // Get Hardware ID which is stored inside the license file string lic_hardware_id = License.Status.License_HardwareID; } }
獲取當(dāng)前機(jī)器的硬件ID
// Get Hardware ID of the current machine public string GetHardwareID() { return License.Status.HardwareID; }
將當(dāng)前硬件 ID 與許可證文件中存儲(chǔ)的硬件 ID 進(jìn)行比較
// Compare current Hardware ID with Hardware ID stored in License File public bool CompareHardwareID() { if (License.Status.HardwareID == License.Status.License_HardwareID) return true; else return false; }
使許可證無(wú)效
// Invalidate the license. Please note, your protected software does not accept a license file anymore! public void InvalidateLicense() { string confirmation_code = License.Status.InvalidateLicense(); }
檢查確認(rèn)碼是否有效
// Check if a confirmation code is valid public bool CheckConfirmationCode(string confirmation_code) { return License.Status.CheckConfirmationCode(License.Status.HardwareID, confirmation_code); }
重新激活許可證
// Reactivate an invalidated license. public bool ReactivateLicense(string reactivation_code) { return License.Status.ReactivateLicense(reactivation_code); }
使用文件名手動(dòng)加載許可證
// Load the license. public void LoadLicense(string filename) { License.Status.LoadLicense(filename); }
使用 byte[] 手動(dòng)加載許可證
// Load the license. public void LoadLicense(byte[] license) { License.Status.LoadLicense(license); }
以 byte[] 的形式獲取加載的許可證(如果可用)
// Get the license. public byte[] GetLicense() { return License.Status.License; }