Added some logic for the update checks:

* release only sees RC & unstable if "check for unstable" is set
* Release candidates only sees unstable if "check for unstable" is set
Meaning even if check for unstable is not set:
* unstable versions always find newer unstable versions
* RC's always find newer RC's
* Releases only find releases

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2151 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-10-17 15:40:55 +00:00
commit b4bc530ee6
3 changed files with 58 additions and 9 deletions

View file

@ -125,17 +125,34 @@ namespace Greenshot.Experimental {
SourceforgeFile rssFile = rssFiles[fileType][file];
if (fileType.StartsWith("Greenshot")) {
// check for exe
if (rssFile.File == null || !rssFile.File.EndsWith(".exe")) {
continue;
}
// Check if non stable
if (!conf.CheckUnstable && rssFile.File.ToLower().Contains("unstable")) {
if (!rssFile.isExe) {
continue;
}
// do we have a version?
if (rssFile.Version == null) {
LOG.DebugFormat("Skipping unversioned exe {0} with published at {1} : {2}", file, rssFile.Pubdate.ToLocalTime(), rssFile.Link);
LOG.DebugFormat("Skipping unversioned exe {0} which is published at {1} : {2}", file, rssFile.Pubdate.ToLocalTime(), rssFile.Link);
continue;
}
// if the file is unstable, we will skip it when:
// the current version is a release or release candidate AND check unstable is turned off.
if (rssFile.isUnstable) {
// Skip if we shouldn't check unstables
if ((conf.isRelease || conf.isReleaseCandidate) && !conf.CheckUnstable) {
continue;
}
}
// if the file is a release candidate, we will skip it when:
// the current version is a release AND check unstable is turned off.
if (rssFile.isReleaseCandidate) {
if (conf.isRelease && !conf.CheckUnstable) {
continue;
}
}
// Compare versions
int versionCompare = rssFile.Version.CompareTo(currentVersion);
if (versionCompare > 0) {
LOG.DebugFormat("Found newer version as exe {0} with version {1} published at {2} : {3}", file, rssFile.Version, rssFile.Pubdate.ToLocalTime(), rssFile.Link);

View file

@ -190,7 +190,12 @@ namespace GreenshotPlugin.Core {
[IniProperty("ExperimentalFeatures", Description="A list of experimental features, this allows us to test certain features before releasing them.", ExcludeIfNull=true)]
public List<string> ExperimentalFeatures;
// Specify what THIS build is
public bool isRelease = false;
public bool isReleaseCandidate = true;
public bool isUnstable = false;
/// <summary>
/// A helper method which returns true if the supplied experimental feature is enabled
/// </summary>

View file

@ -55,7 +55,34 @@ namespace GreenshotPlugin.Core {
get {return language;}
set {language = value;}
}
public bool isExe {
get {
if (file != null) {
return file.ToLower().EndsWith(".exe");
}
return false;
}
}
public bool isUnstable {
get {
if (file != null) {
return file.ToLower().Contains("unstable");
}
return false;
}
}
public bool isReleaseCandidate {
get {
if (file != null) {
return file.ToLower().Contains("RC");
}
return false;
}
}
public SourceforgeFile(string file, string pubdate, string link, string directLink) {
this.file = file;
this.pubdate = DateTime.Parse(pubdate);
@ -78,7 +105,7 @@ namespace GreenshotPlugin.Core {
HttpWebRequest webRequest;
XmlDocument rssDoc = new XmlDocument();
try {
webRequest = (HttpWebRequest)GreenshotPlugin.Core.NetworkHelper.CreateWebRequest(RSSFEED);
webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(RSSFEED);
XmlTextReader rssReader = new XmlTextReader(webRequest.GetResponse().GetResponseStream());
// Load the XML content into a XmlDocument