Exemple #1
0
        private string GetDescription()
        {
            AssemblyDescriptionAttribute descriptionAttribute = Assembly.GetEntryAssembly()
                                                                .GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)
                                                                .OfType <AssemblyDescriptionAttribute>()
                                                                .FirstOrDefault();

            return(descriptionAttribute?.Description ?? string.Empty);
        }
Exemple #2
0
 private void GetServerVersion()
 {
     object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
     if (attributes.Length > 0)
     {
         AssemblyDescriptionAttribute description = attributes[0] as AssemblyDescriptionAttribute;
         this.serverVersion = description.Description;
     }
 }
        /// <summary>
        /// Create a new instance of an assembly version object from an existing assembly.
        /// </summary>
        /// <param name="assembly">An assembly to create a assembly version instance for.</param>
        public AssemblyInformation(System.Reflection.Assembly assembly) : base(assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            _name = assembly.GetName().Name;

            _path = assembly.Location.Substring(0, assembly.Location.LastIndexOf(@"\"));

            // declare variable for attribute querying
            object[] attrs = null;

            // get the title information
            attrs = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            if (attrs.Length > 0)
            {
                AssemblyTitleAttribute ata = attrs[0] as AssemblyTitleAttribute;
                _title = ata.Title;
            }
            // get the description information
            attrs = assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
            if (attrs.Length > 0)
            {
                AssemblyDescriptionAttribute ada = attrs[0] as AssemblyDescriptionAttribute;
                _description = ada.Description;
            }
            // get the company information
            attrs = assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
            if (attrs.Length > 0)
            {
                AssemblyCompanyAttribute aca = attrs[0] as AssemblyCompanyAttribute;
                _company = aca.Company;
            }
            // get the product information
            attrs = assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
            if (attrs.Length > 0)
            {
                AssemblyProductAttribute apa = attrs[0] as AssemblyProductAttribute;
                _product = apa.Product;
            }
            // get the copyright information
            attrs = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            if (attrs.Length > 0)
            {
                AssemblyCopyrightAttribute acpa = attrs[0] as AssemblyCopyrightAttribute;
                _copyright = acpa.Copyright;
            }
            // get the trademark information
            attrs = assembly.GetCustomAttributes(typeof(AssemblyTrademarkAttribute), false);
            if (attrs.Length > 0)
            {
                AssemblyTrademarkAttribute atma = attrs[0] as AssemblyTrademarkAttribute;
                _trademark = atma.Trademark;
            }
        }
        private string LoadAssemblyDescription(string assemblyFilePath)
        {
            Assembly quickAsshehe             = Assembly.LoadFile(assemblyFilePath);
            AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)
                                                AssemblyDescriptionAttribute.GetCustomAttribute(
                quickAsshehe, typeof(AssemblyDescriptionAttribute));

            return(desc.Description);
        }
Exemple #5
0
        private void SetupControl()
        {
            Assembly asm      = _CallingAssembly;
            string   AppTitle = ((AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(asm, typeof(AssemblyProductAttribute))).Product;

            AppTitle += " v" + asm.GetName().Version.ToString(2);

            lblAppName.Text = AppTitle;

            lblAppTitle.Text = ((AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute))).Description;

            lblCopyright.Text = ((AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute))).Copyright;

            StringBuilder AuthorBuilder = new StringBuilder();

            if (_Authors == null)
            {
                AuthorBuilder.Append("Authors: Anonymous");
            }
            else
            {
                if (_Authors.Length == 1)
                {
                    AuthorBuilder.Append("Author: ");
                }
                else
                {
                    AuthorBuilder.Append("Authors: ");
                }

                bool First = true;
                foreach (string Auth in _Authors)
                {
                    if (!First)
                    {
                        AuthorBuilder.Append(", ");
                    }
                    AuthorBuilder.Append(Auth);
                    First = false;
                }
            }

            lblAuthors.Text = AuthorBuilder.ToString();

            //Visual Studio requires the namespace to be applied to the resource name, otherwise it can't find it.
            Stream LicenseStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LICENSE");

            if (LicenseStream == null)
            {
                LicenseStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Absinthe.Gui.LICENSE");
            }
            StreamReader str = new StreamReader(LicenseStream);

            txtLicense.Text = str.ReadToEnd();
            txtLicense.Select(0, 0);
        }
Exemple #6
0
        public static string VersionInfo()
        {
            object[] attribute = typeof(frmMain).Assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
            AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)(attribute[0]);

            attribute = typeof(frmMain).Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            AssemblyTitleAttribute title = (AssemblyTitleAttribute)(attribute[0]);

            return($"[{title.Title} - {Process.GetCurrentProcess().Id}]  {desc.Description}  V{Application.ProductVersion}");
        }
Exemple #7
0
 /// <summary>
 /// Static constructor for the not supported exception
 /// </summary>
 static NotSupportedMessageReceiver()
 {
     try
     {
         SoftwareName        = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0] as AssemblyProductAttribute;
         SoftwareDescription = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0] as AssemblyDescriptionAttribute;
         SoftwareVersion     = Assembly.GetEntryAssembly().GetName().Version;
     }
     catch { }
 }
        public static void AssemblyDescriptionAttributeTests()
        {
            var attr1 = new AssemblyDescriptionAttribute(null);

            Assert.Null(attr1.Description);

            var attr2 = new AssemblyDescriptionAttribute("My Description");

            Assert.Equal("My Description", attr2.Description);
        }
        internal static string GetDescription(Assembly assembly)
        {
            AssemblyDescriptionAttribute attribute = null;

            attribute = Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute), true) as AssemblyDescriptionAttribute;
            if (attribute == null)
            {
                return(string.Empty);
            }
            return(attribute.Description);
        }
        /*
         * companyname:
         *      Describes the name of the company. If no companyname is supplied Application.CompanyName will be used.
         *
         * productname:
         *      Describes the name of the product. If no productname is supplied Application.ProductName will be used.
         *
         * applicationdescription:
         *
         * executable:
         *
         */
        public FileAssociationManager(string companyname, string productname, string applicationdescription, string executable)
        {
            if (string.IsNullOrEmpty(companyname))
            {
                companyname = Application.CompanyName;
            }

            if (string.IsNullOrEmpty(productname))
            {
                productname = Application.ProductName;
            }

            if (string.IsNullOrEmpty(applicationdescription))
            {
                Assembly exeasm = Assembly.GetExecutingAssembly();
                AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(exeasm, typeof(AssemblyDescriptionAttribute));

                applicationdescription = desc.Description;

                if (string.IsNullOrEmpty(applicationdescription))
                {
                    applicationdescription = Application.ProductName;
                }
            }

            if (string.IsNullOrEmpty(executable))
            {
                executable = Application.ExecutablePath;
            }

            // ***

            if (string.IsNullOrEmpty(companyname))
            {
                throw new Exception("Company name cannot be null or empty!");
            }

            if (string.IsNullOrEmpty(productname))
            {
                throw new Exception("Product name cannot be null or empty!");
            }

            // ***

            _companyName            = companyname;
            _productName            = productname;
            _applicationDescription = applicationdescription;
            _executablePath         = executable;

            if (IsDefaultProgramsAvailable())
            {
                _applicationRegistration = (IApplicationAssociationRegistration) new ApplicationAssociationRegistration();
            }
        }
Exemple #11
0
        public void GetCopyRightInfo(string fileName)
        {
            Assembly asm = Assembly.GetExecutingAssembly();//如果是当前程序集
            //如果是其他文件
            //Assembly asm = Assembly.LoadFile(fileName);
            AssemblyDescriptionAttribute asmdis = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));
            AssemblyCopyrightAttribute   asmcpr = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
            AssemblyCompanyAttribute     asmcpn = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute));

            richTextBox1.AppendText(string.Format("Description:{0}\nCopyright:{1}Company:{2}\n", asmdis.Description, asmcpr.Copyright, asmcpn.Company));
        }
Exemple #12
0
        private string VersionInfo(Form form)
        {
            #region Version Info
            object[] attribute = form.GetType().Assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
            AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)(attribute[0]);
            attribute = form.GetType().Assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            AssemblyTitleAttribute title = (AssemblyTitleAttribute)(attribute[0]);
            return(string.Format("[{0} - {3}]  {1}  V{2}", title.Title, desc.Description, Application.ProductVersion, Process.GetCurrentProcess().Id));

            #endregion
        }
Exemple #13
0
        internal static void GetDetailText(Assembly assy)
        {
            DetailPanel.AddLink("Assembly Full Name",
                                !ObjectBrowser.INTERNAL,
                                100,
                                TypeLinkHelper.TLHelper,
                                assy);
            try {
                DetailPanel.Add("Assembly Location",
                                !ObjectBrowser.INTERNAL,
                                110,
                                assy.Location);
            } catch {
                // This is not supported for dynamic assemblies
                // and it throws (sadly)
            }
            if (assy.EntryPoint != null)
            {
                String entryStr = "";
                if (assy.EntryPoint.DeclaringType != null)
                {
                    entryStr += "Class: "
                                + assy.EntryPoint.DeclaringType.ToString() + "  ";
                }
                entryStr += "Method: " + assy.EntryPoint.ToString();
                DetailPanel.Add("Assembly Entry Point",
                                !ObjectBrowser.INTERNAL,
                                120,
                                entryStr);
            }
            DetailPanel.Add("Assembly Version",
                            ObjectBrowser.INTERNAL,
                            130,
                            assy.GetName()
                            .Version.ToString());
            try {
                DetailPanel.Add("Assembly Code Base",
                                !ObjectBrowser.INTERNAL,
                                115,
                                assy.GetName().CodeBase);
            } catch {
                // This is not supported for dynamic assemblies
                // and it throws (sadly)
            }
            AssemblyDescriptionAttribute doc = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assy, typeof(AssemblyDescriptionAttribute));

            if (doc != null)
            {
                DetailPanel.Add("Assembly Description",
                                !ObjectBrowser.INTERNAL,
                                105,
                                doc.Description);
            }
        }
Exemple #14
0
        private void func()
        {
            Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            AssemblyDescriptionAttribute asmdis = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));
            AssemblyCopyrightAttribute   asmcpr = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
            AssemblyCompanyAttribute     asmcpn = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute));

            this.Text += " V" + asmdis.Description + (IsAdministrator() ? "(管理员)" : "");
            button2_Click(null, null);
            new testlib.Class1();
        }
Exemple #15
0
        public static string GetDescription(Assembly assembly)
        {
            AssemblyDescriptionAttribute asmdis = (AssemblyDescriptionAttribute)assembly.GetCustomAttribute(typeof(AssemblyDescriptionAttribute));

            if (asmdis == null)
            {
                return("");
            }

            return(asmdis.Description ?? "");
        }
        private void FormSearch_Load(object sender, EventArgs e)
        {
            Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            AssemblyDescriptionAttribute asmdis = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));
            AssemblyCopyrightAttribute   asmcpr = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
            AssemblyCompanyAttribute     asmcpn = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(asm, typeof(AssemblyCompanyAttribute));

            this.Text += " V" + asmdis.Description + (IsAdministrator() ? "(管理员)" : "");

            button2_Click(sender, e);
        }
 public PluginAssembly(string path)
 {
     this.Path  = path;
     this.Title = this.Author = this.Description = this.Version = this.Name = string.Empty;
     if (File.Exists(path))
     {
         try {
             this.assembly = Assembly.Load(File.ReadAllBytes(path));
             AssemblyName                 name            = this.assembly.GetName();
             AssemblyTitleAttribute       customAttribute = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyTitleAttribute));
             AssemblyCompanyAttribute     attribute2      = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyCompanyAttribute));
             AssemblyDescriptionAttribute attribute3      = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyDescriptionAttribute));
             this.Version = name.Version.ToString();
             if (customAttribute != null)
             {
                 this.Title = customAttribute.Title;
             }
             if (attribute2 != null)
             {
                 this.Author = attribute2.Company;
             }
             if (attribute3 != null)
             {
                 this.Description = attribute3.Description;
             }
             this.Name = this.Title + this.Version + "(" + path.GetHashCode().ToString("X") + ")";
             foreach (Type type in this.assembly.GetTypes())
             {
                 try {
                     if (ValidateType(type))
                     {
                         PluginAttribute pluginAtt = Attribute.GetCustomAttribute(type, T_PLUGINATTRIBUTE) as PluginAttribute;
                         if (pluginAtt != null)
                         {
                             string            pluginID = this.Name + "+" + type.FullName;
                             PluginInformation info     = new PluginInformation(pluginAtt, path, pluginID, type.FullName);
                             GetImageFromAssembly(this.assembly, type, info);
                             this.dicPluginInformations[pluginID] = info;
                         }
                         else
                         {
                             QTUtility2.MakeErrorLog(null, "failed attribute");
                         }
                     }
                 }
                 catch {
                 }
             }
         }
         catch (Exception exception) {
             QTUtility2.MakeErrorLog(exception, "failed get asm\r\n" + path);
         }
     }
 }
Exemple #18
0
 private void PopulateAlgorithmChooseControl(List <IFrequentPatternMining> _miningAlgorithms)
 {
     foreach (IFrequentPatternMining detector in _miningAlgorithms)
     {
         AssemblyDescriptionAttribute desc;
         AssemblyTitleAttribute       title;
         desc  = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(detector.GetType().Assembly, typeof(AssemblyDescriptionAttribute));
         title = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(detector.GetType().Assembly, typeof(AssemblyTitleAttribute));
         string str = string.Format("{0}, {1}, {2}", detector.GetType().FullName, title, desc);
         combo_algoritmo.Items.Add(str);
     }
 }
Exemple #19
0
        public static string GetAssemblyDescription(Assembly assembly)
        {
            Guard.ArgumentNotNull(assembly, nameof(assembly));
            var attributes = assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute));
            AssemblyDescriptionAttribute attr = attributes.SingleOrDefault() as AssemblyDescriptionAttribute;

            if (attr == null)
            {
                return(string.Empty);
            }
            return(attr.Description);
        }
Exemple #20
0
        public static string VersionInfo()
        {
            Assembly assembly = typeof(frmMain).Assembly;

            object[] attribute = assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
            AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)(attribute[0]);

            attribute = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            AssemblyTitleAttribute title = (AssemblyTitleAttribute)(attribute[0]);

            return(string.Format("[{0} - {3}]  {1}  V{2}", title.Title, desc.Description, Application.ProductVersion, Process.GetCurrentProcess().Id));
        }
        public AboutControlViewModel()
        {
            Window = new Window();
            Window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            Window.SizeToContent         = SizeToContent.WidthAndHeight;
            Window.ResizeMode            = ResizeMode.NoResize;
            Window.WindowStyle           = WindowStyle.None;

            Window.ShowInTaskbar = false;
            Window.Title         = "About";
            Window.Deactivated  += this.Window_Deactivated;

            Assembly assembly = Assembly.GetEntryAssembly();

            this.Version = assembly.GetName().Version.ToString();
            this.Title   = assembly.GetName().Name;

#if NET35 || NET40
            AssemblyCopyrightAttribute   copyright   = Attribute.GetCustomAttribute(assembly, typeof(AssemblyCopyrightAttribute)) as AssemblyCopyrightAttribute;
            AssemblyDescriptionAttribute description = Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute)) as AssemblyDescriptionAttribute;
            AssemblyCompanyAttribute     company     = Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute)) as AssemblyCompanyAttribute;
#else
            AssemblyCopyrightAttribute   copyright   = assembly.GetCustomAttribute <AssemblyCopyrightAttribute>();
            AssemblyDescriptionAttribute description = assembly.GetCustomAttribute <AssemblyDescriptionAttribute>();
            AssemblyCompanyAttribute     company     = assembly.GetCustomAttribute <AssemblyCompanyAttribute>();
#endif
            this.Copyright   = copyright.Copyright;
            this.Description = description.Description;
            this.Publisher   = company.Company;
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Further information about BlueDot... Every 2 seconds BlueDot will send a key press to F15, this is a key most computers do not have.");
            sb.AppendLine("Also BlueDot will keep it's icon visible in the system tray, And it will flash every two seconds to remind you your screen lock is disable.");
            sb.AppendLine("You will need to click on \"System Tray Customize...\" find BlueDot and change icon setting to \"Show Icon and notifications\".");
            sb.AppendLine(string.Empty);
            sb.AppendLine("BlueDot is free and open source.");
            sb.AppendLine(string.Empty);
            sb.AppendLine("FAQ");
            sb.AppendLine("Why id BlueDot an WPF application?");
            sb.AppendLine("No reason I just wanted to create an WPF application.");
            sb.AppendLine(string.Empty);
            sb.AppendLine("Can I increase or decrease the time interval?");
            sb.AppendLine("No I hard coded it, maybe later if people ask for it.");
            sb.AppendLine(string.Empty);
            sb.AppendLine("What does the stop button do?");
            sb.AppendLine("Stops the icon from blinking and BlueDot will not send a key press.");
            sb.AppendLine("");
            sb.AppendLine("Do I need to press stop before exiting the program?");
            sb.AppendLine("No I just thought it might be nice if you are going from meeting to meeting you don't have to restart the program.");
            sb.AppendLine(string.Empty);
            sb.AppendLine("Does BlueDot take up a lot of cpu resources?");
            sb.AppendLine("No, it should have mininal impact on your machine.");
            this.AdditionalNotes = sb.ToString();
        }
Exemple #22
0
        private void Get_AllVariables(Assembly a)
        {
            AssemblyTitleAttribute       titleAttr   = null;
            AssemblyDescriptionAttribute descAttr    = null;
            AssemblyCopyrightAttribute   copyAttr    = null;
            AssemblyProductAttribute     prodAttr    = null;
            AssemblyTrademarkAttribute   tradeAttr   = null;
            AssemblyCultureAttribute     cultureAttr = null;
            AssemblyVersionAttribute     versionAttr = null;
            AssemblyCompanyAttribute     companyAttr = null;

            try
            {
                titleAttr   = a.GetCustomAttribute <AssemblyTitleAttribute>() ?? new AssemblyTitleAttribute("No assembly title");
                descAttr    = a.GetCustomAttribute <AssemblyDescriptionAttribute>() ?? new AssemblyDescriptionAttribute("No description");
                copyAttr    = a.GetCustomAttribute <AssemblyCopyrightAttribute>() ?? new AssemblyCopyrightAttribute("No copyright");
                prodAttr    = a.GetCustomAttribute <AssemblyProductAttribute>() ?? new AssemblyProductAttribute("No product information");
                tradeAttr   = a.GetCustomAttribute <AssemblyTrademarkAttribute>() ?? new AssemblyTrademarkAttribute(string.Empty); // Trademark was in older .Net 3.5 apps but has not made its way into .Net Core
                cultureAttr = a.GetCustomAttribute <AssemblyCultureAttribute>() ?? new AssemblyCultureAttribute("en-US");
                versionAttr = a.GetCustomAttribute <AssemblyVersionAttribute>() ?? new AssemblyVersionAttribute("0.0.0.0");
                companyAttr = a.GetCustomAttribute <AssemblyCompanyAttribute>() ?? new AssemblyCompanyAttribute("No company specified");

                this._title          = titleAttr.Title;
                this._description    = descAttr.Description;
                this._copywrite      = copyAttr.Copyright;
                this._product        = prodAttr.Product;
                this._trademark      = tradeAttr.Trademark;
                this._culture        = cultureAttr.Culture;
                this._appCultureInfo = new CultureInfo(this._culture);
                this._version        = versionAttr.Version;
                this._AppVersion     = new Version(this._version);
                this._company        = companyAttr.Company;
            }
            catch (Exception ex)
            {
                // Oh dear ...
                this._title       = "An error happened trying to get the application information.";
                this._description = string.Format("{0}. {1}", ex.GetType().ToString(), ex.Message);
            }
            finally
            {
                a           = null;
                descAttr    = null;
                copyAttr    = null;
                prodAttr    = null;
                tradeAttr   = null;
                cultureAttr = null;
                versionAttr = null;
                companyAttr = null;
                descAttr    = null;
                titleAttr   = null;
            }
        }
Exemple #23
0
        public AboutControl(Assembly[] assems)
        {
            InitializeComponent();

            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            DateTime fileCreationDateTime       = System.IO.File.GetLastWriteTimeUtc(assembly.Location);

            //label5.Text = assembly.GetName().Version.ToString() + " @ " + fileCreationDateTime.ToShortDateString();

            AssemblyCopyrightAttribute   copyright   = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0] as AssemblyCopyrightAttribute;
            AssemblyCompanyAttribute     company     = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0] as AssemblyCompanyAttribute;
            AssemblyDescriptionAttribute description = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0] as AssemblyDescriptionAttribute;

            this.Text = "About " + description.Description;

            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox1.Image    = CodeBeautifierBase.Resources.avatar1;

            var link = "http://www.manobit.com/code-beautifier-for-visual-studio/";

            this.linkLabelCopyright.Links.Add(0, link.Length, link);

            var email = "*****@*****.**";

            this.linkLabelMail.Links.Add(0, email.Length, email);

            foreach (var assemblyObj in assems)
            {
                try
                {
                    var customAttrs = assemblyObj.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
                    if (customAttrs.Length == 0)
                    {
                        continue;
                    }
                    AssemblyCompanyAttribute assemblyCompany = customAttrs[0] as AssemblyCompanyAttribute;
                    if (assemblyCompany.Company == null)
                    {
                        continue;
                    }
                    if (assemblyCompany.Company.CompareTo("Manobit") == 0)
                    {
                        ListViewItem lwi = new ListViewItem(assemblyObj.GetName().Name);
                        lwi.SubItems.Add(assemblyObj.GetName().Version.ToString());
                        this.lvModules.Items.Add(lwi);
                    }
                }
                catch (Exception)
                { }
            }
            //this.lvModules.AutoResizeColumns( ColumnHeaderAutoResizeStyle.ColumnContent );
            this.lvModules.Enabled = false;
        }
Exemple #24
0
        private static string dtSeparator = "[:.;,/*-]"; // »+« muss am Anfang stehen, »-« am Ende! backslash is NOT a metacharacter in a POSIX bracket expression

        public static string GetDescription()
        {
            Type     clsType = typeof(FrmTimeCalc);
            Assembly assy    = clsType.Assembly;
            AssemblyDescriptionAttribute adAttr = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assy, typeof(AssemblyDescriptionAttribute));

            if (adAttr == null)
            {
                return(String.Empty);
            }
            return(adAttr.Description);
        }
Exemple #25
0
        public AboutWindow()
        {
            InitializeComponent();

            Assembly app = Assembly.GetExecutingAssembly();
            AssemblyTitleAttribute       title = (AssemblyTitleAttribute)app.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0];
            AssemblyDescriptionAttribute desc  = (AssemblyDescriptionAttribute)app.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0];

            Version ver = app.GetName().Version;

            txtDesc.Text = title.Title + "\nVersion " + ver.ToString() + "\n\n" + desc.Description;
        }
Exemple #26
0
        public static void ClassInformation()
        {
            Assembly     assem     = typeof(Matrix).Assembly;
            AssemblyName assemName = assem.GetName();

            Console.WriteLine("\nName: {0}", assemName.Name);
            Console.WriteLine("Version: {0}.{1}",
                              assemName.Version.Major, assemName.Version.Minor);
            Console.WriteLine(assem.EntryPoint);

            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyDescriptionAttribute description = assembly
                                                       .GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)
                                                       .OfType <AssemblyDescriptionAttribute>()
                                                       .FirstOrDefault();

            AssemblyCompanyAttribute author = assembly
                                              .GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)
                                              .OfType <AssemblyCompanyAttribute>()
                                              .FirstOrDefault();

            Console.WriteLine(description.Description + "\n");
            Console.WriteLine("Author: " + author.Company + "\n");

            BindingFlags bindingFlags = BindingFlags.Public |
                                        BindingFlags.NonPublic |
                                        BindingFlags.Instance |
                                        BindingFlags.Static;

            Console.WriteLine("Atributes:");
            Console.WriteLine("----------");
            foreach (FieldInfo field in typeof(Matrix).GetFields(bindingFlags))
            {
                Console.WriteLine(field.Attributes + " " + field.FieldType + " " + field.Name);
            }

            Console.WriteLine("\nMethods:");
            Console.WriteLine("----------");
            MethodInfo[] methodInfos = typeof(Matrix)
                                       .GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

            foreach (MethodInfo methodInfo in methodInfos)
            {
                string type   = methodInfo.IsPublic ? "Public" : "Private";
                string method = type + " " + methodInfo.ReturnParameter + methodInfo.Name + "(" + GetParamInfo(methodInfo) + ")";
                if (method.Contains(','))
                {
                    method = method.Substring(0, method.Length - 3) + ")";
                }
                Console.WriteLine(method);
            }
        }
        public ClassDefinition(Type type, CmdLineConfig config)
        {
            Config    = config;
            Type      = type;
            Attribute = Type.GetCustomAttributes(typeof(CmdLineClassAttribute), false)
                        .FirstOrDefault() as CmdLineClassAttribute;
            InclusionBehavior = Attribute != null
                ? Attribute.InclusionBehavior
                : InclusionBehavior.Default;

            var ąssembly = Assembly.GetEntryAssembly();

            if (ąssembly != null)
            {
                ExeName = System.IO.Path.GetFileName(ąssembly.Location);
                Version = ąssembly.GetName().Version;
                var attrs = ąssembly.GetCustomAttributes(true);
                AssemblyDescriptionAttribute vd = null;
                AssemblyTitleAttribute       vt = null;
                AssemblyCopyrightAttribute   vc = null;
                foreach (var attr in attrs)
                {
                    if (vd == null)
                    {
                        vd = attr as AssemblyDescriptionAttribute;
                        if (vd != null)
                        {
                            Description = vd.Description;
                            continue;
                        }
                    }
                    if (vt == null)
                    {
                        vt = attr as AssemblyTitleAttribute;
                        if (vt != null)
                        {
                            AppTitle = vt.Title;
                            continue;
                        }
                    }
                    if (vc == null)
                    {
                        vc = attr as AssemblyCopyrightAttribute;
                        if (vc != null)
                        {
                            Copyright = vc.Copyright;
                            continue;
                        }
                    }
                }
            }
        }
Exemple #28
0
        private void About_Load(object sender, System.EventArgs e)
        {
            Assembly crt = Assembly.GetExecutingAssembly();

            object[] attr = crt.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), true);
            AssemblyDescriptionAttribute desc = attr[0] as AssemblyDescriptionAttribute;

            attr = crt.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true);
            AssemblyFileVersionAttribute ver = attr[0] as AssemblyFileVersionAttribute;
            Version v = crt.GetName().Version;

            label1.Text = string.Format("{0}\nFile Version: {1}\nAssembly Version: {2}",
                                        desc.Description, ver.Version, v.ToString());
            attr = crt.GetCustomAttributes(typeof(AssemblyTitleAttribute), true);
            AssemblyTitleAttribute ta = attr[0] as AssemblyTitleAttribute;

            Text = string.Format("About  {0} {1}.{2}", ta.Title, v.Major, v.Minor); //Owner.Text

            attr = crt.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), true);
            AssemblyCopyrightAttribute copyright = attr[0] as AssemblyCopyrightAttribute;
            string strcpy = copyright.Copyright;

            _linkLabelAbout.Text = strcpy;
            attr = crt.GetCustomAttributes(typeof(AssemblyCompanyAttribute), true);
            AssemblyCompanyAttribute company = attr[0] as AssemblyCompanyAttribute;
            // look for the name in copyright string to activate if found
            int start = strcpy.IndexOf(company.Company, 0, StringComparison.InvariantCultureIgnoreCase);

            if (start != -1)
            {
                this._linkLabelAbout.LinkArea = new System.Windows.Forms.LinkArea(start, company.Company.Length);
            }
            else
            {// company not found in copyright string, so check for Copyright ©
                int size = "Copyright © ".Length;
                start = strcpy.IndexOf("Copyright ©", 0, StringComparison.InvariantCultureIgnoreCase);
                if (start != -1)
                {
                    this._linkLabelAbout.LinkArea = new System.Windows.Forms.LinkArea(size, strcpy.Length - size);
                }
                else
                {// no Copyright © string, activate the whole area
                    this._linkLabelAbout.LinkArea = new System.Windows.Forms.LinkArea(0, strcpy.Length);
                }
            }
            if (_linkLabelAbout.LinkArea != null && !_linkLabelAbout.LinkArea.IsEmpty)
            {
                this._linkLabelAbout.Links[0].LinkData = @"www.codeproject.com/script/Articles/list_articles.asp?userid=634640";
            }

            _lnksecond.Links[0].LinkData = @"http://www.codeproject.com/script/Articles/list_articles.asp?userid=240897";
        }
Exemple #29
0
        public static void AssemblyInfo()
        {
            Assembly assembly = Assembly.LoadFrom("Macierz.dll");

            Console.Write("======================================\n" + assembly.ManifestModule + " Assembly Info \n======================================\n");

            AssemblyDescriptionAttribute attribute = assembly
                                                     .GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)
                                                     .OfType <AssemblyDescriptionAttribute>()
                                                     .SingleOrDefault();

            var verInfo = FileVersionInfo.GetVersionInfo(typeof(Macierz.Macierz).Assembly.Location);

            Console.Write("Class :" + verInfo.ProductName + " \n");
            Console.WriteLine("Assembly title: " + verInfo.FileDescription);
            Console.WriteLine("Assembly description:  " + attribute.Description);
            Console.WriteLine("Version: " + verInfo.FileVersion);
            Console.WriteLine("Author: " + verInfo.LegalTrademarks);
            Console.WriteLine("Company: " + verInfo.CompanyName);
            Module manifest = typeof(Macierz.Macierz).Assembly.ManifestModule;
            var    types    = manifest.GetTypes();

            foreach (var type in types)
            {
                Console.WriteLine("\n" + type);
                Console.Write("\n Fields: \n");
                foreach (var field in @type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance))
                {
                    Console.WriteLine("   " + field.Attributes.ToString() + " " + field.ToString());
                }
                //    }
                Console.WriteLine();
                Console.Write(" Methods: \n");
                var meths = type.GetMethods();
                foreach (var m in meths)
                {
                    var attrs           = m.Attributes;
                    var methodAttribues = attrs.ToString().Split(',');
                    Console.WriteLine("     Attributes: " + methodAttribues[1] + "\n     Name: " + m.Name + "()" + "\n     Return Parameter: " + m.ReturnParameter);
                    if (m.GetParameters().Length != 0)
                    {
                        Console.WriteLine("\n         Arguments (Parameters): ");
                        var s = m.GetParameters();
                        foreach (var ss in s)
                        {
                            Console.WriteLine("                 " + ss);
                        }
                    }
                    Console.WriteLine();
                }
            }
        }
Exemple #30
0
        public static void GetHelp()
        {
            Format.Clear();
            Assembly assembly = Assembly.GetExecutingAssembly();
            Type     type     = typeof(AssemblyDescriptionAttribute);
            AssemblyDescriptionAttribute attribute = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, type);
            FileVersionInfo fileVersionInfo        = FileVersionInfo.GetVersionInfo(assembly.Location);

            Console.WriteLine("");
            Console.WriteLine("Press enter to continue");
            Console.ReadLine();
            Format.Dash();
        }
 public bool PosTest3()
 {
     bool retVal = true;
     TestLibrary.TestFramework.BeginScenario("PosTest3:Return the description from initialized AssemblyDescriptionAttribute 3");
     try
     {
         string description = null;
         AssemblyDescriptionAttribute assemDescriptionAttr = new AssemblyDescriptionAttribute(description);
         if (assemDescriptionAttr.Description != null)
         {
             TestLibrary.TestFramework.LogError("005", "the ExpectResult is not the ActualResult");
             retVal = false;
         }
     }
     catch (Exception e)
     {
         TestLibrary.TestFramework.LogError("006", "Unexpect exception:" + e);
         retVal = false;
     }
     return retVal;
 }
 public bool PosTest2()
 {
     bool retVal = true;
     TestLibrary.TestFramework.BeginScenario("PosTest2:Initialize the AssemblyDescriptionAttribute 2");
     try
     {
         string description = string.Empty;
         AssemblyDescriptionAttribute assemDescriptionAttr = new AssemblyDescriptionAttribute(description);
         if (assemDescriptionAttr == null || assemDescriptionAttr.Description != description)
         {
             TestLibrary.TestFramework.LogError("003", "the ExpectResult is not the ActualResult");
             retVal = false;
         }
     }
     catch (Exception e)
     {
         TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
         retVal = false;
     }
     return retVal;
 }
 public bool PosTest1()
 {
     bool retVal = true;
     TestLibrary.TestFramework.BeginScenario("PosTest1:Return the description from initialized AssemblyDescriptionAttribute 1");
     try
     {
         string description = TestLibrary.Generator.GetString(-55, false, c_MIN_STR_LENGTH, c_MAX_STR_LENGTH);
         AssemblyDescriptionAttribute assemDescriptionAttr = new AssemblyDescriptionAttribute(description);
         if (assemDescriptionAttr.Description != description)
         {
             TestLibrary.TestFramework.LogError("001", "the ExpectResult is not the ActualResult");
             retVal = false;
         }
     }
     catch (Exception e)
     {
         TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
         retVal = false;
     }
     return retVal;
 }