/// <summary>
        /// Gets the latest version information.
        /// </summary>
        /// <returns>Returns the LatestVersionInformation</returns>
        public LatestVersionInformation GetLatestVersionInformation()
        {
            if (this.Get <HttpApplicationStateBase>()["YafRegistrationLatestInformation"] is LatestVersionInformation latestInfo)
            {
                return(latestInfo);
            }

            try
            {
                using (var reg = new RegisterV2())
                {
                    reg.Timeout = 30000;

                    // load the latest info -- but only provide the current version information and the user's two-letter language information. Nothing trackable.))
                    latestInfo = reg.LatestInfo(YafForumInfo.AppVersionCode, "US");

                    if (latestInfo != null)
                    {
                        this.Get <HttpApplicationStateBase>().Set("YafRegistrationLatestInformation", latestInfo);
                    }
                }
            }
#if DEBUG
            catch (Exception x)
            {
                this.Get <ILogger>().Error(x, "Exception In LatestInformationService");
#else
            catch (Exception)
            {
#endif
                return(null);
            }

            return(latestInfo);
        }
Пример #2
0
        /// <summary>
        /// The run once.
        /// </summary>
        public override void RunOnce()
        {
            try
            {
                using (var reg = new RegisterV2())
                {
                    reg.Timeout = 30000;

                    // load the latest info -- but only provide the current version information and the user's two-letter language information. Nothing trackable.))
                    var latestInfo = reg.LatestInfo(YafForumInfo.AppVersionCode, this.Culture);

                    if (latestInfo != null)
                    {
                        this.Get <HttpApplicationStateBase>().Set("YafRegistrationLatestInformation", latestInfo);
                    }
                }
            }
            catch (Exception x)
            {
#if DEBUG
                this.Logger.Error(x, "Exception In {0}", _taskName);
#endif
            }
        }