diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-10-27 12:30:28 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-10-27 12:30:28 +0700 |
commit | c1e603f741728fd570e30c46eb20ef8dfb23238a (patch) | |
tree | 6c9e55973cd64b4f6ba5d12fcc2414aa41b14729 /crypto/src/AssemblyInfo.cs | |
parent | Exclude some tests for PORTABLE (diff) | |
download | BouncyCastle.NET-ed25519-c1e603f741728fd570e30c46eb20ef8dfb23238a.tar.xz |
Pull a few PORTABLE changes from BouncyCastle-PCL (with fixes)
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; + } + } +} |