1
0
mirror of https://github.com/bitwarden/server synced 2025-12-14 23:33:41 +00:00

get rid of version weight

This commit is contained in:
Kyle Spearrin
2017-09-06 23:57:14 -04:00
parent acb6c59e5e
commit 24fe7a9f88
3 changed files with 4 additions and 23 deletions

View File

@@ -375,30 +375,16 @@ namespace Bit.Core.Utilities
return val.ToString();
}
public static (string version, int versionWeight) GetVersionInfo()
public static string GetVersion()
{
if(string.IsNullOrWhiteSpace(_version))
{
_version = Assembly.GetEntryAssembly()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
.InformationalVersion;
var dashIndex = _version.IndexOf('-');
var trimmedVersion = dashIndex > 0 ? _version.Substring(0, dashIndex) : _version;
var semVerParts = trimmedVersion.Split('.').Reverse().Select(p => Convert.ToInt32(p)).ToList();
if(semVerParts.Count < 4)
{
semVerParts.Insert(0, 0);
}
for(var i = 0; i < semVerParts.Count; i++)
{
_versionWeight += Convert.ToInt32(Math.Pow(100, (i + 1)) * semVerParts[i]);
}
}
return (_version, _versionWeight);
return _version;
}
}
}