Пример #1
0
        /// <summary>
        /// Gets the new version of this license from SKM.
        /// </summary>
        /// <param name="token">The access token. Read more at https://serialkeymanager.com/docs/api/v3/Auth </param>
        /// <param name="sign">If true, SKM will sign the current license key object.</param>
        /// <remarks>This method uses <see cref="GetKeysModel"/></remarks>
        /// <returns>Returns true if successful or false otherwise.</returns>
        public bool Refresh(string token, bool sign)
        {
            var parameters = new KeyInfoModel
            {
                ProductId = ProductId,
                Key       = Key,
                Sign      = sign
            };

            var result = SKM.V3.Methods.Key.GetKey(token, parameters);

            if (result != null && result.Result == ResultType.Success)
            {
                this.ActivatedMachines = result.LicenseKey.ActivatedMachines;
                this.AllowedMachines   = result.LicenseKey.AllowedMachines;
                this.Block             = result.LicenseKey.Block;
                this.Created           = result.LicenseKey.Created;
                this.Customer          = result.LicenseKey.Customer;
                this.DataObjects       = result.LicenseKey.DataObjects;
                this.Expires           = result.LicenseKey.Expires;
                this.F1              = result.LicenseKey.F1;
                this.F2              = result.LicenseKey.F2;
                this.F3              = result.LicenseKey.F3;
                this.F4              = result.LicenseKey.F4;
                this.F5              = result.LicenseKey.F5;
                this.F6              = result.LicenseKey.F6;
                this.F7              = result.LicenseKey.F7;
                this.F8              = result.LicenseKey.F8;
                this.GlobalId        = result.LicenseKey.GlobalId;
                this.ID              = result.LicenseKey.ID;
                this.Key             = result.LicenseKey.Key;
                this.MaxNoOfMachines = result.LicenseKey.MaxNoOfMachines;
                this.Notes           = result.LicenseKey.Notes;
                this.Period          = result.LicenseKey.Period;
                this.ProductId       = result.LicenseKey.ProductId;
                this.Signature       = result.LicenseKey.Signature;
                this.SignDate        = result.LicenseKey.SignDate;
                this.TrialActivation = result.LicenseKey.TrialActivation;
                return(true);
            }
            return(false);
        }
Пример #2
0
 /// <summary>
 /// This method will return information about a license key, similar to
 /// Validate [Web API 2]. In contrast to activation, this method (aka Key Validation)
 /// will be in read only mode. That is, it will not add a device to the license nor
 /// use trial activation. More about this in Remarks.
 /// </summary>
 /// <param name="token">Details such as Token and Version.</param>
 /// <param name="parameters">The parameters that the method needs.</param>
 /// <remarks>This method may, in rare cases, return null if an error has occurred.
 /// Null should be seen as an unsuccessful result.
 /// </remarks>
 /// <returns>A BasicResult object or null.</returns>
 public static KeyInfoResult GetKey(string token, KeyInfoModel parameters)
 {
     return(HelperMethods.SendRequestToWebAPI3 <KeyInfoResult>(parameters, "/key/getkey/", token));
 }