Exemple #1
0
        /// <summary>
        /// Copy constructor
        /// </summary>
        /// <param name="l"></param>
        public TheLicense(TheLicense l)
        {
            LicenseId      = l.LicenseId;
            Description    = l.Description;
            LicenseVersion = l.LicenseVersion;
            SkuId          = l.SkuId;
            if (l.PluginLicenses != null)
            {
                PluginLicenses = new ThePluginLicense[l.PluginLicenses.Length];
                {
                    int licIndex = 0;

                    foreach (var pluginLicense in l.PluginLicenses)
                    {
                        PluginLicenses[licIndex] = new ThePluginLicense
                        {
                            PlugInId    = pluginLicense.PlugInId,
                            DeviceTypes = pluginLicense.DeviceTypes.ToArray(),
                            AllowGlobalThingEntitlements = pluginLicense.AllowGlobalThingEntitlements,
                        };
                        licIndex++;
                    }
                }
            }
            Expiration             = l.Expiration;
            ActivationKeyValidator = l.ActivationKeyValidator;

            if (l.Parameters != null)
            {
                Parameters = new TheLicenseParameter[l.Parameters.Length];

                int paramIndex = 0;
                foreach (var parameter in l.Parameters)
                {
                    Parameters[paramIndex] = new TheLicenseParameter {
                        Name = parameter.Name, Value = parameter.Value
                    };
                    paramIndex++;
                }
            }

            if (l.Properties != null)
            {
                Properties = new TheLicenseProperty[l.Properties.Length];
                int propertyIndex = 0;
                foreach (var property in l.Properties)
                {
                    Properties[propertyIndex] = new TheLicenseProperty {
                        Name = property.Name, Value = property.Value
                    };
                    propertyIndex++;
                }
            }

            if (l.Signatures != null)
            {
                Signatures = l.Signatures.ToArray();
            }
        }
Exemple #2
0
        public TheActivatedLicense(TheActivatedLicense al)
        {
            ActivationKeyHash       = al.ActivationKeyHash;
            ActivationKeyExpiration = al.ActivationKeyExpiration;
            License             = new TheLicense(al.License);
            ActivatedParameters = new TheLicenseParameter[al.ActivatedParameters.Length];
            int index = 0;

            foreach (var parameter in al.ActivatedParameters)
            {
                ActivatedParameters[index] = new TheLicenseParameter {
                    Name = parameter.Name, Value = parameter.Value
                };
                index++;
            }
            IsExpiredAndRemoved = al.IsExpiredAndRemoved;
        }