Exemplo n.º 1
0
        private void FormAbout_Load(object sender, EventArgs e)
        {
            Text = $"About {AssemblyTitle}";
            labelProductName.Text   = AssemblyProduct;
            labelVersion.Text       = $"Version {AssemblyVersion}";
            labelCopyright.Text     = AssemblyCopyright;
            labelCompanyName.Text   = AssemblyCompany;
            textBoxDescription.Text = AssemblyDescription;

            var licenseData = new LicenseDataModel {
                RegistrationData = new RegistrationDataModel {
                    ComputerId = SysInfoManager.GetComputerId()
                }
            };

            licenseInfoControl1.InitLicenseData(licenseData);
            licenseInfoControl1.CreateRequest = ShowLicenseRequestForm;
        }
Exemplo n.º 2
0
        public bool LoadLicenseFromFile(string filename)
        {
            FileStream fs = null;

            try
            {
                if (!File.Exists(filename))
                {
                    return(false);
                }

                fs = File.OpenRead(filename);
                if (fs.Length > MaxFileSize)
                {
                    throw new Exception("Invalid length of license file");
                }

                TextReader tr            = new StreamReader(fs);
                string     licenseBase64 = tr.ReadToEnd();
                fs.Close();

                _licenseData = ObjectSerializer.DeserializeLicenseDataFromString(licenseBase64);

                _serviceState.Valid     = false;
                _serviceState.Validated = false;

                return(_licenseData != null);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "LoadLicenseFromFile");
            }
            finally
            {
                fs?.Close();
            }

            return(false);
        }
Exemplo n.º 3
0
        public void BasicTest()
        {
            //Arrange
            var storageService   = new LicenseStorageService();
            var licenseDataModel = new LicenseDataModel
            {
                ContactPerson = "George"
            };

            //Act
            storageService.AddOrUpdate(licenseDataModel);
            var result = storageService.Get(licenseDataModel.Id);

            //Assert
            Assert.Equal("George", result.ContactPerson);

            //Arrange
            licenseDataModel.ContactPerson = "George2";
            storageService.AddOrUpdate(licenseDataModel);
            result = storageService.Get(licenseDataModel.Id);

            //Assert
            Assert.Equal("George2", result.ContactPerson);
        }
 public SerialNumberGenerator(RSAParameters pubRSAKey, SerialNumbersSettings.ProtectedApp app)
 {
     this._app         = app;
     this._rsaPubKey   = pubRSAKey;
     this._licenseData = new LicenseDataModel();
 }
 public void InitLicenseData(LicenseDataModel licenseData)
 {
     _licenseData = licenseData;
     InitControlState();
 }
 public SerialNumberManager(RSAParameters pubRsaKey, SerialNumbersSettings.ProtectedApp app)
 {
     _app         = app;
     _rsaPubKey   = pubRsaKey;
     _licenseData = new LicenseDataModel();
 }