[gacutil] Use IKVM.Reflection instead of System.Reflection (#3582)
[mono.git] / mcs / tools / security / AssemblyInfo.cs
index bac4b230683ec8d5d877c5fb5106ab1433dda54a..e64331739150d1264c6f7c478595273462630df3 100644 (file)
@@ -1,12 +1,25 @@
+//
+// AssemblyInfo.cs: Assembly Informations
+//
+// Author:
+//     Sebastien Pouliot  <sebastien@ximian.com>
+//
+// Copyright (C) 2004-2008 Novell Inc. (http://www.novell.com)
+//
+
+using System;
 using System.Reflection;
 using System.Runtime.CompilerServices;
+using System.Text;
 
 // AssemblyTitle - included in tool's source code
 // AssemblyDescription - included in tool's source code
+
 [assembly: AssemblyCompany("Motus Technologies, Novell")]
 [assembly: AssemblyProduct("Mono Security Tools")]
-[assembly: AssemblyCopyright("Copyright 2002, 2003 Motus Technologies. Copyright 2004 Novell. BSD licensed.")]
-[assembly: AssemblyVersion("0.91.99")]
+[assembly: AssemblyCopyright("Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.")]
+[assembly: AssemblyVersion (Consts.MonoVersion)]
+
 //[assembly: AssemblyConfiguration("")]
 //[assembly: AssemblyTrademark("")]
 //[assembly: AssemblyCulture("")]
@@ -14,3 +27,70 @@ using System.Runtime.CompilerServices;
 //[assembly: AssemblyKeyFile("sectools.pub")]
 //[assembly: AssemblyKeyName("")]
 
+namespace Mono.Tools {
+
+       public class AssemblyInfo {
+       
+               private string _name;
+               private string _title;
+               private string _copyright;
+               private string _description;
+               private string _version;
+               
+               public AssemblyInfo ()
+                       : this (Assembly.GetExecutingAssembly ())
+               {
+               } 
+       
+               public AssemblyInfo (Assembly a)
+               {
+                       if (a == null)
+                               throw new ArgumentNullException ("a");
+
+                       AssemblyName an = a.GetName ();
+                       _name = an.ToString ();
+
+                       object [] att = a.GetCustomAttributes (typeof (AssemblyTitleAttribute), false);
+                       _title = ((att.Length > 0) ? ((AssemblyTitleAttribute) att [0]).Title : String.Empty);
+
+                       att = a.GetCustomAttributes (typeof (AssemblyCopyrightAttribute), false);
+                       _copyright = ((att.Length > 0) ? ((AssemblyCopyrightAttribute) att [0]).Copyright : String.Empty);
+
+                       att = a.GetCustomAttributes (typeof (AssemblyDescriptionAttribute), false);
+                       _description = ((att.Length > 0) ? ((AssemblyDescriptionAttribute) att [0]).Description : String.Empty);
+                       
+                       _version = an.Version.ToString ();
+               }
+       
+               public string Copyright {
+                       get { return _copyright; }
+               }
+
+               public string Description {
+                       get { return _description; }
+               }
+
+               public string Name {
+                       get { return _name; }
+               }
+
+               public string Title {
+                       get { return _title; }
+               }
+
+               public string Version {
+                       get { return _version; }
+               }
+               
+               public override string ToString ()
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       sb.AppendFormat ("{1} - version {2}{0}{3}{0}{4}{0}",
+                               Environment.NewLine,
+                               _title, _version,
+                               _description,
+                               _copyright);
+                       return sb.ToString ();
+               }
+       }
+}