diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-21 19:51:39 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-21 19:51:39 +0700 |
commit | db1a5bc1bf9d9e9aa5648292c52bbb09eb9ff988 (patch) | |
tree | 7c7a17f50ccb99eb8755ea909d4e0eaf586eaf41 | |
parent | Add build-related files from BouncyCastle-PCL (diff) | |
download | BouncyCastle.NET-ed25519-db1a5bc1bf9d9e9aa5648292c52bbb09eb9ff988.tar.xz |
Refactoring
-rw-r--r-- | crypto/src/AssemblyInfo.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/crypto/src/AssemblyInfo.cs b/crypto/src/AssemblyInfo.cs index cfddb17b9..ddf04aa4e 100644 --- a/crypto/src/AssemblyInfo.cs +++ b/crypto/src/AssemblyInfo.cs @@ -82,7 +82,8 @@ using System.Runtime.InteropServices; internal class AssemblyInfo { - private static string version; + private static string version = null; + public static string Version { get @@ -91,13 +92,16 @@ internal class AssemblyInfo { #if PORTABLE #if NEW_REFLECTION - var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).GetTypeInfo().Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute)).FirstOrDefault(); + var a = typeof(AssemblyInfo).GetTypeInfo().Assembly; + var c = a.GetCustomAttributes(typeof(AssemblyVersionAttribute)); #else - var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute), false).FirstOrDefault(); + var a = typeof(AssemblyInfo).Assembly; + var c = a.GetCustomAttributes(typeof(AssemblyVersionAttribute), false); #endif - if (ver != null) + var v = (AssemblyVersionAttribute)c.FirstOrDefault(); + if (v != null) { - version = ver.Version; + version = v.Version; } #else version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); @@ -105,7 +109,9 @@ internal class AssemblyInfo // if we're still here, then don't try again if (version == null) + { version = string.Empty; + } } return version; |