[msvc] Update csproj files
[mono.git] / mcs / tools / security / AssemblyInfo.cs
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 //
9
10 using System;
11 using System.Reflection;
12 using System.Runtime.CompilerServices;
13 using System.Text;
14
15 // AssemblyTitle - included in tool's source code
16 // AssemblyDescription - included in tool's source code
17
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)]
22
23 //[assembly: AssemblyConfiguration("")]
24 //[assembly: AssemblyTrademark("")]
25 //[assembly: AssemblyCulture("")]
26 //[assembly: AssemblyDelaySign(true)]
27 //[assembly: AssemblyKeyFile("sectools.pub")]
28 //[assembly: AssemblyKeyName("")]
29
30 namespace Mono.Tools {
31
32         public class AssemblyInfo {
33         
34                 private string _name;
35                 private string _title;
36                 private string _copyright;
37                 private string _description;
38                 private string _version;
39                 
40                 public AssemblyInfo ()
41                         : this (Assembly.GetExecutingAssembly ())
42                 {
43                 } 
44         
45                 public AssemblyInfo (Assembly a)
46                 {
47                         if (a == null)
48                                 throw new ArgumentNullException ("a");
49
50                         AssemblyName an = a.GetName ();
51                         _name = an.ToString ();
52
53                         object [] att = a.GetCustomAttributes (typeof (AssemblyTitleAttribute), false);
54                         _title = ((att.Length > 0) ? ((AssemblyTitleAttribute) att [0]).Title : String.Empty);
55
56                         att = a.GetCustomAttributes (typeof (AssemblyCopyrightAttribute), false);
57                         _copyright = ((att.Length > 0) ? ((AssemblyCopyrightAttribute) att [0]).Copyright : String.Empty);
58
59                         att = a.GetCustomAttributes (typeof (AssemblyDescriptionAttribute), false);
60                         _description = ((att.Length > 0) ? ((AssemblyDescriptionAttribute) att [0]).Description : String.Empty);
61                         
62                         _version = an.Version.ToString ();
63                 }
64         
65                 public string Copyright {
66                         get { return _copyright; }
67                 }
68
69                 public string Description {
70                         get { return _description; }
71                 }
72
73                 public string Name {
74                         get { return _name; }
75                 }
76
77                 public string Title {
78                         get { return _title; }
79                 }
80
81                 public string Version {
82                         get { return _version; }
83                 }
84                 
85                 public override string ToString ()
86                 {
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 ();
94                 }
95         }
96 }