public override License GetLicense(LicenseContext context, Type type, object instance, bool allowExceptions) { RsaLicenseDataAttribute licDataAttr = GetRsaLicenseDataAttribute(type); if (licDataAttr == null) { return(null); } var publicKey = licDataAttr.PublicKey; var attrGuid = licDataAttr.Guid; if (context.UsageMode == LicenseUsageMode.Designtime) { return(new RsaLicense(type, "", attrGuid, DateTime.MaxValue)); } RsaLicense license = licenseCache.GetLicense(type); if (license == null) { var keyValue = LoadLicenseData(type, ""); DateTime expireDate = new DateTime(); if (IsKeyValid(keyValue, publicKey, attrGuid, expireDate)) { license = new RsaLicense(type, keyValue, attrGuid, expireDate); licenseCache.AddLicense(type, license); } } return(license); }
public RsaLicense GetLicense(Type type) { RsaLicense license = null; if (hash.ContainsKey(type)) { license = (RsaLicense)hash[type]; } return(license); }
public void AddLicense(Type type, RsaLicense license) { hash.Add(type, license); }