Пример #1
0
        static App()
        {
            Assembly asm = Assembly.GetCallingAssembly();

            Name    = asm.GetName().Name;
            Version = asm.GetName().Version.ToString(3);
            Banner  = $"{Name} v{Version}";

            Type type = typeof(AssemblyDescriptionAttribute);

            if (AssemblyDescriptionAttribute.IsDefined(asm, type))
            {
                AssemblyDescriptionAttribute a =
                    (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(asm, type);
                Banner += " - " + a.Description;
            }

            type = typeof(AssemblyCopyrightAttribute);
            if (AssemblyCopyrightAttribute.IsDefined(asm, type))
            {
                AssemblyCopyrightAttribute a =
                    (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(asm, type);
                Banner += Environment.NewLine + a.Copyright.Replace("©", "(c)");
            }
        }
Пример #2
0
        public static string GetCopyright()
        {
            //Type of attribute that is desired
            Type type = typeof(AssemblyCopyrightAttribute);

            //Is there an attribute of this type already defined?
            if (AssemblyCopyrightAttribute.IsDefined(Assembly.GetExecutingAssembly(), type))
            {
                //if there is, get attribute of desired type
                AssemblyCopyrightAttribute assemblyCopyrightAttribute = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), type);

                return(assemblyCopyrightAttribute.Copyright);
            }

            return(null);
        }