예제 #1
0
 public HomeController(IOptions <PlatformOptions> platformOptions, IOptions <WebAnalyticsOptions> webAnalyticsOptions, LicenseProvider licenseProvider, ISettingsManager settingsManager)
 {
     _platformOptions     = platformOptions.Value;
     _webAnalyticsOptions = webAnalyticsOptions.Value;
     _licenseProvider     = licenseProvider;
     _settingsManager     = settingsManager;
 }
예제 #2
0
 /// <summary>
 /// Install the license key entered by the user
 /// </summary>
 /// <param name="key">The key to install</param>
 /// <returns>True if the license was installed successfully</returns>
 protected virtual bool InstallLicenseKey(string key)
 {
     try
     {
         if (_licenseType == null)
         {
             _license = LicenseProvider.InstallLicense(_licenseFile, key);
         }
         else
         {
             _license = LicenseProvider.InstallLicense(_licenseType, key);
         }
         if (_license == null)
         {
             MessageBox.Show(invalidKeyMsg.Text, invalidKeyTitle.Text,
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         return(_license != null);
     }
     catch
     {
         MessageBox.Show(errorMsg.Text, errorTitle.Text,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     return(false);
 }
예제 #3
0
        public void CreditProviderGetCreditsTest()
        {
            var target        = new LicenseProvider();
            var actual        = target.GetLicenses(typeof(LicenseProvider).GetAssembly());
            var expectedCount = 3;

            Assert.AreEqual(expectedCount, actual.Count, "Number of embeded license xml is not " + expectedCount);
        }
        public LicensingControllerTests()
        {
            _options.SetupGet(x => x.Value).Returns(platformOptions);

            _licenseProvider = new LicenseProvider(_options.Object, null, null);

            _controller = new LicensingController(_options.Object, _settingsManager.Object, _licenseProvider);
        }
예제 #5
0
 public HomeController(IOptions <PlatformOptions> platformOptions, IOptions <WebAnalyticsOptions> webAnalyticsOptions, IOptions <LocalStorageModuleCatalogOptions> localStorageModuleCatalogOptions, IOptions <PushNotificationOptions> pushNotificationOptions, LicenseProvider licenseProvider, ISettingsManager settingsManager)
 {
     _platformOptions     = platformOptions.Value;
     _webAnalyticsOptions = webAnalyticsOptions.Value;
     _localStorageModuleCatalogOptions = localStorageModuleCatalogOptions.Value;
     _pushNotificationOptions          = pushNotificationOptions.Value;
     _licenseProvider = licenseProvider;
     _settingsManager = settingsManager;
 }
예제 #6
0
        public bool BuyLicense(AuthParameters authParameters)
        {
            LicenseProvider licenseProvider = new LicenseProvider();
            bool            buySuccess      = licenseProvider.BuyLicense(authParameters.Username, authParameters.Password);

            if (buySuccess)
            {
                LicenseEndTime = null;
            }

            return(buySuccess);
        }
예제 #7
0
        private void Btn_CreateFileConfig_Click(object sender, RoutedEventArgs e)
        {
            LicenseProvider license = new LicenseProvider();

            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter   = "(*.info) | *.info";
            dialog.FileName = "Client";

            if (dialog.ShowDialog() == true)
            {
                license.CreateClientFileInfo(dialog.FileName);
            }
        }
예제 #8
0
        internal static void CheckLicense(LicenseProvider provider)
        {
            if (!(Current is AsposePreviewProvider ap) || ap.SkipLicenseCheck)
            {
                return;
            }

            try
            {
                switch (provider)
                {
                case LicenseProvider.Cells:
                    new AsposeCells.License().SetLicense(Constants.LicensePath);
                    break;

                case LicenseProvider.Diagram:
                    new AsposeDiagram.License().SetLicense(Constants.LicensePath);
                    break;

                case LicenseProvider.Pdf:
                    new AsposePdf.License().SetLicense(Constants.LicensePath);
                    break;

                case LicenseProvider.Slides:
                    new AsposeSlides.License().SetLicense(Constants.LicensePath);
                    break;

                case LicenseProvider.Words:
                    new AsposeWords.License().SetLicense(Constants.LicensePath);
                    break;

                case LicenseProvider.Tasks:
                    new AsposeTasks.License().SetLicense(Constants.LicensePath);
                    break;

                case LicenseProvider.Imaging:
                    new AsposeImaging.License().SetLicense(Constants.LicensePath);
                    break;

                case LicenseProvider.Email:
                    new AsposeEmail.License().SetLicense(Constants.LicensePath);
                    break;
                }
            }
            catch (Exception ex)
            {
                WriteLicenseException(ex);
            }
        }
        private static bool privateGetLicense(Type type, object instance, bool allowExceptions, out License license)
        //Returns if a component is licensed, and the license if provided
        {
            bool    isLicensed   = false;
            License foundLicense = null;
            //Get the LicProc Attrib for our type
            LicenseProviderAttribute licenseproviderattribute = (LicenseProviderAttribute)Attribute.GetCustomAttribute(type, typeof(LicenseProviderAttribute), true);

            //Check it's got an attrib
            if (licenseproviderattribute != null)
            {
                Type licenseprovidertype = licenseproviderattribute.LicenseProvider;
                //Check the attrib has a type
                if (licenseprovidertype != null)
                {
                    //Create the provider
                    LicenseProvider licenseprovider = (LicenseProvider)Activator.CreateInstance(licenseprovidertype);
                    //Check we've got the provider
                    if (licenseprovider != null)
                    {
                        //Call provider, throw an LicenseException if error.
                        foundLicense = licenseprovider.GetLicense(CurrentContext, type, instance, allowExceptions);
                        if (foundLicense != null)
                        {
                            isLicensed = true;
                        }
                        //licenseprovider.Dispose();
                    }
                    else
                    {
                        //There is was some problem creating the provider
                    }
                    //licenseprovidertype.Dispose();
                }
                else
                {
                    //licenseprovidertype is null
                }
                //licenseproviderattribute.Dispose ();
            }
            else
            {
                //Didn't have a LicenseProviderAttribute, so it's licensed
                isLicensed = true;
            }
            license = foundLicense;
            return(isLicensed);
        }
예제 #10
0
        public static void Main(string[] args)
        {
            try
            {
                LicenseProvider licenseProvider = new LicenseProvider();
                var             info            = licenseProvider.GetInfoString();
                File.WriteAllText(GetPathLicense(), info);
                Console.WriteLine(string.Format("Файл информации о ПК {0} создан в текущей директории, нажмите Enter для выхода", "Client.info"));
            }
            catch (Exception le)
            {
                Console.WriteLine(le);
            }

            Console.ReadLine();
        }
예제 #11
0
        protected static void CheckLicense(LicenseProvider provider)
        {
            try
            {
                switch (provider)
                {
                case LicenseProvider.Cells:
                    var license1 = new Aspose.Cells.License();
                    license1.SetLicense(LICENSEPATH);
                    break;

                case LicenseProvider.Diagram:
                    var license2 = new Aspose.Diagram.License();
                    license2.SetLicense(LICENSEPATH);
                    break;

                case LicenseProvider.Pdf:
                    var license3 = new Aspose.Pdf.License();
                    license3.SetLicense(LICENSEPATH);
                    break;

                case LicenseProvider.Slides:
                    var license4 = new Aspose.Slides.License();
                    license4.SetLicense(LICENSEPATH);
                    break;

                case LicenseProvider.Words:
                    var license5 = new Aspose.Words.License();
                    license5.SetLicense(LICENSEPATH);
                    break;

                case LicenseProvider.Tasks:
                    var license6 = new Aspose.Tasks.License();
                    license6.SetLicense(LICENSEPATH);
                    break;

                case LicenseProvider.Imaging:
                    var license7 = new Aspose.Imaging.License();
                    license7.SetLicense(LICENSEPATH);
                    break;
                }
            }
            catch (Exception ex)
            {
                WriteLicenseException(ex);
            }
        }
        internal static void CheckLicense(LicenseProvider provider)
        {
            try
            {
                var licensePath = Common.LICENSEPATH;
                switch (provider)
                {
                case LicenseProvider.Cells:
                    new Aspose.Cells.License().SetLicense(licensePath);
                    break;

                case LicenseProvider.Diagram:
                    new Aspose.Diagram.License().SetLicense(licensePath);
                    break;

                case LicenseProvider.Pdf:
                    new Aspose.Pdf.License().SetLicense(licensePath);
                    break;

                case LicenseProvider.Slides:
                    new Aspose.Slides.License().SetLicense(licensePath);
                    break;

                case LicenseProvider.Words:
                    new Aspose.Words.License().SetLicense(licensePath);
                    break;

                case LicenseProvider.Tasks:
                    new Aspose.Tasks.License().SetLicense(licensePath);
                    break;

                case LicenseProvider.Imaging:
                    new Aspose.Imaging.License().SetLicense(licensePath);
                    break;

                case LicenseProvider.Email:
                    new Aspose.Email.License().SetLicense(licensePath);
                    break;
                }
            }
            catch (Exception ex)
            {
                WriteLicenseException(ex);
            }
        }
예제 #13
0
            public async Task InitializesTheLicenses()
            {
                var licenses = new Dictionary <string, string>
                {
                    { "Something", "Some long license" },
                    { "Something else", "Some other license" },
                    { "Third one", "Another even longer license" }
                };
                var expectedLicenses = licenses
                                       .Select(license => new License(license.Key, license.Value))
                                       .ToList();

                LicenseProvider.GetAppLicenses().Returns(licenses);

                await ViewModel.Initialize();

                ViewModel.Licenses.Should().BeEquivalentTo(expectedLicenses);
            }
예제 #14
0
        public IHttpActionResult GetSystemInfo()
        {
            var platformVersion = PlatformVersion.CurrentVersion.ToString();
            var license         = LicenseProvider.LoadLicense(); //need to be refactored into platform v.3

            var installedModules = _moduleCatalog.Modules.OfType <ManifestModuleInfo>().Where(x => x.IsInstalled).OrderBy(x => x.Id)
                                   .Select(x => x.ToWebModel())
                                   .ToArray();

            var result = new SystemInfo()
            {
                PlatformVersion  = platformVersion,
                License          = license,
                InstalledModules = installedModules
            };

            return(Ok(result));
        }
예제 #15
0
        // Methods
        public LicFileLicense(ALinqLicenseProvider owner, string userName, string key, CultureInfo culture)
        {
            this.owner    = owner;
            this.key      = key;
            this.UserName = userName;

            if (string.Equals(userName, Constants.TrialUserName, StringComparison.CurrentCulture))
            {
                this.LicenseType = LicenseType.Trial;
            }
            else if (string.Equals(userName, Constants.FreeUserName, StringComparison.CurrentCulture))
            {
                this.LicenseType = LicenseType.Free;
            }
            else
            {
                //this.LicenseType = LicenseType.Purchased;
                this.LicenseType = ALinqLicenseProvider.GetLicenseType(key);
            }
            this.Culture = culture;
        }
예제 #16
0
        public ActionResult Index()
        {
            var assembly        = Assembly.GetExecutingAssembly();
            var version         = PlatformVersion.CurrentVersion.ToString();
            var demoCredentials = ConfigurationHelper.GetAppSettingsValue("VirtoCommerce:DemoCredentials");
            var resetTimeStr    = ConfigurationHelper.GetAppSettingsValue("VirtoCommerce:DemoResetTime");
            var license         = LicenseProvider.LoadLicense();
            var licenseString   = JsonConvert.SerializeObject(license, new JsonSerializerSettings
            {
                ContractResolver     = new CamelCasePropertyNamesContractResolver(),
                DateTimeZoneHandling = DateTimeZoneHandling.Utc
            });

            if (!string.IsNullOrEmpty(resetTimeStr))
            {
                if (TimeSpan.TryParse(resetTimeStr, out var timeSpan))
                {
                    var now       = DateTime.UtcNow;
                    var resetTime = new DateTime(now.Year, now.Month, now.Day, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, DateTimeKind.Utc);

                    if (resetTime < now)
                    {
                        resetTime = resetTime.AddDays(1);
                    }

                    resetTimeStr = JsonConvert.SerializeObject(resetTime).Replace("\"", "'");
                }
            }

            return(View(new PlatformSetting
            {
                PlatformVersion = new MvcHtmlString(version),
                DemoCredentials = new MvcHtmlString(demoCredentials ?? "''"),
                DemoResetTime = new MvcHtmlString(resetTimeStr ?? "''"),
                License = new MvcHtmlString(licenseString),
                FavIcon = new MvcHtmlString(GetFavIcon() ?? "favicon.ico"),
            }));
        }
예제 #17
0
        static void Main(string[] args)
        {
            try
            {
                if (File.Exists("Client.info") == false)
                {
                    throw new VrLicenseException("Не найден файл информации о ПК клиента!");
                }

                LicenseProvider licenseProvider = new LicenseProvider();


                var licese = licenseProvider.GetLicenseValueByFile("Client.info");
                File.WriteAllText(GetPathLicense(), licese);
                Console.WriteLine(string.Format("Файл лицензии {0} создан в текущей директории, нажмите Enter для выхода", "Vr.lic"));
            }
            catch (Exception le)
            {
                Console.WriteLine(le);
            }

            Console.ReadLine();
        }
예제 #18
0
        public void Load()
        {
            if (!File.Exists(licensePath))
            {
                LoadTrial(); return;
            }

            using (var stream = new FileStream(licensePath, FileMode.Open))
            {
                LicenseProvider = _licenseProviderFactory.GetLicenseProvider(stream);
                var failures = LicenseProvider.ValidateLicense(PublicKeys.PublicKey);

                ((List <IValidationError>)Errors).Clear();
                foreach (var error in failures)
                {
                    ((List <IValidationError>)Errors).Add(error);
                }
            }

            _eventAggregator.GetEvent <AfterLicenseValidationRequestEvent>().Publish(new AfterLicenseValidationRequestEventArgs {
                IsValid = !LicenseHasErrors
            });
        }
예제 #19
0
            protected override LicensesViewModel CreateViewModel()
            {
                LicenseProvider.GetAppLicenses().Returns(licenses);

                return(base.CreateViewModel());
            }
예제 #20
0
 public DiagnosticsController(IModuleCatalog moduleCatalog, LicenseProvider licenseProvider)
 {
     _moduleCatalog   = moduleCatalog;
     _licenseProvider = licenseProvider;
 }
예제 #21
0
 public LicensingController(IOptions <PlatformOptions> platformOptions, ISettingsManager settingsManager, LicenseProvider licenseProvider)
 {
     _platformOptions = platformOptions.Value;
     _settingsManager = settingsManager;
     _licenseProvider = licenseProvider;
 }
예제 #22
0
 public LicenseProviderTests()
 {
     _options.SetupGet(x => x.Value).Returns(platformOptions);
     _licenseProvider = new LicenseProvider(_options.Object, _blobStorageProvider.Object, _blobUrlResolver.Object);
 }
예제 #23
0
        /// <summary>   Builds license text. </summary>
        ///
        /// <remarks>   trond, 2013-05-01. </remarks>
        ///
        /// <returns>   . </returns>
        private string BuildLicenseText()
        {
            StringBuilder licenseText = new StringBuilder();
            var           messenger   = _messengerFactory.Invoke();

            messenger.WriteLine("License summary:");
            licenseText.Append(
                string.Format("-------------------------------------------------------------------------------") +
                Environment.NewLine);
            ILicenseProvider  licenseProvider    = new LicenseProvider();
            OrderedDictionary uniqueLicenseInfos = new OrderedDictionary();

            List <ILicenseInfo> licenseInfos = licenseProvider.GetLicenses(Assembly.GetEntryAssembly());

            foreach (ILicenseInfo licenseInfo in licenseInfos)
            {
                if (!uniqueLicenseInfos.Contains(licenseInfo.ProductName))
                {
                    uniqueLicenseInfos.Add(licenseInfo.ProductName, licenseInfo);
                }
            }

            AssemblyName[] referencedAssemblies = typeof(HelpProvider).GetAssembly().GetReferencedAssemblies();
            foreach (AssemblyName referencedAssembly in referencedAssemblies)
            {
                IList <ILicenseInfo> referencedLicenseInfos =
                    licenseProvider.GetLicenses(Assembly.Load(referencedAssembly));
                foreach (ILicenseInfo licenseInfo in referencedLicenseInfos)
                {
                    if (!uniqueLicenseInfos.Contains(licenseInfo.ProductName))
                    {
                        uniqueLicenseInfos.Add(licenseInfo.ProductName, licenseInfo);
                    }
                }
            }
            foreach (ILicenseInfo licenseInfo in uniqueLicenseInfos.Values)
            {
                licenseText.Append(
                    string.Format("  (*) {0}, {1}, {2}", licenseInfo.ProductName, licenseInfo.ProductHome,
                                  licenseInfo.License) + Environment.NewLine);
            }
            licenseText.Append(
                string.Format("-------------------------------------------------------------------------------") +
                Environment.NewLine);
            licenseText.Append(string.Format("License details:") + Environment.NewLine);
            licenseText.Append(
                string.Format("-------------------------------------------------------------------------------") +
                Environment.NewLine);
            int count = 0;

            foreach (ILicenseInfo licenseInfo in uniqueLicenseInfos.Values)
            {
                count++;
                licenseText.Append(string.Format("Product: {0}", licenseInfo.ProductName) + Environment.NewLine);
                licenseText.Append(string.Format("Home: {0}", licenseInfo.ProductHome) + Environment.NewLine);
                licenseText.Append(string.Format("Lincence: {0}", licenseInfo.License) + Environment.NewLine);
                licenseText.Append(string.Format("{0}", licenseInfo.LicenseText) + Environment.NewLine);
                if (count < uniqueLicenseInfos.Values.Count)
                {
                    licenseText.Append(
                        string.Format("-------------------------------------------------------------------------------") +
                        Environment.NewLine);
                }
            }
            return(licenseText.ToString());
        }
예제 #24
0
 private Core(CredentialsManager credentialsLoader, LicenseProvider dataProvider, LicenseParser licenseParser)
 {
     m_credentialsManager = credentialsLoader;
     m_dataProvider       = dataProvider;
     m_licenseParser      = licenseParser;
 }
예제 #25
0
 /// <summary>
 /// 初始化前执行控件注册
 /// </summary>
 public static void Lic()
 {
     LicenseProvider.SetLicenseKey("POMjOWxTcjV4AQA7P/lrFATmGSjzuj8HnBaP8XUWFRNZCg1B3dt8ydoNeIRQESOw+uyBYNihw/SIWiTbFbgMkQ6pXEuwKLx63BYST0M9o5IMLWLcOlSYum2faY8Plnra02x8+YNijxHdzVOyLsVGgOCXlvtMKs6T80CFbxm313Q2bN7UKHut6GsS6Dr4biH2KtYxeozpLUtgPmsiirOKVsx9nDbqNCzeV63vj8HNjlBvgAMlzKIG+PuHp+YqpHEvz8SoHRVBd+LzDmWDpSp9GYB6TuhVhpviFYRRq4KFM1rczuQTNEM6QFLSVC/i/KjwhK3qqzFsQ2L7bXAndC2ZT87fCnOrJvrNgGV2Zig7SAgtybXGJFFPRS3urXSmn5rd8m2NwDZ7qZoGofB/DXVX2q9UuaoSuwcDmaiijASPdYCQ4uyMNNrBWyAO33hYqRC7praXKmh8Q0B+rP3GXHN3c/xSY0sK/Fnn3s6r3O9F9JLkgbJY+IVg9HPhI56xqXeYIBACuFLc7htmJ1kcE5z1oOK402lPes2N7eMkxPPLtxTWn5sBiuo4YxS9fTZ2L6qELkYJfgLoGVXUvq2DPpgayhzKIfzrGeeqnirn9XR1rOGoGtv09h0ASpSTKSFpDaR7gCD+rH1XznQEdwNuoqblBqUn4p96567nAnyAM+UrJhDWhQbm2fHoHmmV3dBvJmmzhX8Lxlb/yS43cKTMskOweXWsOe0YKWeXWFD/URAuu+4WiJAo0O2b2aBIcACDOT3Ez+eMR+zBVYR/oAj/6QkdPXgt727RCpN/TGm0eDZEcXmZjV6mjqDt9dFu1xKCTYFjRHx8DGrH+YPPxi524STi9Bbc1g1nuZiPhQkMa/rrEzaevT+h1X5c/VtBYk7B5Xu699IsG6yXFVd6+vOufi9icZ/kgjmMqQuYT4vlkQ8ThVXKgktiu8btdl7OpLhvO9OwPrihNExsT34ofeVOQcs8+j4LSrAV6I+2BRA2SQHKn4XCm0ZNAam3lKDdwUezOqPlpyURR+2OEgYRezQ6Jt63k8ENhGnKUMkAh1KT38zM0Jpc55i1fksrMZg6tMPgo3fd43mnZzx4eSJjhQH/x0J8sT/2tU0gqcAAq8aiPqCXoWS3proCuhW4dtD1OkETH3roj6IG3ZOetzLLwI0KL30G7Njk5amFQcX9kf0rBBHUzTEihRgaJhj8y6RmDXjaRnJhxYNtf9L1RAqcKbpWKQW7ce3PzLb/J5x/eVrxF8tUZApElq3bY+sszEkzH1N2lREdiWsUgl0MVxH1KOmws9B6JMwGnMceUBsI/qL5oaf6KcxK8FE+3mzkq57pO+hGaByPrI9NZYpsn1HlAH+KqYhsntSkyfmnyKKw2aJBMJsOu5c=");
 }
예제 #26
0
 public HomeController(IOptions <PlatformOptions> platformOptions, IOptions <WebAnalyticsOptions> webAnalyticsOptions, IWebHostEnvironment hostEnv, LicenseProvider licenseProvider)
 {
     _platformOptions     = platformOptions.Value;
     _webAnalyticsOptions = webAnalyticsOptions.Value;
     _hostEnv             = hostEnv;
     _licenseProvider     = licenseProvider;
 }