Tested and fixed update check

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2154 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-10-18 08:51:09 +00:00
parent bf392fb81a
commit 552a4c8f94
3 changed files with 15 additions and 11 deletions

View file

@ -77,7 +77,7 @@ namespace GreenshotPlugin.Core {
public bool isReleaseCandidate {
get {
if (file != null) {
return file.ToLower().Contains("RC");
return Regex.IsMatch(file.ToLower(), "rc[0-9]+");
}
return false;
}
@ -175,21 +175,24 @@ namespace GreenshotPlugin.Core {
}
SourceforgeFile rssFile = new SourceforgeFile(file, pubdate, sfLink, directLink);
if (file.EndsWith(".exe") ||file.EndsWith(".zip")) {
string version = Regex.Replace(file, ".*[a-zA-Z]-", "");
version = version.Replace("-[a-zA-Z]+.*","");
version = Regex.Replace(version, ".exe$", "");
version = Regex.Replace(version, ".zip$", "");
string version = Regex.Replace(file, @".*[a-zA-Z_]\-", "");
version = version.Replace(@"\-[a-zA-Z]+.*","");
version = Regex.Replace(version, @"\.exe$", "");
version = Regex.Replace(version, @"\.zip$", "");
version = Regex.Replace(version, @"RC[0-9]+", "");
if (version.Trim().Length > 0) {
version = version.Replace('-','.');
version = version.Replace(',','.');
version = Regex.Replace(version, @"^[a-zA-Z_]*\.", "");
version = Regex.Replace(version, @"\.[a-zA-Z_]*$", "");
try {
rssFile.Version = new Version(version);
} catch (Exception) {
LOG.DebugFormat("Found invalid version {0} in file {1}", version, file);
}
}
}
if (type.Equals("Translations")) {
} else if (type.Equals("Translations")) {
string culture = Regex.Replace(file, @"[a-zA-Z]+-(..-..)\.(xml|html)", "$1");
try {
CultureInfo cultureInfo = new CultureInfo(culture);