/// <summary>Refreshes the license file with the latest data from SOLO Server.</summary>
        /// <returns>Returns true if the license file was refreshed successfully. If false is returned, evaluate the <see cref="License.LastError"/> property to determine the reason why the refresh failed.</returns>
        public bool RefreshLicense()
        {
            //initialize the object used for calling the web service method
            XmlLicenseFileService ws = m_WebServiceHelper.CreateXmlLicenseFileServiceObject();

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

            string licenseContent = "";

            if (!base.RefreshLicense(ws, ref licenseContent))
            {
                if (this.LastError.ExtendedErrorNumber == 5010 || this.LastError.ExtendedErrorNumber == 5015 || this.LastError.ExtendedErrorNumber == 5016 || this.LastError.ExtendedErrorNumber == 5017)
                {
                    File.Delete(LicenseConfiguration.LicenseFilePath);
                    return(true);
                }
                return(false);
            }

            //try to save the license file to the file system
            if (!SaveLicenseFile(licenseContent))
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        /// <summary>Refreshes the license file.</summary>
        /// <returns>Returns true if the license file was refreshed successfully.  If false is returned, see the <see cref="License.LastError"/> property for details.</returns>
        internal bool RefreshLicense()
        {
            string licenseContent = "";

            //initialize the object used for calling the web service method
            using (XmlLicenseFileService ws = m_Settings.CreateNewXmlLicenseFileServiceObject())
            {
                if (null == ws)
                {
                    LastError = new LicenseError(LicenseError.ERROR_WEBSERVICE_INVALID_CONFIGURATION);
                    return(false);
                }

                if (!base.RefreshLicense(ws, ref licenseContent))
                {
                    if (SampleLicense.ShouldLicenseBeRevoked(LastError.ExtendedErrorNumber))
                    {
                        RemoveLicense();
                    }
                    return(false);
                }
            }

            //try to save the license file to the file system
            if (!SaveLicenseFile(licenseContent, false))
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        /// <summary>Refreshes the license file.</summary>
        /// <returns>Returns true if the license file was refreshed successfully.  If false is returned, see the <see cref="License.LastError"/> property for details.</returns>
        internal bool RefreshLicense(XmlLicenseFileService webservice)
        {
            if (null == webservice)
            {
                LastError = new LicenseError(LicenseError.ERROR_WEBSERVICE_INVALID_CONFIGURATION);
                return(false);
            }

            string licenseContent = "";

            if (!base.RefreshLicense(webservice, ref licenseContent))
            {
                if (SampleLicense.ShouldLicenseBeRevoked(LastError.ExtendedErrorNumber))
                {
                    if (!RemoveLicense())
                    {
                        return(false);
                    }
                }
                return(false);
            }

            //try to save the license file to the file system
            if (!SaveLicenseFile(licenseContent))
            {
                return(false);
            }

            return(true);
        }
示例#4
0
        /// <summary>Refreshes the license file with the latest data from SOLO Server.</summary>
        /// <returns>Returns true if the license file was refreshed successfully. If false is returned, evaluate the <see cref="License.LastError"/> property to determine the reason why the refresh failed.</returns>
        internal bool RefreshLicense()
        {
            //initialize the object used for calling the web service method
            XmlLicenseFileService ws = m_WebServiceHelper.CreateXmlLicenseFileServiceObject();

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

            string licenseContent = "";

            if (!this.RefreshLicense(ws, ref licenseContent))
            {
                if (this.LastError.ExtendedErrorNumber == 5010 || this.LastError.ExtendedErrorNumber == 5015 || this.LastError.ExtendedErrorNumber == 5016 || this.LastError.ExtendedErrorNumber == 5017)
                {
                    this.CreateExpiredEvaluation();
                    return(true);
                }
                return(false);
            }

            //Write the updated contents of the license file and aliases.
            return(SaveLicenseFile(licenseContent));
        }
        /// <summary>Creates a new <see cref="XmlLicenseFileService"/> object, which may be used for processing web service methods centered around XML license file calls to SOLO Server.</summary>
        /// <returns>Returns a new <see cref="XmlLicenseFileService"/> object.</returns>
        public XmlLicenseFileService CreateXmlLicenseFileServiceObject()
        {
            //create the new web service object with our URL
            SoapHttpClientProtocol ws = new XmlLicenseFileService();

            ws.Url = m_XmlLicenseFileServiceUrl;

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

            //return the web service object
            return((XmlLicenseFileService)ws);
        }