summary refs log tree commit diff
diff options
context:
space:
mode:
authorOren Novotny <oren@novotny.org>2014-08-27 09:56:59 -0400
committerOren Novotny <oren@novotny.org>2014-08-27 09:56:59 -0400
commit9c6d9157b606f7aba8605c4ac34d49c557487e98 (patch)
tree5dcd5e4dc57df14fc49b9d5c43f0507aa8298e17
parentInitial re-migration from original code (diff)
downloadBouncyCastle.NET-ed25519-9c6d9157b606f7aba8605c4ac34d49c557487e98.tar.xz
Add assm ver
-rw-r--r--crypto/src/AssemblyInfo.cs26
-rw-r--r--crypto/src/bcpg/ArmoredOutputStream.cs4
2 files changed, 27 insertions, 3 deletions
diff --git a/crypto/src/AssemblyInfo.cs b/crypto/src/AssemblyInfo.cs
index 374e590cc..7a0f3c0fc 100644
--- a/crypto/src/AssemblyInfo.cs
+++ b/crypto/src/AssemblyInfo.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Linq;
 using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
@@ -75,3 +76,28 @@ 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)
+            {
+                var ver = (AssemblyVersionAttribute)typeof(AssemblyInfo).Assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute), false).FirstOrDefault();
+                if (ver != null)
+                {
+                    version = ver.Version;
+                }
+
+                // if we're still here, then don't try again
+                if (version == null)
+                    version = string.Empty;
+            }
+
+            return version;
+        }
+        
+    }
+}
diff --git a/crypto/src/bcpg/ArmoredOutputStream.cs b/crypto/src/bcpg/ArmoredOutputStream.cs
index 801e06205..458e74a97 100644
--- a/crypto/src/bcpg/ArmoredOutputStream.cs
+++ b/crypto/src/bcpg/ArmoredOutputStream.cs
@@ -97,9 +97,7 @@ namespace Org.BouncyCastle.Bcpg
         private static readonly string	footerStart = "-----END PGP ";
         private static readonly string	footerTail = "-----";
 
-        private static readonly string version = "BCPG C# v"
-                                                 + Assembly.GetExecutingAssembly()
-                                                           .FullName;//.GetName().Version;
+        private static readonly string version = "BCPG C# v" + AssemblyInfo.Version;
 
 		private readonly IDictionary headers;