コード例 #1
0
        public void CheckForNewVersion()
        {
            //NewVersionAvailable
            try
            {
                VersionChecker vcReleasedPageStripper = new VersionChecker("Pulse", new RssFeedReleases());

                //get the release record for the version installed on the client
                Release client = vcReleasedPageStripper.GetReleaseByName(string.Format("Pulse {0}",
                                                                                       System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()));

                //if we weren't able to find the current version then return
                if (client == null)
                {
                    return;
                }

                //get the default release
                Release defaultRelease = vcReleasedPageStripper.GetDefaultRelease();

                //compare against the version installed on client (logic is up to you)
                if (defaultRelease.ReleaseDate > client.ReleaseDate)
                {
                    //Notify user of upgrade
                    if (NewVersionAvailable != null)
                    {
                        NewVersionAvailable(defaultRelease);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Logger.Write(string.Format("Error checking for new Pulse Versions: {0}", ex.ToString()), Log.LoggerLevels.Warnings);
            }
        }
コード例 #2
0
ファイル: PulseRunner.cs プロジェクト: patricker/Pulse
        public void CheckForNewVersion()
        {
            //NewVersionAvailable
            try
            {
                VersionChecker vcReleasedPageStripper = new VersionChecker("Pulse", new RssFeedReleases());

                //get the release record for the version installed on the client
                Release client = vcReleasedPageStripper.GetReleaseByName(string.Format("Pulse {0}",
                                        System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()));

                //if we weren't able to find the current version then return
                if (client == null) return;

                //get the default release
                Release defaultRelease = vcReleasedPageStripper.GetDefaultRelease();

                //compare against the version installed on client (logic is up to you)
                if (defaultRelease.ReleaseDate > client.ReleaseDate)
                {
                    //Notify user of upgrade
                    if (NewVersionAvailable != null)
                        NewVersionAvailable(defaultRelease);
                }
            }
            catch (Exception ex)
            {
                Log.Logger.Write(string.Format("Error checking for new Pulse Versions: {0}", ex.ToString()), Log.LoggerLevels.Warnings);
            }
        }