Esempio n. 1
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);
        }
Esempio n. 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);
        }