Ejemplo n.º 1
0
        /// <summary>Activates the license online.</summary>
        /// <param name="licenseId">The License ID issued by SOLO Server.</param>
        /// <param name="password">The customer password.</param>
        /// <returns>Returns true if the system was activated successfully. If false is returned, evaluate the <see cref="License.LastError"/> property to determine the reason why activation failed.</returns>
        internal bool ActivateOnline(Int32 licenseId, string password)
        {
            string licenseContent = "";

            //initialize the object used for calling the web service method
            XmlActivationService ws = m_WebServiceHelper.CreateXmlActivationServiceObject();

            if (null == ws)
            {
                this.LastError = m_WebServiceHelper.LastError;
                return(false);
            }

            //activate online using our endpoint configuration from app.config -- licenseContent may be disregarded, as the WritableLicense object's properties will be populated
            if (!this.ActivateInstallationLicenseFile(licenseId, password, ws, ref licenseContent))
            {
                return(false);
            }

            //Load our new license content
            if (!this.Load(licenseContent))
            {
                return(false);
            }

            //write the updated contents of the license file and aliases
            int filesToWrite, filesWritten;

            this.WriteAliases(out filesToWrite, out filesWritten);
            return(this.WriteLicenseFile(LicenseConfiguration.LicenseFilePath));
        }
Ejemplo n.º 2
0
        /// <summary>Creates a new <see cref="XmlActivationService"/> object, which may be used for processing web service methods centered around activation.</summary>
        /// <returns>Returns a new <see cref="XmlActivationService"/> object.</returns>
        public XmlActivationService CreateXmlActivationServiceObject()
        {
            //create the new web service object with our URL
            SoapHttpClientProtocol ws = new XmlActivationService();

            ws.Url = m_XmlActivationServiceUrl;

            if (!this.InitializeWebServiceObject(ref ws))
            {
                return(null);
            }

            //return the web service object
            return((XmlActivationService)ws);
        }
        /// <summary>Deactivates the installation online.</summary>
        /// <returns>Returns true if the system was deactivated successfully. If false is returned, evaluate the <see cref="License.LastError"/> property to determine the reason why deactivation failed.</returns>
        public bool DeactivateOnline()
        {
            //initialize the object used for calling the web service method
            XmlActivationService ws = m_WebServiceHelper.CreateXmlActivationServiceObject();

            if (null == ws)
            {
                this.LastError = m_WebServiceHelper.LastError;
                return(false);
            }

            if (this.DeactivateInstallation(ws) || this.LastError.ExtendedErrorNumber == 5010 || this.LastError.ExtendedErrorNumber == 5015 || this.LastError.ExtendedErrorNumber == 5016 || this.LastError.ExtendedErrorNumber == 5017)
            {
                File.Delete(LicenseConfiguration.LicenseFilePath);
                return(true);
            }

            return(false);
        }
        /// <summary>Activates the license online.</summary>
        /// <param name="licenseId">The License ID issued by SOLO Server.</param>
        /// <param name="password">The customer password.</param>
        /// <returns>Returns true if the system was activated successfully. If false is returned, evaluate the <see cref="License.LastError"/> property to determine the reason why activation failed.</returns>
        public bool ActivateOnline(Int32 licenseId, string password)
        {
            string licenseContent = "";

            //initialize the object used for calling the web service method
            XmlActivationService ws = m_WebServiceHelper.CreateXmlActivationServiceObject();

            if (null == ws)
            {
                this.LastError = m_WebServiceHelper.LastError;
                return(false);
            }

            //activate online using our endpoint configuration from app.config
            if (!this.ActivateInstallationLicenseFile(licenseId, password, ws, ref licenseContent))
            {
                return(false);
            }

            return(this.SaveLicenseFile(licenseContent));
        }
Ejemplo n.º 5
0
        /// <summary>Deactivates the installation online.</summary>
        /// <returns>Returns true if the system was deactivated successfully. If false is returned, evaluate the <see cref="License.LastError"/> property to determine the reason why deactivation failed.</returns>
        internal bool DeactivateOnline()
        {
            //initialize the object used for calling the web service method
            XmlActivationService ws = m_WebServiceHelper.CreateXmlActivationServiceObject();

            if (null == ws)
            {
                this.LastError = m_WebServiceHelper.LastError;
                return(false);
            }

            if (!this.DeactivateInstallation(ws))
            {
                if (this.LastError.ExtendedErrorNumber != 5010 && this.LastError.ExtendedErrorNumber != 5015 && this.LastError.ExtendedErrorNumber != 5016 && this.LastError.ExtendedErrorNumber != 5017)
                {
                    return(false);
                }
            }

            return(this.CreateExpiredEvaluation());
        }