Пример #1
0
 /// <summary>
 /// Environments worden opgeslagen via de licentie
 /// </summary>
 /// <param name="savedFromParent"></param>
 public override void Save(bool savedFromParent)
 {
     if (License != null)
     {
         LicenseFile file = License.CreateLicenseFile(License.ServerName, this.Path, this.DomainName);
         this.EncryptedContent = file.EncryptedContent;
         this.Name             = DomainName;
         this.ServerName       = License.ServerName;
     }
     if (Version == null || Version == "")
     {
         string[] directories = Directory.GetDirectories(AppDomain.CurrentDomain.BaseDirectory + "\\App_Data\\Versions\\FullVersion");
         if (directories.Length == 1)
         {
             Version = System.IO.Path.GetFileName(directories[0]);
         }
     }
     base.Save(savedFromParent);
 }
Пример #2
0
        /// <summary>
        /// Aanmaken van LicenseFile-object.
        /// Dit is een sealed object zonder dataopslag en met alleen readonly properties
        /// </summary>
        /// <param name="serverName"></param>
        /// <param name="path"></param>
        /// <param name="domainName"></param>
        /// <returns></returns>
        public LicenseFile CreateLicenseFile(string serverName, string path, string domainName)
        {
            LicenseFile licenseFile = null;

            //eerst controleren of path en domeinname geldig is voor deze licentie
            string versionNumber = "";

            if (validateLicenseRequest(serverName, path, domainName, out versionNumber))
            {
                licenseFile = new LicenseFile();
                string key = serverName + path + domainName + Code;

                licenseFile.Name            = this.Name;
                licenseFile.Code            = this.Code;
                licenseFile.BitplateVersion = versionNumber;

                string propertiesString = createPropertiesString();
                licenseFile.EncryptedContent = Utils.Encrypter.EncryptString(propertiesString, key);
            }
            return(licenseFile);
        }