RegisterLicense() public static method

public static RegisterLicense ( string licenseKeyText ) : void
licenseKeyText string
return void
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public static void RegisterLicenseFromFileIfExists(string filePath)
        {
            if (!filePath.FileExists())
            {
                return;
            }

            var licenseKeyText = filePath.ReadAllText();

            LicenseUtils.RegisterLicense(licenseKeyText);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 7
0
 public static void RegisterLicense(string licenseKeyText)
 {
     LicenseUtils.RegisterLicense(licenseKeyText);
 }