简体   繁体   English

使用Portable.Licensing如何验证属性硬件ID

[英]Using Portable.Licensing how to validate the attribute hardware Id

I am working on certain project. 我正在研究某个项目。 All i need is to provide the license of the product to only one computer so i added an additional attribute hardware Id as shown in fig .How can i validate it. 我只需要将产品的许可证提供给一台计算机,所以我添加了一个额外的属性硬件ID,如图所示。如何验证它。 help me out in this regard. 在这方面帮助我。 Thanks.. 谢谢..

var license = Portable.Licensing.License.New()
                   .WithUniqueIdentifier(Guid.NewGuid())
                   .As(Portable.Licensing.LicenseType.Trial)
                   .ExpiresAt(DateTime.Now.AddDays(5))
                   .WithMaximumUtilization(Int32.Parse(User.Text))
                   .WithAdditionalAttributes(new Dictionary<String,String>{
                                               {"Hardware ID","12343"}
                                                })
                   .LicensedTo(name.Text, email.Text)
                   .CreateAndSignWithPrivateKey(privateKey, "212555555");

Well I found the answer for this very simple one. 好吧,我找到了这个非常简单的答案。

  1. Using AssertThat() method provided by Portable.Licencing. 使用Portable.Licencing提供的AssertThat()方法。 ex:- 例如: -

      var validationFailures = licenseContent.Validate() .ExpirationDate() .When(lic => lic.Type == Portable.Licensing.LicenseType.Trial) .And() .AssertThat(lic => lic.Quantity >= 3, failure1) .And() .AssertThat(lic => lic.ProductFeatures.Get("HardwareID") == "133456", failure1) .When(lic => lic.ProductFeatures.Contains("HardwareID")) .And() .Signature(publicKey) .AssertValidLicense().ToList(); 
  2. Write your own validation case. 编写自己的验证案例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Portable.Licensing如何将许可证绑定到PC - Portable.Licensing how to tie a license to a PC 使用C#中的portable.licensing向客户添加“公司” - Adding ‘company’ to a customer using portable.licensing in C# 如何使用Portable.Licensing加密dll中的所有方法? - How use Portable.Licensing for encrypt All methods in a dll? 使用Portable.Licensing许可Asp.Net应用程序 - Licensing Asp.Net application with Portable.Licensing TwitterBootstrapMVC无法加载文件或程序集&#39;Portable.Licensing,版本= 1.0.0.0 - TwitterBootstrapMVC Could not load file or assembly 'Portable.Licensing, Version=1.0.0.0 在asp.net Portable.Licensing中,.WithMaximumUtilization(1)是什么意思和使用? - In asp.net Portable.Licensing, what does .WithMaximumUtilization(1) mean and used? 在可移植库中使用CallerMemberName属性 - Using CallerMemberName attribute in a portable library 如何在Windows上使用Mono来访问WMI以获取硬件ID? - How to using Mono for windows to Access WMI to get hardware Id? 如何使用 enigma 保护器的 EP_RegHardwareID() 方法检索硬件 ID? - How to retrieve the Hardware ID using EP_RegHardwareID() method of enigma protector? 在C#.net中,如何使用RSA和许可证提供者类进行许可证授予? - In C# .net how to licensing using RSA and license provider class?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM