Internal Utilities to verify licensing
Пример #1
0
        public static void RegisterLicenseFromAppSettings(IAppSettings appSettings)
        {
            //Automatically register license key stored in <appSettings/>
            var licenceKeyText = appSettings.GetString(NetStandardPclExport.AppSettingsKey);

            if (!string.IsNullOrEmpty(licenceKeyText))
            {
                LicenseUtils.RegisterLicense(licenceKeyText);
            }
        }
Пример #2
0
        public static void RegisterLicenseFromFile(string filePath)
        {
            if (!filePath.FileExists())
            {
                throw new LicenseException("License file does not exist: " + filePath).Trace();
            }

            var licenseKeyText = filePath.ReadAllText();

            LicenseUtils.RegisterLicense(licenseKeyText);
        }
Пример #3
0
        public static void RegisterLicenseFromFileIfExists(string filePath)
        {
            if (!filePath.FileExists())
            {
                return;
            }

            var licenseKeyText = filePath.ReadAllText();

            LicenseUtils.RegisterLicense(licenseKeyText);
        }
Пример #4
0
        public override void RegisterLicenseFromConfig()
        {
            //Automatically register license key stored in <appSettings/> is done in .NET Core AppHost

            //or SERVICESTACK_LICENSE Environment variable
            var licenceKeyText = GetEnvironmentVariable(EnvironmentKey)?.Trim();

            if (!string.IsNullOrEmpty(licenceKeyText))
            {
                LicenseUtils.RegisterLicense(licenceKeyText);
            }
        }
Пример #5
0
        public override void RegisterLicenseFromConfig()
        {
#if ANDROID
#elif __IOS__
#elif __MAC__
#elif NETSTANDARD2_0
#else
            string licenceKeyText;
            try
            {
                //Automatically register license key stored in <appSettings/>
                licenceKeyText = ConfigurationManager.AppSettings[AppSettingsKey];
                if (!string.IsNullOrEmpty(licenceKeyText))
                {
                    LicenseUtils.RegisterLicense(licenceKeyText);
                    return;
                }
            }
            catch (Exception ex)
            {
                licenceKeyText = Environment.GetEnvironmentVariable(EnvironmentKey)?.Trim();
                if (string.IsNullOrEmpty(licenceKeyText))
                {
                    throw;
                }
                try
                {
                    LicenseUtils.RegisterLicense(licenceKeyText);
                }
                catch
                {
                    throw ex;
                }
            }

            //or SERVICESTACK_LICENSE Environment variable
            licenceKeyText = Environment.GetEnvironmentVariable(EnvironmentKey)?.Trim();
            if (!string.IsNullOrEmpty(licenceKeyText))
            {
                LicenseUtils.RegisterLicense(licenceKeyText);
            }
#endif
        }
        public override void RegisterLicenseFromConfig()
        {
            string licenceKeyText;

            try
            {
                //Automatically register license key stored in <appSettings/>
                licenceKeyText = System.Configuration.ConfigurationManager.AppSettings[AppSettingsKey];
                if (!string.IsNullOrEmpty(licenceKeyText))
                {
                    LicenseUtils.RegisterLicense(licenceKeyText);
                    return;
                }
            }
            catch (NotSupportedException) { return; } // Ignore Unity/IL2CPP Exception
            catch (Exception ex)
            {
                licenceKeyText = Environment.GetEnvironmentVariable(EnvironmentKey)?.Trim();
                if (string.IsNullOrEmpty(licenceKeyText))
                {
                    throw;
                }
                try
                {
                    LicenseUtils.RegisterLicense(licenceKeyText);
                }
                catch
                {
                    throw ex;
                }
            }

            //or SERVICESTACK_LICENSE Environment variable
            licenceKeyText = Environment.GetEnvironmentVariable(EnvironmentKey)?.Trim();
            if (!string.IsNullOrEmpty(licenceKeyText))
            {
                LicenseUtils.RegisterLicense(licenceKeyText);
            }
        }
Пример #7
0
 public static void RegisterLicense(string licenseKeyText)
 {
     LicenseUtils.RegisterLicense(licenseKeyText);
 }
Пример #8
0
 protected static IDisposable __requestAccess()
 {
     return(LicenseUtils.RequestAccess(AccessToken.__accessToken, LicenseFeature.Client, LicenseFeature.Text));
 }
Пример #9
0
 public string licensedFeatures() => LicenseUtils.ActivatedLicenseFeatures() == LicenseFeature.All ? "All" : LicenseUtils.ActivatedLicenseFeatures().ToString();