public override License GetLicense( LicenseContext context, Type type, object instance, bool allowExceptions) { ILicenseKey key = (ILicenseKey) new DefaultKey(); try { LicenseContextManager licenseContextManager = new LicenseContextManager((ILicenseContextData) new LicenseContextData(context, type, allowExceptions)); switch (context.UsageMode) { case LicenseUsageMode.Designtime: key = (ILicenseKey) new DesignTimeKey(); licenseContextManager.SaveLicenseKey(type, key); this.ProcessEvents(licenseContextManager.ContextData, type, key); break; default: key = licenseContextManager.ExtractLicenseKey(type); break; } } catch (Exception ex) { } finally { this.UsageTracker.StopTracking(); } return(LicenseFactory.CreateLicense(key)); }
public void SaveLicenseKey(Type type, ILicenseKey key) { if (!this.LicensingEnabled) { return; } this.ContextData.Context.SetSavedLicenseKey(type, key.Key); }
public static License CreateLicense(ILicenseKey key) { if (key is DesignTimeKey) { return((License)DesignTimeLicense.CreateDesigntimeLicense(key)); } if (key is RuntimeKey) { return((License)RuntimeLicense.CreateRuntimeLicense(key)); } return((License)DefaultLicense.CreateDefaultLicense(key)); }
internal virtual void ProcessEvents(ILicenseContextData data, Type type, ILicenseKey key) { this.EnsureTracking(); if (!this.TryEnsureSessionManager(data.Context)) { return; } this.RegisteredTypes.TryAdd(type.FullName); if (!this.CurrentSession.GetProductUsageLogged()) { this.RaiseProductUsed(type, this.CurrentSession.Id); this.CurrentSession.SetProductUsageLogged(); } if (!this.CurrentSession.GetHasPendingChange()) { return; } this.RaiseComponentUsed(type, this.CurrentSession.Id); this.CurrentSession.SetPendingChangeResolved(); }
internal static DefaultLicense CreateDefaultLicense(ILicenseKey key) { return(new DefaultLicense(key)); }
internal DefaultLicense(ILicenseKey key) { }
internal static DesignTimeLicense CreateDesigntimeLicense(ILicenseKey key) { return(new DesignTimeLicense(key)); }
internal DesignTimeLicense(ILicenseKey licenseKey) { this._key = licenseKey.Key; }
internal static RuntimeLicense CreateRuntimeLicense(ILicenseKey key) { return(new RuntimeLicense(key)); }
internal RuntimeLicense(ILicenseKey licenseKey) : base(licenseKey) { }