async private void BtnEmailClicked(object sender, EventArgs e)
        {
            UpdateUI(true);
            LicenseService service = new LicenseService(ProgramVars.LicURL);
            LicenseRequest request = new LicenseRequest()
            {
                Method     = "Request",
                ClientID   = "",
                DeviceID   = "",
                languageID = App.appSettings.languageID,
                ServerID   = "",
                Email      = tbEmail.Text
            };

            try {
                LicenseResult result = await service.ExecuteAsync(request);

                if (result.statusCode != 0)
                {
                    throw new Exception(result.status);
                }

                tbEmail.Text = "";
                UpdateUI(false);
                licensePanel.IsVisible = true;
                emailPanel.IsVisible   = false;

                await DisplayAlert(AppResources.Info, AppResources.LicenseRequested, AppResources.OK);
            }
            catch (Exception ex) {
                UpdateUI(false);
                await DisplayAlert(AppResources.Error, ex.Message, AppResources.OK);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.
        /// Other entry points will be used in specific cases, such as when the
        /// application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            NetworkService.CheckNetworkChange();

#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
            // Load product xml for IAP testing
            await LicenseService.LoadSimulatorAsync();
#endif
            Frame rootFrame = CreateRootFrame();

            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            if (e.PrelaunchActivated == false)
            {
                // When the navigation stack isn't restored navigate to the first page, configuring
                // the new page by passing required information as a navigation parameter
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }

                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
Beispiel #3
0
 public AdminController(
     IModuleChangeRepository moduleChangeRepository,
     CompanyService companyService,
     IUserRepository userRepository,
     LicenseService licenseService,
     ILicenseRepository licenseRepository,
     ICompanyRepository companyRepository,
     IInvoiceRepository invoiceRepository,
     IModuleRepository moduleRepository,
     InvoiceService invoiceService,
     IDefaultModuleRepository defaultModuleRepository,
     IDefaultLicenseRepository defaultLicenseRepository,
     EmailSenderService emailService)
 {
     this.emailService             = emailService;
     this.moduleChangeRepository   = moduleChangeRepository;
     this.licenseService           = licenseService;
     this.userRepository           = userRepository;
     this.companyService           = companyService;
     this.licenseRepository        = licenseRepository;
     this.companyRepository        = companyRepository;
     this.invoiceRepository        = invoiceRepository;
     this.moduleRepository         = moduleRepository;
     this.invoiceService           = invoiceService;
     this.defaultModuleRepository  = defaultModuleRepository;
     this.defaultLicenseRepository = defaultLicenseRepository;
 }
Beispiel #4
0
        /// <summary>
        /// Handle protocol activations.
        /// </summary>
        /// <param name="e">Details about the activate request and process.</param>
        protected override async void OnActivated(IActivatedEventArgs e)
        {
            if (e.Kind == ActivationKind.Protocol)
            {
                // Handle URI activation
                ProtocolActivatedEventArgs eventArgs = e as ProtocolActivatedEventArgs;

                // Initialize the links information
                LinkInformationService.Reset();

                bool      validUri  = true;
                Exception exception = null;
                try
                {
                    validUri = eventArgs.Uri.IsWellFormedOriginalString();
                    if (validUri)
                    {
                        // Use OriginalString to keep uppercase and lowercase letters
                        LinkInformationService.ActiveLink = UriService.ReformatUri(eventArgs.Uri.OriginalString);
                    }
                }
                catch (UriFormatException ex)
                {
                    validUri  = false;
                    exception = ex;
                }
                finally
                {
                    if (!validUri)
                    {
                        LogService.Log(MLogLevel.LOG_LEVEL_ERROR, "Invalid URI detected during app activation", exception);
                        await DialogService.ShowAlertAsync(ResourceService.AppMessages.GetString("AM_InvalidUri_Title"),
                                                           ResourceService.AppMessages.GetString("AM_InvalidUri"));
                    }
                }

                Frame rootFrame = CreateRootFrame();

                if (eventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // When the navigation stack isn't restored navigate to the first page, configuring
                // the new page by passing required information as a navigation parameter
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), eventArgs);
                }

                // Ensure the current window is active
                Window.Current.Activate();

                // Check session and special navigation
                await AppService.CheckActiveAndOnlineSessionAsync();

                // Validate product subscription license on background thread
                Task.Run(() => LicenseService.ValidateLicensesAsync());
            }
        }
Beispiel #5
0
        public void ReturnIndex()
        {
            // Arrange
            var bus  = new Mock <IBusControl>();
            var repo = new Mock <ILicensesRepository>();

            repo.Setup(repo => repo.GetAllReservations())
            .Returns(ReservationTestData.Reservations);

            var service = new LicenseService(bus.Object, repo.Object);

            var controller = new LicensesController(service);

            // Act
            var result = controller.Index();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <List <Licenses> >(viewResult.ViewData.Model);

            Assert.Equal(2, model.Count());

            //Assert.Equal("Tudor", model[0].Name);
            //Assert.Equal(WashMachineType.Gorenje, model[0].WashMachineType);
            //Assert.Equal("Tudor2", model[1].Name);
            //Assert.Equal(WashMachineType.Bosh, model[1].WashMachineType);
        }
Beispiel #6
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                LicenseService = ScopedServices.GetRequiredService <ILicenseService>();

                LicenseOrder = await LicenseService.GetLicenseOrderByIdAsync(LicenseOrderId);

                if (LicenseOrder == null)
                {
                    throw new Exception("License Order not found.");
                }

                EntityBeingEdited = MemoryCache.TryGetValue(LicenseOrder.Id, out object _);
                if (!EntityBeingEdited)
                {
                    MemoryCache.Set(LicenseOrder.Id, LicenseOrder);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
                await ModalDialogCancel();
            }
        }
Beispiel #7
0
        static void ProductionMain()
        {
            Thread.CurrentThread.CurrentCulture       =
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ja-JP");
            string licenseKey = "bXvLQ7WQJLz4zOWV5Voyt8RJrQXnZTd1udgGXn+FZUB4Ix1NIYUuy+Rkv7aCSpN/NjkgVcdfJSGvlqvqFXzoFPJAnMUZ/BT4n6Ca+/7R6D0BIVjLHusFpSJblH9EjHPzardNaVkIFMwbUhVytP20Gds3/UAB9AJBR+2OaNV075s=";

            //試用期限2010年02月20日までのライセンス・キーです。
            licenseKey = "RkU0PlcLa0DFX4FKOsNMRqvwwhoxQL1AWr7vqnC7zCeH6MyOX0tcq8Tq87l20rryt0G6a7w5bhrk2L55+AVqqgSQIABHVXRuvt3ZNIOx2iTpzeltbKZ5/dZuCOnVkzNuytNvdyNealCjtQvczlPfwaMGTJ1s8WcxRvpdx8bnhVo=";
            //SendNoticeToLix(null);
            using (LicenseService Ls = new LicenseService()){
                string   text = Ls.ParseLicenseKey(licenseKey);
                DateTime expiry;
                DateTime.TryParse(text, out expiry);
                Report("{0}#{1}", expiry.ToLongDateString(), expiry.ToLongTimeString());
                //Ls.CleanActivationCache();
                Report("{0}", Ls.GetActivationSet("W8V154BX COM1"));
                Report("{0}", Ls.GetActivationSet("W8V154BX COM2"));
                Report("{0}", Guid.NewGuid());
                string[] names = Ls.GetLicenseStateStrings();
                foreach (string name in names)
                {
                    Print(@"case LicenseState.{0}:", name);
                    Print(@"text=ResourceFactory.Get(""License_{0}"");", name);
                    Print(@"break;");
                }
            }
            //GenerateTrialLicenseKey(14);
        }
Beispiel #8
0
        public TranslateService(IDatabase database, LicenseService license, LogHandler logger, DiscordShardedClient client, LocalManagementService localManagementService)
        {
            Database = database;
            License  = license;
            Logger   = logger;
            Client   = client;
            LocalManagementService = localManagementService;
            Config = GetTranslateConfig();
            if (Config.APIKey != null && Config.Enabled)
            {
                if (Config.ApiKeyType == TranslateConfig.ApiKey.Google)
                {
                    Translator = new GoogleTranslator(Config.APIKey);
                }
                else if (Config.ApiKeyType == TranslateConfig.ApiKey.Yandex)
                {
                    Translator = new YandexTranslator(Config.APIKey);
                }
                else
                {
                    throw new NotImplementedException("The specified api type is not implemented");
                }

                Client.ReactionAdded += ReactionAdded;
            }
            else if (Config.APIKey == null && Config.Enabled)
            {
                logger.Log("Translate API is enabled but no API Key is specified.", LogSeverity.Warning);
            }
        }
Beispiel #9
0
        private async void OnSelectedPaymentMethod(object sender, Telerik.Windows.Controls.ListBoxItemTapEventArgs e)
        {
            if (!NetworkService.IsNetworkAvailable(true))
            {
                return;
            }

            switch (((PaymentMethod)LstPaymentMethods.SelectedItem).PaymentMethodType)
            {
            case MPaymentMethod.PAYMENT_METHOD_WINDOWS_STORE:
                await LicenseService.PurchaseProduct(_paymentViewModel.SelectedProduct);

                break;

            case MPaymentMethod.PAYMENT_METHOD_CENTILI:
            case MPaymentMethod.PAYMENT_METHOD_FORTUMO:
                SdkService.MegaSdk.getPaymentId(_paymentViewModel.SelectedProduct.Handle, new GetPaymentUrlRequestListener(((PaymentMethod)LstPaymentMethods.SelectedItem).PaymentMethodType));
                break;

            case MPaymentMethod.PAYMENT_METHOD_CREDIT_CARD:
                PageSubtitle.Text = UiResources.EnterPaymentDetails;
                _paymentViewModel.ProductSelectionIsEnabled       = false;
                _paymentViewModel.PaymentMethodSelectionIsEnabled = false;
                _paymentViewModel.CreditCardPaymentIsEnabled      = true;
                ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true;
                break;
            }
        }
Beispiel #10
0
 public ModuleController(RequestService requestService,
                         UserManager <AppUser, int> userManager,
                         CompanyService companyService,
                         IUserRepository userRepository,
                         LicenseService licenseService,
                         ILicenseRepository licenseRepository,
                         ICompanyRepository companyRepository,
                         IInvoiceRepository invoiceRepository,
                         IModuleRepository moduleRepository,
                         InvoiceService invoiceService,
                         IDefaultModuleRepository defaultModuleRepository,
                         IDefaultLicenseRepository defaultLicenseRepository)
 {
     this.licenseService           = licenseService;
     this.userRepository           = userRepository;
     this.licenseRepository        = licenseRepository;
     this.companyRepository        = companyRepository;
     this.invoiceRepository        = invoiceRepository;
     this.moduleRepository         = moduleRepository;
     this.invoiceService           = invoiceService;
     this.defaultModuleRepository  = defaultModuleRepository;
     this.defaultLicenseRepository = defaultLicenseRepository;
     this.userManager    = userManager;
     this.requestService = requestService;
 }
        public async void Register_200()
        {
            var mockHandler = new MockHttpMessageHandler();

            var response = new LicenseRegisterResult
            {
                License = "200",
                Failure = new GeneralValidationFailure
                {
                    Code         = "code",
                    Message      = "message",
                    HowToResolve = "how-to-resolve"
                }
            };

            var str = JsonSerializer.Serialize(response);

            mockHandler
            .When("/api/license")
            .Respond("application/json", str);

            var client = mockHandler.ToHttpClient();

            var actx  = Substitute.For <IApplicationContext>();
            var appId = Guid.NewGuid().ToString();

            actx.GetAppId().Returns(appId);

            var service = new LicenseService(actx, client);

            var result = await service.RegisterHttpAsync(Guid.NewGuid(), Guid.NewGuid(), new Dictionary <string, string>(), LicenseGlobals.LicenseServerUrl);

            Assert.Equal("200", result.License);
            Assert.Equal("code", result.Failure.Code);
        }
        public async void ValidateAsync_Exception()
        {
            var mockHandler = new MockHttpMessageHandler();
            var client      = mockHandler.ToHttpClient();

            var actx  = Substitute.For <IApplicationContext>();
            var appId = Guid.NewGuid().ToString();

            actx.GetAppId().Returns(appId);

            var service = new LicenseService(actx, client);

            var path = service.GetPath();

            try
            {
                File.WriteAllText(path, "");

                var result = await service.ValidateAsync();

                Assert.False(result.Successful);
                Assert.Null(result.License);
                Assert.NotNull(result.Exception);
                Assert.Equal("VAL.01", result.Failures.ElementAt(0).Code);
            }
            finally
            {
                File.Delete(path);
            }
        }
Beispiel #13
0
        public async void GetPricing()
        {
            this.UpgradeAccount.InAppPaymentMethodAvailable = await LicenseService.IsAvailable();

            MegaSdk.getPaymentMethods(new GetPaymentMethodsRequestListener(UpgradeAccount));
            MegaSdk.getPricing(new GetPricingRequestListener());
        }
Beispiel #14
0
        public void Initialize()
        {
            State = new Dependency.Impl.State();
            State.MetadataBuilder = new MetadataBuilder(_framework);
            var firstOrDefaultService = _framework.ServiceContainer.GetFirstOrDefaultService <IBundleInstallerService>();
            var stopwatch             = new Stopwatch();

            try
            {
                stopwatch.Start();
                if (!firstOrDefaultService.InstallBundles())
                {
                    throw new Exception(Messages.LoadBundlesFailed);
                }
            }
            finally
            {
                stopwatch.Stop();
                FileLogUtility.Verbose(string.Format(Messages.InstallBundlesTimeCounter, stopwatch.ElapsedMilliseconds));
            }
            UpdateService.Update(new List <BundleData>(firstOrDefaultService.BundleDatas.Values), firstOrDefaultService.UpdateFolder);
            LicenseService.EnsureHasAvailableBundleLicense();
            var metadataBuilder = State.MetadataBuilder;

            CreateSystemBundle();
            foreach (KeyValuePair <string, BundleData> pair in firstOrDefaultService.BundleDatas)
            {
                _framework.AddBundleData(pair.Value);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //Uncomment if you want to check for security purposes whether request is valid
//             if (!IsIPValid(this.Request))
//                 throw new Exception("Invalid IP");

                // Load license project file
                gen = CryptoLicenseGenerator.FromSettingsFile(Path.Combine(HttpRuntime.AppDomainAppPath, LicenseService.MakePortablePath(@"App_Data\settings.xml")));

                // ***IMPORTANT***: Set your 'CryptoLicensing License Service' license code below.
                // It can be found in the email containing the license information that you received from LogicNP when you purchased the product.
                // LEAVE BLANK when using evaluation version of CryptoLicensing.
                gen.SetLicenseCode("");

                // If profile is specified above, select it so that generated license
                // has same settings as specified by profile
                if (profileName.Length > 0)
                {
                    gen.SetActiveProfile(profileName);
                }

                // OPTIONAL: Set 'Numer of Users' setting of license to the quantity purchased
                //gen.NumberOfUsers = (short)GetHttpParam("QUANTITY", 1);

                // OPTIONAL: Use purchase data if desired
                // ShareIt notifies the purchase date in format specified in following line
                //DateTime datePurchased = GetHttpParam("PURCHASE_DATE", "dd/MM/yyyy",DateTime.Now);

                // Extract info for setting userdata
                string userName = GetHttpParam("ccustfullname", string.Empty);
                string email    = GetHttpParam("ccustemail", string.Empty);

                // Set user data
                gen.UserData = userName + "#" + email;

                // To populate the License Management database with user data
                // fields when generating licenses using the API,
                // see http://www.ssware.com/support/viewtopic.php?t=750
                // In this case, make sure to remove the "gen.UserData = ..." line above

                // Generate license
                string license = gen.Generate();

                // Send email if desired
                if (send_email)
                {
                    SendEmail(email);
                }
            }
            catch (Exception ex)
            {
                if (log_exceptions && !(ex is System.Threading.ThreadAbortException))
                {
                    LicenseService.LogException(ex);
                }
            }
        }
        public void Delete_ShouldThrowExceptionWhenIdNotFound()
        {
            var repo      = DeletableEntityRepositoryMock.Get <License>(new List <License>());
            var service   = new LicenseService(repo.Object);
            var exception = Assert.Throws <AggregateException>(() => service.DeleteAsync("id").Wait());

            Assert.Contains("License does not exist!", exception.Message);
        }
Beispiel #17
0
        protected override void OnSuccesAction(MegaSDK api, MRequest request)
        {
            SettingsService.SaveMegaLoginData(_loginViewModel.Email,
                                              _loginViewModel.SessionKey);

            // Validate product subscription license on background thread
            Task.Run(() => LicenseService.ValidateLicenses());
        }
Beispiel #18
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     LicenseService.SetLicense();
 }
Beispiel #19
0
 public App(IOptions <AppSettings> settings, ILogger <App> logger, LicenseClient client, LicenseService service, DbConnection db)
 {
     _logger   = logger ?? throw new ArgumentNullException(nameof(logger));
     _settings = settings?.Value ?? throw new ArgumentNullException(nameof(settings));
     _client   = client ?? throw new ArgumentNullException(nameof(client));
     _service  = service ?? throw new ArgumentNullException(nameof(service));
     _db       = db ?? throw new ArgumentNullException(nameof(db));
 }
Beispiel #20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            LicenseService license = new LicenseService();

            string getEncrypt = license.Encrypt(txtKey.Text.Trim());

            txtKey.Text = getEncrypt;
        }
Beispiel #21
0
 static void SendNoticeToLix(object param)
 {
     using (LicenseService Ls = new LicenseService()) {
         ActivationSet item = new ActivationSet(Environment.MachineName, typeof(Program).AssemblyQualifiedName);
         string        xml  = ActivationSet.ToXmlString(item);
         Ls.AddActivationSet(xml);
     }
 }
Beispiel #22
0
        string ReadFile(string filePath)
        {
            filePath = LicenseService.GetRealFilePath(filePath);
            StreamReader reader = new StreamReader(filePath);
            string       ret    = reader.ReadToEnd();

            reader.Close();
            return(ret);
        }
Beispiel #23
0
        public static void Main(string[] args)
        {
            Configure();

            var service = new LicenseService();
            var license = service.CreateLicense("Ivan");

            service.ShowLicenseInfo(license);
        }
Beispiel #24
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            // Create Telerik Diagnostics with support e-mail address
            var diagnostics = new RadDiagnostics
            {
                EmailTo = AppResources.DiagnosticsEmailAddress
            };

            diagnostics.Init();

            // Subscribe to the NetworkAvailabilityChanged event
            DeviceNetworkInformation.NetworkAvailabilityChanged += new EventHandler <NetworkNotificationEventArgs>(NetworkAvailabilityChanged);

            // APP THEME OVERRIDES
            Resources.Remove("PhoneAccentColor");
            Resources.Add("PhoneAccentColor", (Color)Current.Resources["MegaRedColor"]);
            ((SolidColorBrush)Resources["PhoneAccentBrush"]).Color            = (Color)Current.Resources["MegaRedColor"];
            ((SolidColorBrush)Resources["PhoneTextBoxEditBorderBrush"]).Color = (Color)Current.Resources["MegaRedColor"];

#if DEBUG
            // Setup Mocking IAP library (only in debug mode)
            LicenseService.SetupMockIap();
#endif
        }
Beispiel #25
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     LicenseService.SetLicense();
     // LibraryService.StartTaskSchedulerGlobal();//khởi chạy backup dữ liệu
 }
Beispiel #26
0
        protected override void OnSuccesAction(MegaSDK api, MRequest request)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                _mainPageViewModel.FetchNodes();

                // Validate product subscription license on background thread
                Task.Run(() => LicenseService.ValidateLicenses());
            });
        }
Beispiel #27
0
        // END SETTINGS

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Load license project file
                CryptoLicenseGenerator gen = CryptoLicenseGenerator.FromSettingsFile(Path.Combine(HttpRuntime.AppDomainAppPath, LicenseService.MakePortablePath(@"App_Data\settings.xml")));

                // ***IMPORTANT***: Set your 'CryptoLicensing License Service' license code below.
                // It can be found in the email containing the license information that you received from LogicNP when you purchased the product.
                // LEAVE BLANK when using evaluation version of CryptoLicensing.
                gen.SetLicenseCode("");

                // If profile is specified above, select it so that generated license
                // has same settings as specified by profile
                if (profileName.Length > 0)
                {
                    gen.SetActiveProfile(profileName);
                }

                // OPTIONAL: Set 'Numer of Users' setting of license to the quantity purchased
                //gen.NumberOfUsers = (short)GetHttpParam("quantity", 1);

                // OPTIONAL: Use purchase data if desired
                // RegNow notifies the purchase date in format specified in following line
                //DateTime datePurchased = GetHttpParam("date", "MM/dd/yyyy",DateTime.Now);

                // Extract info for setting userdata
                string userName = GetHttpParam("name", string.Empty);
                string email    = GetHttpParam("email", string.Empty);
                string company  = GetHttpParam("company", string.Empty);

                // Set user data
                gen.UserData = userName + "#" + company + "#" + email;

                // To populate the License Management database with user data
                // fields when generating licenses using the API,
                // see http://www.ssware.com/support/viewtopic.php?t=750
                // In this case, make sure to remove the "gen.UserData = ..." line above

                // Generate license
                string license = gen.Generate();

                // Return generated license code directly inline
                Response.ContentType = "text/plain";
                Response.Write(license);
                Response.End();
            }
            catch (Exception ex)
            {
                if (log_exceptions && !(ex is System.Threading.ThreadAbortException))
                {
                    LicenseService.LogException(ex);
                }
            }
        }
Beispiel #28
0
        static void GenerateTrialLicenseKey(double days)
        {
            string         seed = DateTime.Today.Add(TimeSpan.FromDays(days)).ToLongDateString();
            LicenseService Bob  = new LicenseService();

            using (LicenseGenerator Alice = new LicenseGenerator()) {
                string text64 = Bob.EncryptSessionKeyByRSA(seed, Alice.Public_KeyUsed);
                byte[] buff   = Convert.FromBase64String(text64);
                Report("Trial License until {1}:\n{0}", text64, Alice.DecryptSessionKeyByRSA(text64));
            }
        }
        protected override async Task OnInitializedAsync()
        {
            try
            {
                LicenseService       = ScopedServices.GetRequiredService <ILicenseService>();
                HardwareVaultService = ScopedServices.GetRequiredService <IHardwareVaultService>();

                LicenseOrder = await LicenseService.GetLicenseOrderByIdAsync(LicenseOrderId);

                if (LicenseOrder == null)
                {
                    throw new Exception("License Order not found.");
                }

                EntityBeingEdited = MemoryCache.TryGetValue(LicenseOrder.Id, out object _);
                if (!EntityBeingEdited)
                {
                    MemoryCache.Set(LicenseOrder.Id, LicenseOrder);
                }

                if (!LicenseOrder.ProlongExistingLicenses)
                {
                    _newLicenseOrder = new NewLicenseOrder()
                    {
                        ContactEmail   = LicenseOrder.ContactEmail,
                        Note           = LicenseOrder.Note,
                        StartDate      = LicenseOrder.StartDate.Value,
                        EndDate        = LicenseOrder.EndDate,
                        HardwareVaults = await HardwareVaultService.GetVaultsWithoutLicenseAsync()
                    };
                    _newLicenseOrder.HardwareVaults.ForEach(x => x.Checked = LicenseOrder.HardwareVaultLicenses.Any(d => d.HardwareVaultId == x.Id));
                }
                else
                {
                    _renewLicenseOrder = new RenewLicenseOrder()
                    {
                        ContactEmail   = LicenseOrder.ContactEmail,
                        Note           = LicenseOrder.Note,
                        EndDate        = LicenseOrder.EndDate,
                        HardwareVaults = await HardwareVaultService.GetVaultsWithLicenseAsync()
                    };
                    _renewLicenseOrder.HardwareVaults.ForEach(x => x.Checked = LicenseOrder.HardwareVaultLicenses.Any(d => d.HardwareVaultId == x.Id));
                }

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
Beispiel #30
0
        public void GetAllLicenseByIDCardTest()
        {
            LicenseService target = new LicenseService();                       // TODO: Initialize to an appropriate value
            string         idCard = "1589900053854";                            // TODO: Initialize to an appropriate value
            ResponseService <List <PersonLicenseTransaction> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <List <PersonLicenseTransaction> > actual;

            actual = target.GetAllLicenseByIDCard(idCard, "1", 1);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #31
0
            public WhenStateOfFeatureIsUnknownTests()
            {
                domain = "domain.com";
                featureOne = Guid.NewGuid();
                featureTwo = Guid.NewGuid();
                featureThree = Guid.NewGuid();

                var httpClient = Substitute.For<IHttpClient>();
                licenseService = new LicenseService(httpClient);

                var config = new Config();
                licenseService.Install(config);

                licenseService.NotifyUse(domain, featureOne);
                licenseService.NotifyUse(domain, featureTwo);
                licenseService.NotifyUse(domain, featureThree);
            }
 public InstallUninstallTests()
 {
     var httpClient = Substitute.For<IHttpClient>();
     licenseService = new LicenseService(httpClient);
 }