flush
[mcs.git] / tools / security / AssemblyInfo.cs
blobe64331739150d1264c6f7c478595273462630df3
1 //
2 // AssemblyInfo.cs: Assembly Informations
3 //
4 // Author:
5 // Sebastien Pouliot <sebastien@ximian.com>
6 //
7 // Copyright (C) 2004-2008 Novell Inc. (http://www.novell.com)
8 //
10 using System;
11 using System.Reflection;
12 using System.Runtime.CompilerServices;
13 using System.Text;
15 // AssemblyTitle - included in tool's source code
16 // AssemblyDescription - included in tool's source code
18 [assembly: AssemblyCompany("Motus Technologies, Novell")]
19 [assembly: AssemblyProduct("Mono Security Tools")]
20 [assembly: AssemblyCopyright("Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.")]
21 [assembly: AssemblyVersion (Consts.MonoVersion)]
23 //[assembly: AssemblyConfiguration("")]
24 //[assembly: AssemblyTrademark("")]
25 //[assembly: AssemblyCulture("")]
26 //[assembly: AssemblyDelaySign(true)]
27 //[assembly: AssemblyKeyFile("sectools.pub")]
28 //[assembly: AssemblyKeyName("")]
30 namespace Mono.Tools {
32 public class AssemblyInfo {
34 private string _name;
35 private string _title;
36 private string _copyright;
37 private string _description;
38 private string _version;
40 public AssemblyInfo ()
41 : this (Assembly.GetExecutingAssembly ())
45 public AssemblyInfo (Assembly a)
47 if (a == null)
48 throw new ArgumentNullException ("a");
50 AssemblyName an = a.GetName ();
51 _name = an.ToString ();
53 object [] att = a.GetCustomAttributes (typeof (AssemblyTitleAttribute), false);
54 _title = ((att.Length > 0) ? ((AssemblyTitleAttribute) att [0]).Title : String.Empty);
56 att = a.GetCustomAttributes (typeof (AssemblyCopyrightAttribute), false);
57 _copyright = ((att.Length > 0) ? ((AssemblyCopyrightAttribute) att [0]).Copyright : String.Empty);
59 att = a.GetCustomAttributes (typeof (AssemblyDescriptionAttribute), false);
60 _description = ((att.Length > 0) ? ((AssemblyDescriptionAttribute) att [0]).Description : String.Empty);
62 _version = an.Version.ToString ();
65 public string Copyright {
66 get { return _copyright; }
69 public string Description {
70 get { return _description; }
73 public string Name {
74 get { return _name; }
77 public string Title {
78 get { return _title; }
81 public string Version {
82 get { return _version; }
85 public override string ToString ()
87 StringBuilder sb = new StringBuilder ();
88 sb.AppendFormat ("{1} - version {2}{0}{3}{0}{4}{0}",
89 Environment.NewLine,
90 _title, _version,
91 _description,
92 _copyright);
93 return sb.ToString ();