C#

博客园 首页 新随笔 联系 订阅 管理

方法一、

下载

https://github.com/ServiceStack/ServiceStack.Text

修改LicenseUtils.cs文件中的AssertValidUsage

var licensedFeatures = ActivatedLicenseFeatures();

后面添加   return;

 

方法二、调用下面的代码之后就没有了限制

var licenseKey = new LicenseKey()
{
Ref = "pedoc",
Expiry = DateTime.Now.AddDays(365 * 5),
Hash = string.Empty,
Name = "pedoc",
Type = LicenseType.Enterprise
};
var field = typeof(LicenseUtils).GetField("__activatedLicense",
BindingFlags.Static | BindingFlags.NonPublic);
var keyType = field.FieldType;
var constructorInfos = keyType.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic);
var constructorInfo = constructorInfos[0];
var key = constructorInfo.Invoke(new object[] { licenseKey });
field.SetValue(null, key);
var licenceAll = LicenseUtils.HasLicensedFeature(LicenseFeature.All);
Debug.Assert(licenceAll);

 

posted on 2018-12-17 16:59  不想当码农的码农  阅读(1375)  评论(0编辑  收藏  举报