diff options
Diffstat (limited to 'crypto/src/AssemblyInfo.cs')
-rw-r--r-- | crypto/src/AssemblyInfo.cs | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/crypto/src/AssemblyInfo.cs b/crypto/src/AssemblyInfo.cs index 36beb99c4..cfddb17b9 100644 --- a/crypto/src/AssemblyInfo.cs +++ b/crypto/src/AssemblyInfo.cs @@ -1,9 +1,13 @@ using System; using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; //using System.Security.Permissions; +#if PORTABLE +using System.Linq; +#else +using System.Runtime.InteropServices; +#endif + // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -76,3 +80,35 @@ using System.Runtime.InteropServices; // see Org.BouncyCastle.Crypto.Encodings.Pkcs1Encoding.StrictLengthEnabledProperty //[assembly: EnvironmentPermission(SecurityAction.RequestOptional, Read="Org.BouncyCastle.Pkcs1.Strict")] +internal class AssemblyInfo +{ + private static string version; + public static string Version + { + get + { + if (version == null) + { +#if PORTABLE +#if NEW_REFLECTION + var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).GetTypeInfo().Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute)).FirstOrDefault(); +#else + var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute), false).FirstOrDefault(); +#endif + if (ver != null) + { + version = ver.Version; + } +#else + version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); +#endif + + // if we're still here, then don't try again + if (version == null) + version = string.Empty; + } + + return version; + } + } +} |