![]() |
Sylloge
A C# helper library
|
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 namespace Sylloge 00018 { 00019 public static partial class App 00020 { 00025 public static class Info 00026 { 00030 public static string Company 00031 { 00032 get 00033 { 00034 00035 object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes( 00036 typeof(System.Reflection.AssemblyCompanyAttribute), false); 00037 if (attributes.Length == 0) { return string.Empty; } 00038 return ((System.Reflection.AssemblyCompanyAttribute)attributes[0]).Company; 00039 } 00040 } 00041 00045 public static string Copyright 00046 { 00047 get 00048 { 00049 object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes( 00050 typeof(System.Reflection.AssemblyCopyrightAttribute), false); 00051 if (attributes.Length == 0) { return string.Empty; } 00052 return ((System.Reflection.AssemblyCopyrightAttribute)attributes[0]).Copyright; 00053 } 00054 } 00055 00059 public static string Description 00060 { 00061 get 00062 { 00063 object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes( 00064 typeof(System.Reflection.AssemblyDescriptionAttribute), false); 00065 if (attributes.Length == 0) { return string.Empty; } 00066 return ((System.Reflection.AssemblyDescriptionAttribute)attributes[0]).Description; 00067 } 00068 } 00069 00073 public static System.Drawing.Image Logo 00074 { 00075 get 00076 { 00077 // TODO: Set any resources you may want here for a 'common' logo 00078 return null; 00079 } 00080 } 00081 00085 public static string Product 00086 { 00087 get 00088 { 00089 object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes( 00090 typeof(System.Reflection.AssemblyProductAttribute), false); 00091 if (attributes.Length == 0) { return string.Empty; } 00092 return ((System.Reflection.AssemblyProductAttribute)attributes[0]).Product; 00093 } 00094 } 00095 00099 public static string Title 00100 { 00101 get 00102 { 00103 object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes( 00104 typeof(System.Reflection.AssemblyTitleAttribute), false); 00105 if (attributes.Length > 0) { 00106 System.Reflection.AssemblyTitleAttribute titleAttribute = (System.Reflection.AssemblyTitleAttribute)attributes[0]; 00107 if (titleAttribute.Title != "") { return titleAttribute.Title; } 00108 } 00109 return System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().CodeBase); 00110 } 00111 } 00112 00116 public static string Version 00117 { 00118 get 00119 { 00120 //return Assembly.GetExecutingAssembly().GetName().Version.ToString(); 00121 int maj = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major; 00122 int min = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor; 00123 int minrev = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.MinorRevision; 00124 return string.Format("v{0}.{1}.{2}", maj, min, minrev); 00125 } 00126 } 00127 } 00128 } 00129 }