コード例 #1
0
        /// <summary>
        /// Fixes the license placeholder.
        /// </summary>
        /// <remarks>
        /// This method fixes the license placeholder if necessary.
        /// </remarks>
        /// <param name="value">
        /// The help license attribute to be fixed.
        /// </param>
        /// <returns>
        /// The fixed help license attribute.
        /// </returns>
        private HelpLicenseAttribute FixupLicense(HelpLicenseAttribute value)
        {
            if (value.IsContent)
            {
                if (value.Content.Contains(Placeholders.Copyright))
                {
                    try
                    {
                        AssemblyCopyrightAttribute copyright = Assembly.GetEntryAssembly().GetCustomAttributes()
                                                               .Where(x => x is AssemblyCopyrightAttribute).FirstOrDefault() as AssemblyCopyrightAttribute;

                        if (copyright != null && !String.IsNullOrWhiteSpace(copyright.Copyright))
                        {
                            value.Content = value.Content.Replace(Placeholders.Copyright, copyright.Copyright);
                        }
                    }
                    catch (Exception exception)
                    {
                        Debug.WriteLine(exception);
                    }
                }

                if (value.Content.Contains(Placeholders.Company))
                {
                    try
                    {
                        AssemblyCompanyAttribute company = Assembly.GetEntryAssembly().GetCustomAttributes()
                                                           .Where(x => x is AssemblyCompanyAttribute).FirstOrDefault() as AssemblyCompanyAttribute;

                        if (company != null && !String.IsNullOrWhiteSpace(company.Company))
                        {
                            value.Content = value.Content.Replace(Placeholders.Company, company.Company);
                        }
                    }
                    catch (Exception exception)
                    {
                        Debug.WriteLine(exception);
                    }
                }

                if (value.Content.Contains(Placeholders.Version))
                {
                    try
                    {
                        String version = Assembly.GetEntryAssembly().GetName().Version.ToString();

                        if (!String.IsNullOrWhiteSpace(version))
                        {
                            value.Content = value.Content.Replace(Placeholders.Version, version);
                        }
                    }
                    catch (Exception exception)
                    {
                        Debug.WriteLine(exception);
                    }
                }
            }

            return(value);
        }
コード例 #2
0
        public AboutBox()
        {
            InitializeComponent();

            foreach (Assembly s in AppDomain.CurrentDomain.GetAssemblies())
            {
                string[] lvsi = new string[3];
                lvsi[0] = s.GetName().Name;
                lvsi[1] = s.GetName().FullName;
                lvsi[2] = s.GetName().Version.ToString();
                ListViewItem lvi = new ListViewItem(lvsi, 0);
                this.ListOfAssemblies.Items.Add(lvi);
            }

            AssemblyCopyrightAttribute   objCopyright   = AssemblyCopyrightAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute)) as AssemblyCopyrightAttribute;
            AssemblyDescriptionAttribute objDescription = AssemblyDescriptionAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute)) as AssemblyDescriptionAttribute;
            AssemblyCompanyAttribute     objCompany     = AssemblyCompanyAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCompanyAttribute)) as AssemblyCompanyAttribute;
            AssemblyTrademarkAttribute   objTrademark   = AssemblyTrademarkAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyTrademarkAttribute)) as AssemblyTrademarkAttribute;
            AssemblyProductAttribute     objProduct     = AssemblyProductAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute)) as AssemblyProductAttribute;
            AssemblyTitleAttribute       objTitle       = AssemblyTitleAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute)) as AssemblyTitleAttribute;
            GuidAttribute         objGuid         = GuidAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(GuidAttribute)) as GuidAttribute;
            DebuggableAttribute   objDebuggable   = DebuggableAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(DebuggableAttribute)) as DebuggableAttribute;
            CLSCompliantAttribute objCLSCompliant = CLSCompliantAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(CLSCompliantAttribute)) as CLSCompliantAttribute;

            AppName.Text        = objProduct.Product;
            BigTitle.Text       = objTitle.Title;
            ProdVer.Text        = QuestDesignerMain.Version;
            AppDesc.Text        = objDescription.Description;
            CopyrightLabel.Text = objCopyright.Copyright;
            SerialNo.Text       = objGuid.Value;
            Company.Text        = objCompany.Company;
        }
コード例 #3
0
        public AssemblyCopyrightAttributeTest()
        {
            //create a dynamic assembly with the required attribute
            //and check for the validity

            dynAsmName.Name = "TestAssembly";

            dynAssembly = Thread.GetDomain().DefineDynamicAssembly(
                dynAsmName, AssemblyBuilderAccess.Run
                );

            // Set the required Attribute of the assembly.
            Type            attribute = typeof(AssemblyCopyrightAttribute);
            ConstructorInfo ctrInfo   = attribute.GetConstructor(
                new Type [] { typeof(string) }
                );
            CustomAttributeBuilder attrBuilder =
                new CustomAttributeBuilder(ctrInfo, new object [1] {
                "Ximian"
            });

            dynAssembly.SetCustomAttribute(attrBuilder);
            object [] attributes = dynAssembly.GetCustomAttributes(true);
            attr = attributes [0] as AssemblyCopyrightAttribute;
        }
コード例 #4
0
        //=====================================================================

        /// <summary>
        /// Set the version and assembly info on load
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void AboutDlg_Load(object sender, EventArgs e)
        {
            // Get assembly information not available from the application object
            Assembly asm = Assembly.GetEntryAssembly();
            AssemblyTitleAttribute title = (AssemblyTitleAttribute)
                                           AssemblyTitleAttribute.GetCustomAttribute(asm, typeof(AssemblyTitleAttribute));
            AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)
                                                   AssemblyCopyrightAttribute.GetCustomAttribute(asm, typeof(AssemblyCopyrightAttribute));
            AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)
                                                AssemblyDescriptionAttribute.GetCustomAttribute(asm, typeof(AssemblyDescriptionAttribute));

            // Set the labels
            lblName.Text        = title.Title;
            lblDescription.Text = desc.Description;
            lblVersion.Text     = "Version: " + Application.ProductVersion;
            lblCopyright.Text   = copyright.Copyright;

            // Display components used by this assembly sorted by name
            foreach (AssemblyName an in asm.GetReferencedAssemblies())
            {
                ListViewItem lvi = lvComponents.Items.Add(an.Name);
                lvi.SubItems.Add(an.Version.ToString());
            }

            lvComponents.Sorting = SortOrder.Ascending;
            lvComponents.Sort();

            // Set e-mail link
            lnkHelp.Links[0].LinkData = "mailto:" + lnkHelp.Text + "?Subject=EWSoftware CalendarBrowser Demo";
        }
コード例 #5
0
        // *******************************************************************
        // Public methods.
        // *******************************************************************

        #region Public methods

        /// <summary>
        /// Reads the value of the <see cref="AssemblyCopyrightAttribute"/>
        /// attribute for the given assembly.
        /// </summary>
        /// <param name="assembly">The assembly to read from.</param>
        /// <returns>The value of the given assembly's copyright attribute.</returns>
        public static string ReadCopyright(this Assembly assembly)
        {
            // Attempt to read the assembly's copyright attribute.
            object[] attributes = assembly.GetCustomAttributes(
                typeof(AssemblyCopyrightAttribute),
                true
                );

            // Did we fail?
            if (attributes.Length == 0)
            {
                return(string.Empty);
            }

            // Attempt to recover a reference to the attribute.
            AssemblyCopyrightAttribute attr =
                attributes[0] as AssemblyCopyrightAttribute;

            // Did we fail?
            if (attr == null || attr.Copyright.Length == 0)
            {
                return(string.Empty);
            }

            // Return the text for the attribute.
            return(attr.Copyright);
        }
コード例 #6
0
        /// <summary>
        /// Shows the help of the program.
        /// </summary>
        internal void ShowHelp()
        {
            var availableReportTypes = this.reportBuilderFactory.GetAvailableReportTypes();

            Console.WriteLine();
            Console.WriteLine(typeof(ReportConfigurationBuilder).Assembly.GetName().Name + " "
                              + typeof(ReportConfigurationBuilder).Assembly.GetName().Version);

            AssemblyCopyrightAttribute assemblyCopyrightAttribute = typeof(ReportConfigurationBuilder).Assembly
                                                                    .GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)
                                                                    .Cast <AssemblyCopyrightAttribute>()
                                                                    .FirstOrDefault();

            if (assemblyCopyrightAttribute != null)
            {
                Console.WriteLine(assemblyCopyrightAttribute.Copyright);
            }

            Console.WriteLine();
            Console.WriteLine(Help.Parameters);
            Console.WriteLine("    " + Help.Parameters1);
            Console.WriteLine("    " + Help.Parameters2);
            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "    " + Help.Parameters3, string.Join("|", availableReportTypes.Take(3).Union(new[] { "..." }))));
            Console.WriteLine("    " + Help.Parameters4);
            Console.WriteLine("    " + Help.Parameters5);
            Console.WriteLine("    " + Help.Parameters6);
            Console.WriteLine("    " + Help.Parameters7);
            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "    " + Help.Parameters8, string.Join("|", Enum.GetNames(typeof(VerbosityLevel)))));

            Console.WriteLine();
            Console.WriteLine(Help.Explanations);
            Console.WriteLine("    " + Help.Explanations1);
            Console.WriteLine("    " + Help.Explanations2);
            Console.WriteLine("    " + Help.Explanations3);
            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "    " + Help.ReportTypeValues, string.Join(", ", availableReportTypes)));
            Console.WriteLine("    " + Help.Explanations4);
            Console.WriteLine("    " + Help.Explanations5);
            Console.WriteLine("    " + Help.Explanations6);
            Console.WriteLine("    " + Help.Explanations7);
            Console.WriteLine("    " + Help.Explanations8);
            Console.WriteLine("    " + Help.Explanations9);
            Console.WriteLine("    " + Help.Explanations10);
            Console.WriteLine("    " + Help.Explanations11);
            Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "    " + Help.VerbosityValues, string.Join(", ", Enum.GetNames(typeof(VerbosityLevel)))));

            Console.WriteLine();
            Console.WriteLine(Help.DefaultValues);
            Console.WriteLine("   -reporttypes:Html");
            Console.WriteLine("   -assemblyfilters:+*");
            Console.WriteLine("   -classfilters:+*");
            Console.WriteLine("   -verbosity:" + VerbosityLevel.Verbose);

            Console.WriteLine();
            Console.WriteLine(Help.Examples);
            Console.WriteLine("   \"-reports:coverage.xml\" \"-targetdir:C:\\report\"");
            Console.WriteLine("   \"-reports:target\\*\\*.xml\" \"-targetdir:C:\\report\" -reporttypes:Latex;HtmlSummary");
            Console.WriteLine("   \"-reports:coverage1.xml;coverage2.xml\" \"-targetdir:report\"");
            Console.WriteLine("   \"-reports:coverage.xml\" \"-targetdir:C:\\report\" -reporttypes:Latex \"-sourcedirs:C:\\MyProject\"");
            Console.WriteLine("   \"-reports:coverage.xml\" \"-targetdir:C:\\report\" \"-sourcedirs:C:\\MyProject1;C:\\MyProject2\" \"-assemblyfilters:+Included;-Excluded.*\"");
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AboutDialog"/> class.
        /// </summary>
        /// <param name="parentForm">The parent form.</param>
        public AboutDialog(Form parentForm)
        {
            this.InitializeComponent();

            // Setup form information
            Assembly assembly = this.GetType().Assembly;

            AssemblyCopyrightAttribute copyrightAttribute = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(assembly, typeof(AssemblyCopyrightAttribute));

            this.CopyrightLabel.Text = copyrightAttribute.Copyright;

            AssemblyDescriptionAttribute descriptionAttribute = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute));

            this.DescriptionLabel.Text = descriptionAttribute.Description;

            AssemblyProductAttribute productAttribute = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(assembly, typeof(AssemblyProductAttribute));

            this.NameLabel.Text = productAttribute.Product;

            AssemblyFileVersionAttribute fileVersionAttribute = (AssemblyFileVersionAttribute)AssemblyTitleAttribute.GetCustomAttribute(assembly, typeof(AssemblyFileVersionAttribute));

            this.VersionLabel.Text = string.Format(CultureInfo.InvariantCulture, "{0} ({1})", fileVersionAttribute.Version, assembly.GetName().Version);

            this.Text = string.Format(CultureInfo.InvariantCulture, "About {0}", productAttribute.Product);

            if (parentForm == null)
            {
                return;
            }

            this.Icon          = parentForm.Icon;
            this.picIcon.Image = parentForm.Icon.ToBitmap();
        }
コード例 #8
0
ファイル: TcpServer.cs プロジェクト: zphcxj/BeetleX
        private void OnWriteLogo()
        {
            AssemblyCopyrightAttribute productAttr = typeof(BeetleX.BXException).Assembly.GetCustomAttribute <AssemblyCopyrightAttribute>();
            var logo = "\r\n";

            logo += " -----------------------------------------------------------------------------\r\n";
            logo +=
                @"          ____                  _     _         __   __
         |  _ \                | |   | |        \ \ / /
         | |_) |   ___    ___  | |_  | |   ___   \ V / 
         |  _ <   / _ \  / _ \ | __| | |  / _ \   > <  
         | |_) | |  __/ |  __/ | |_  | | |  __/  / . \ 
         |____/   \___|  \___|  \__| |_|  \___| /_/ \_\ 

                                            tcp framework   

";
            logo += " -----------------------------------------------------------------------------\r\n";
            logo += $" {productAttr.Copyright}\r\n";
            logo += $" ServerGC [{GCSettings.IsServerGC}]\r\n";
            logo += $" Version  [{typeof(BeetleX.BXException).Assembly.GetName().Version}]\r\n";
            logo += " -----------------------------------------------------------------------------\r\n";
            foreach (var item in this.Options.Listens)
            {
                logo += $" {item}\r\n";
            }
            logo += " -----------------------------------------------------------------------------\r\n";
            Log(LogType.Info, null, logo);
        }
コード例 #9
0
        private string GetEULA(string eula)
        {
            Stream       resStream = Application.GetResourceStream(new Uri("pack://application:,,,/DavuxLib2;component/EULAs/" + eula + ".txt")).Stream;
            StreamReader sr        = new StreamReader(resStream);
            string       ret       = sr.ReadToEnd();

            Assembly assembly = Assembly.GetEntryAssembly();

            AssemblyTitleAttribute       assemblyTitle       = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0] as AssemblyTitleAttribute;
            AssemblyDescriptionAttribute assemblyDescription = assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0] as AssemblyDescriptionAttribute;
            AssemblyCompanyAttribute     assemblyCompany     = assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0] as AssemblyCompanyAttribute;
            AssemblyCopyrightAttribute   assemblyCopyright   = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0] as AssemblyCopyrightAttribute;
            AssemblyProductAttribute     assemblyProduct     = assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0] as AssemblyProductAttribute;

            string company = assemblyCompany.Company;


            if (company == "Dave Amenta")
            {
                company = "Dave Amenta Software, LLC";
            }
            //ret = ret.Replace("[SOFTWARE TITLE]", assemblyTitle.Title);
            ret = ret.Replace("[COMPANY_NAME]", company);
            //ret = ret.Replace("[YOUR COUNTRY]", "USA");


            return(ret);
        }
コード例 #10
0
        // Token: 0x06000108 RID: 264 RVA: 0x00008780 File Offset: 0x00006980
        static ConfuserEngine()
        {
            Assembly assembly = typeof(ConfuserEngine).Assembly;
            AssemblyProductAttribute nameAttr             = (AssemblyProductAttribute)assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];
            AssemblyInformationalVersionAttribute verAttr = (AssemblyInformationalVersionAttribute)assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false)[0];
            AssemblyCopyrightAttribute            cpAttr  = (AssemblyCopyrightAttribute)assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0];

            ConfuserEngine.Version   = string.Format("{0} {1}", nameAttr.Product, verAttr.InformationalVersion);
            ConfuserEngine.Copyright = cpAttr.Copyright;

            AppDomain.CurrentDomain.AssemblyResolve += (sender, e) => {
                try
                {
                    var asmName = new AssemblyName(e.Name);
                    foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
                    {
                        if (asm.GetName().Name == asmName.Name)
                        {
                            return(asm);
                        }
                    }
                    return(null);
                }
                catch
                {
                    return(null);
                }
            };
        }
コード例 #11
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)");
            }
        }
コード例 #12
0
        private void FillInInfo()
        {
            Assembly app = Assembly.GetExecutingAssembly();

            AssemblyTitleAttribute       title       = (AssemblyTitleAttribute)app.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0];
            AssemblyProductAttribute     product     = (AssemblyProductAttribute)app.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];
            AssemblyCopyrightAttribute   copyright   = (AssemblyCopyrightAttribute)app.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0];
            AssemblyCompanyAttribute     company     = (AssemblyCompanyAttribute)app.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0];
            AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)app.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0];

            System.Version version = app.GetName().Version;

            if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
            {
                version = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion;
            }

            SetCurrentValue(TitleProperty, System.String.Format("About {0}", title.Title));
            lblName.SetCurrentValue(TextBlock.TextProperty, title.Title);
            lblDescription.SetCurrentValue(TextBlock.TextProperty, description.Description);
            lblVersion.SetCurrentValue(TextBlock.TextProperty, System.String.Format("Version {0}", version.ToString()));
            lblCopyright.SetCurrentValue(TextBlock.TextProperty, copyright.Copyright.ToString());
            lblCompany.SetCurrentValue(TextBlock.TextProperty, company.Company);
            lblDisclaimer.SetCurrentValue(TextBlock.TextProperty, "All rights reserved.");
        }
コード例 #13
0
ファイル: Main.cs プロジェクト: Adapum/LoLG19Info
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AssemblyCopyrightAttribute copyright = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0] as AssemblyCopyrightAttribute;
            string info = Application.ProductName + "\n" + "version " + Application.ProductVersion + "\n" + copyright.Copyright;

            MessageBox.Show(info);
        }
コード例 #14
0
        /// <summary>
        /// Gets the usage text. Usage text is generated by obtaining the assembly's properties and displaying the
        /// validation <see cref="Argument"/> descriptions.
        /// </summary>
        /// <returns>Usage</returns>
        protected virtual string Usage()
        {
            StringBuilder usageTxt = new StringBuilder();
            Assembly      asm      = Assembly.GetEntryAssembly();

            // This was added for unit tests. For some reason there isn't an EntryAssembly so use
            if (asm == null)
            {
                asm = Assembly.GetCallingAssembly();
            }

            AssemblyDescriptionAttribute ada  = ((AssemblyDescriptionAttribute)asm.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0]);
            AssemblyCopyrightAttribute   acra = ((AssemblyCopyrightAttribute)asm.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0]);
            AssemblyCompanyAttribute     aca  = ((AssemblyCompanyAttribute)asm.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0]);

            usageTxt.AppendFormat($"{ada.Description} version {asm.GetName().Version.ToString()}\n");
            usageTxt.AppendLine(acra.Copyright);
            usageTxt.AppendLine();
            usageTxt.AppendFormat($"  {Path.GetFileNameWithoutExtension(asm.ManifestModule.Name)}");

            this.Sort((a, b) => b.IsRequired.CompareTo(a.IsRequired));
            this.ForEach(p => usageTxt.AppendFormat($" {p.Syntax}"));
            usageTxt.AppendLine();
            usageTxt.AppendLine();
            this.ForEach(p => usageTxt.AppendLine(p.GetUsage()));

            return(usageTxt.ToString());
        }
コード例 #15
0
        public string ReadAssemblyCopyright()
        {
            Type t = typeof(Program);
            AssemblyCopyrightAttribute productAttr = t.Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), true)[0] as AssemblyCopyrightAttribute;

            return(productAttr.Copyright);
        }
コード例 #16
0
ファイル: ConsoleUi.cs プロジェクト: summit677/conqat
        private static void WriteCopyright()
        {
            Assembly executingAssembly = Assembly.GetExecutingAssembly();

            System.Version version = executingAssembly.GetName().Version;

            object[] objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
            AssemblyProductAttribute productAttr = (AssemblyProductAttribute)objectAttrs[0];

            objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            AssemblyCopyrightAttribute copyrightAttr = (AssemblyCopyrightAttribute)objectAttrs[0];

            Console.WriteLine(String.Format("{0} version {1}", productAttr.Product, version.ToString(3)));
            Console.WriteLine(copyrightAttr.Copyright);
            Console.WriteLine();

            Console.WriteLine("Runtime Environment - ");
            RuntimeFramework framework = RuntimeFramework.CurrentFramework;

            Console.WriteLine(string.Format("   OS Version: {0}", Environment.OSVersion));
            Console.WriteLine(string.Format("  CLR Version: {0} ( {1} )",
                                            Environment.Version, framework.GetDisplayName()));

            Console.WriteLine();
        }
コード例 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandLineManagerAttribute"/> class.
        /// </summary>
        public CommandLineManagerAttribute()
        {
            Assembly     assembly = Assembly.GetEntryAssembly();
            AssemblyName name     = assembly.GetName();

            Version = name.Version.ToString();

            foreach (object objAttribute in assembly.GetCustomAttributes(false))
            {
                AssemblyCopyrightAttribute copyrightAttribute = objAttribute as AssemblyCopyrightAttribute;
                if (copyrightAttribute != null)
                {
                    Copyright = copyrightAttribute.Copyright;
                    continue;
                }

                AssemblyTitleAttribute titleAttribute = objAttribute as AssemblyTitleAttribute;
                if (titleAttribute != null)
                {
                    ApplicationName = titleAttribute.Title;
                    continue;
                }

                AssemblyDescriptionAttribute descriptionAttribute = objAttribute as AssemblyDescriptionAttribute;
                if (descriptionAttribute != null)
                {
                    Description = descriptionAttribute.Description;
                    continue;
                }
            }
        }
コード例 #18
0
        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  += Window_Deactivated;

            Assembly assembly = Assembly.GetEntryAssembly();

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

            AssemblyCopyrightAttribute   copyright   = assembly.GetCustomAttribute <AssemblyCopyrightAttribute>();
            AssemblyDescriptionAttribute description = assembly.GetCustomAttribute <AssemblyDescriptionAttribute>();
            AssemblyCompanyAttribute     company     = assembly.GetCustomAttribute <AssemblyCompanyAttribute>();

            Copyright   = copyright.Copyright;
            Description = description.Description;
            Publisher   = company.Company;

            AdditionalNotes = "This is a test assignment app from Head First C# 3rd edition book." + Environment.NewLine +
                              $"Survive {InvadersViewModel.TotalWaves} waves of evil invaders to save the earth!" + Environment.NewLine +
                              "Special thanks to @annliseevnaart";
        }
コード例 #19
0
        private void WriteCopyright()
        {
            Assembly executingAssembly = Assembly.GetExecutingAssembly();

            System.Version version = executingAssembly.GetName().Version;

#if NETCF_1_0
            writer.WriteLine("NUnitLite version {0}", version.ToString());
            writer.WriteLine("Copyright 2007, Charlie Poole");
#else
            object[] objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
            AssemblyProductAttribute productAttr = (AssemblyProductAttribute)objectAttrs[0];

            objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            AssemblyCopyrightAttribute copyrightAttr = (AssemblyCopyrightAttribute)objectAttrs[0];

            writer.WriteLine(String.Format("{0} version {1}", productAttr.Product, version.ToString(3)));
            writer.WriteLine(copyrightAttr.Copyright);
#endif
            writer.WriteLine();

            string clrPlatform = Type.GetType("Mono.Runtime", false) == null ? ".NET" : "Mono";
            writer.WriteLine("Runtime Environment -");
            writer.WriteLine("    OS Version: {0}", Environment.OSVersion);
            writer.WriteLine("  {0} Version: {1}", clrPlatform, Environment.Version);
            writer.WriteLine();
        }
コード例 #20
0
        private void OutputLogo()
        {
            AssemblyCopyrightAttribute productAttr = typeof(BeetleX.FastHttpApi.HttpApiServer).Assembly.GetCustomAttribute <AssemblyCopyrightAttribute>();
            var logo = "\r\n";

            logo += " -----------------------------------------------------------------------------\r\n";
            logo +=
                @"          ____                  _     _         __   __
         |  _ \                | |   | |        \ \ / /
         | |_) |   ___    ___  | |_  | |   ___   \ V / 
         |  _ <   / _ \  / _ \ | __| | |  / _ \   > <  
         | |_) | |  __/ |  __/ | |_  | | |  __/  / . \ 
         |____/   \___|  \___|  \__| |_|  \___| /_/ \_\ 

                            http and websocket framework   

";
            logo += " -----------------------------------------------------------------------------\r\n";
            logo += $" {productAttr.Copyright}\r\n";
            logo += $" ServerGC    [{GCSettings.IsServerGC}]\r\n";
            logo += $" BeetleX     Version [{typeof(BeetleX.BXException).Assembly.GetName().Version}]\r\n";
            logo += $" FastHttpApi Version [{ typeof(HttpApiServer).Assembly.GetName().Version}] \r\n";
            logo += " -----------------------------------------------------------------------------\r\n";
            foreach (var item in mServer.Options.Listens)
            {
                logo += $" {item}\r\n";
            }
            logo += " -----------------------------------------------------------------------------\r\n";

            Log(LogType.Info, logo);
        }
コード例 #21
0
        public static string GetAssemblyCopyright()
        {
            Assembly assembly = HttpContext.Current.ApplicationInstance.GetType().BaseType.Assembly;
            AssemblyCopyrightAttribute assemblyCompanyAttribute = (AssemblyCopyrightAttribute)(Attribute.GetCustomAttribute(assembly, typeof(AssemblyCopyrightAttribute), false));

            return(assemblyCompanyAttribute.Copyright);
        }
コード例 #22
0
        internal void Initialize(Assembly assembly)
        {
            this.Name    = assembly.GetName().Name;
            this.Version = assembly.GetName().Version.ToString();

            AssemblyDescriptionAttribute descriptionAttribute = assembly.GetCustomAttributes <AssemblyDescriptionAttribute>().FirstOrDefault();

            this.Description = (descriptionAttribute != null) ? descriptionAttribute.Description : "";

            AssemblyCompanyAttribute companyAttribute = assembly.GetCustomAttributes <AssemblyCompanyAttribute>().FirstOrDefault();

            this.Author = (descriptionAttribute != null) ? companyAttribute.Company : "";

            AssemblyCopyrightAttribute copyrightAttribute = assembly.GetCustomAttributes <AssemblyCopyrightAttribute>().FirstOrDefault();

            this.Copyright = (copyrightAttribute != null) ? copyrightAttribute.Copyright : "";

            try
            {
                this.Icon = Icon.ExtractAssociatedIcon(assembly.Location);
            }
            catch (ArgumentException ex)
            {
                Debugger.Debug.WriteLine(ex);
            }
        }
コード例 #23
0
        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  += Window_Deactivated;

            Assembly assembly = Assembly.GetEntryAssembly();

            Version = assembly.GetName().Version.ToString() + "  (For So-an)";
            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
            Copyright   = copyright.Copyright;
            Description = description.Description;
            Publisher   = company.Company;

            AdditionalNotes = "Further information about ... InformationInformationInformationInformationInformationInformationInformationInformation";
        }
コード例 #24
0
        /// <summary>Initializes an instance of FrmAbout.</summary>
        public FrmAbout()
        {
            InitializeComponent();
            StartEventProcessing();

            AssemblyCopyrightAttribute   copyright;
            AssemblyDescriptionAttribute description;

            // Display the Verifier information.
            lblVerifierNameVersion.Text = Verifier.GetFullTitle(true);
            copyright   = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute));
            description = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute));
            lblVerifierDescription.Text = description.Description;
            lblVerifierCopyright.Text   = "Copyright " + copyright.Copyright;

            // Display the Classless.Hasher information.
            lblHasherNameVersion.Text = Verifier.GetFullTitleHasher();
            copyright = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetAssembly(typeof(Classless.Hasher.MD5)), typeof(AssemblyCopyrightAttribute));
            lblHasherCopyright.Text = "Copyright " + copyright.Copyright;

            // Display the .NET information.
            lblNETNameVersion.Text = Verifier.GetFullTitleNET();

            // Display the OS information.
            lblOSNameVersion.Text = Classless.Utilities.OperatingSystem.Name + " v" + Classless.Utilities.OperatingSystem.Version.ToString(2) + " (" + Classless.Utilities.OperatingSystem.Version.Build.ToString() + ")";
        }
コード例 #25
0
        private void InitializeAssemblyInfo()
        {
            var assembly = Assembly.GetExecutingAssembly();

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

            AssemblyCopyrightAttribute copyRightAttribute =
                GetAssemblyAttribute <AssemblyCopyrightAttribute>(assembly);

            if (copyRightAttribute != null)
            {
                CopyRight = copyRightAttribute.Copyright;
            }

            AssemblyCompanyAttribute companyNameAttribute =
                GetAssemblyAttribute <AssemblyCompanyAttribute>(assembly);

            if (companyNameAttribute != null)
            {
                CompanyName = companyNameAttribute.Company;
            }

            Location = assembly.Location;
        }
コード例 #26
0
        public static void PrintHeader(Assembly a)
        {
            // Retrieves name and description that are stored as assembly
            // attributes in the specified assembly (usually the calling one)
            //
            // These attributes are defined as following:
            //  [assembly: AssemblyTitle ("beagrep-foo")]
            //  [assembly: AsssemblyDescription ("This is the program that does foo")]

            AssemblyTitleAttribute       title     = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(a, typeof(AssemblyTitleAttribute));
            AssemblyDescriptionAttribute desc      = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(a, typeof(AssemblyDescriptionAttribute));
            AssemblyCopyrightAttribute   copyright = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(a, typeof(AssemblyCopyrightAttribute));

            StringBuilder text = new StringBuilder();

            if (title != null && desc != null)
            {
                text.AppendFormat("{0}: {1}.\n", title.Title, desc.Description);
            }

            text.Append("Web page: http://www.beagrep-project.org/\n");
            text.Append(copyright == null ? DefaultCopyright : copyright.Copyright);

            Console.WriteLine(text);
        }
コード例 #27
0
ファイル: Attributes.cs プロジェクト: layomia/dotnet_runtime
        public static void PositiveTest2()
        {
            Assembly element       = typeof(AttributeGetCustomAttributes).Assembly;
            Type     attributeType = typeof(AssemblyDescriptionAttribute);
            AssemblyDescriptionAttribute attributeVal = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(element, attributeType, false);

            Assert.True(attributeVal != null);

            attributeType = typeof(AssemblyCopyrightAttribute);
            AssemblyCopyrightAttribute attributeVal1 = (AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(element, attributeType, false);

            Assert.True(attributeVal1 != null);

            attributeType = typeof(AssemblyCompanyAttribute);
            AssemblyCompanyAttribute attributeVal2 = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(element, attributeType, false);

            Assert.True(attributeVal2 != null);

            attributeType = typeof(AssemblyKeyNameAttribute);
            Attribute attributeVal3 = Attribute.GetCustomAttribute(element, attributeType, false);

            Assert.True(attributeVal3 == null);

            attributeType = typeof(AssemblyInformationalVersionAttribute);
            attributeVal3 = Attribute.GetCustomAttribute(element, attributeType, false);
            Assert.True(attributeVal3 != null);
        }
コード例 #28
0
ファイル: Help.cs プロジェクト: keutmann/wspbuilder
        public string Copyleft()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(LINEBREAK);

            AssemblyTitleAttribute titleAttrib = (AssemblyTitleAttribute)GetAttribute(typeof(AssemblyTitleAttribute));

            sb.Append(titleAttrib.Title + LINEBREAK + LINEBREAK);

            AssemblyFileVersionAttribute versionAttrib = (AssemblyFileVersionAttribute)GetAttribute(typeof(AssemblyFileVersionAttribute));

            if (versionAttrib != null)
            {
                sb.Append("Version: " + versionAttrib.Version.ToString() + LINEBREAK);
            }

            AssemblyCompanyAttribute companyAttrib = (AssemblyCompanyAttribute)GetAttribute(typeof(AssemblyCompanyAttribute));

            sb.Append(companyAttrib.Company + LINEBREAK);
            AssemblyCopyrightAttribute copyrightAttrib = (AssemblyCopyrightAttribute)GetAttribute(typeof(AssemblyCopyrightAttribute));

            sb.Append(copyrightAttrib.Copyright + LINEBREAK);

            return(sb.ToString());
        }
コード例 #29
0
        /// <summary>
        /// Ctor
        /// </summary>
        public About(Assembly assembly)
        {
            AssemblyName name = assembly.GetName();

            this.FullName = assembly.FullName;
            this.Version  = name.Version;
            this.Name     = name.Name;

            AssemblyCopyrightAttribute copyright = Attribute.GetCustomAttribute(assembly, typeof(AssemblyCopyrightAttribute)) as AssemblyCopyrightAttribute;

            this.Copyright = (copyright != null) ? copyright.Copyright : String.Empty;

            AssemblyDescriptionAttribute description = Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute)) as AssemblyDescriptionAttribute;

            this.Description = (description != null) ? description.Description : String.Empty;

            AssemblyTitleAttribute title = Attribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute)) as AssemblyTitleAttribute;

            this.Title = (title != null) ? title.Title : String.Empty;

            AssemblyCompanyAttribute company = Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute)) as AssemblyCompanyAttribute;

            this.Company = (company != null) ? company.Company : String.Empty;

            AssemblyConfigurationAttribute config = Attribute.GetCustomAttribute(assembly, typeof(AssemblyConfigurationAttribute)) as AssemblyConfigurationAttribute;

            this.Configuration = (config != null) ? config.Configuration : String.Empty;
        }
コード例 #30
0
        private void Itm_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string   path        = e.Item.Tag.ToString();
            Assembly DllAssembly = Assembly.LoadFrom(path);
            AssemblyFileVersionAttribute VersionInfo     = DllAssembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false)[0] as AssemblyFileVersionAttribute;
            AssemblyCompanyAttribute     CompanyInfo     = DllAssembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0] as AssemblyCompanyAttribute;
            AssemblyProductAttribute     ProductInfo     = DllAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0] as AssemblyProductAttribute;
            AssemblyTitleAttribute       TitleInfo       = DllAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0] as AssemblyTitleAttribute;
            AssemblyCopyrightAttribute   CopyrightInfo   = DllAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0] as AssemblyCopyrightAttribute;
            AssemblyDescriptionAttribute DescriptionInfo = DllAssembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0] as AssemblyDescriptionAttribute;

            Type[] type_list = DllAssembly.GetExportedTypes();
            foreach (Type outerForm in type_list)
            {
                //Type outerForm = DllAssembly.GetTypes()[3];
                if (outerForm.BaseType.Name == "XtraUserControl")
                {
                    var obj = (Activator.CreateInstance(outerForm) as XtraUserControl);
                    obj.Dock = DockStyle.Fill;
                    this.panelControl1.Controls.Clear();
                    this.panelControl1.Controls.Add(obj);
                    break;
                }
                else if (outerForm.BaseType.Name == "ToolbarForm")
                {
                    var obj = (Activator.CreateInstance(outerForm) as ToolbarForm);
                    obj.ShowDialog();
                    break;
                }
            }
        }