Esempio n. 1
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;
        }
Esempio n. 2
0
        public FrmLogin(FrmStart _frmstart)
        {
            InitializeComponent();
            try
            {
                this.frmStart          = _frmstart;
                this.tbPwd.Region      = new Region(GetRoundRectPath(new RectangleF(0, 0, this.tbPwd.Width, this.tbPwd.Height), 5f));
                this.tbUserName.Region = new Region(GetRoundRectPath(new RectangleF(0, 0, this.tbUserName.Width, this.tbUserName.Height), 5f));
                this.iniSysInfo(false);
                this.tbUserName.Text = string.Empty;
                this.tbPwd.Text      = string.Empty;
                this.ActiveControl   = this.tbUserName;
                this.tbUserName.Focus();
                Assembly assembly = Assembly.GetExecutingAssembly();
                //this.labelEdition.Text = assembly.FullName;

                // 获取程序集元数据
                AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)
                                                       AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                                     typeof(AssemblyCopyrightAttribute));
                AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)
                                                           AssemblyDescriptionAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(),
                                                                                                           typeof(AssemblyDescriptionAttribute));
            }
            catch (Exception ex)
            {
                LoggerHelper.Log("MsmkLogger", "FrmLogin--->FrmLogin-->Error:" + ex.ToString(), LogEnum.ExceptionLog);
            }
        }
Esempio n. 3
0
        public About()
        {
            InitializeComponent();
            Uri uri = new Uri("pack://application:,,,/B_32x32.ico", UriKind.RelativeOrAbsolute);

            this.Icon = BitmapFrame.Create(uri);
            // Populate name and version info.
            Assembly assembly            = Assembly.GetExecutingAssembly();
            AssemblyTitleAttribute title =
                (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyTitleAttribute));
            int      minVer = typeof(About).Assembly.GetName().Version.Minor;
            int      majVer = typeof(About).Assembly.GetName().Version.Major;
            double   ver    = majVer + (minVer / 100.0);
            FileInfo info   = new FileInfo(assembly.Location);
            DateTime date   = info.LastWriteTime;

            lblAppNameAndVersion.Content = title.Title + " version " + ver + " (" + date.ToShortDateString() + ")";

            // Populate copyright info
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));

            lblCopyright.Content = copyright.Copyright;
        }
Esempio n. 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";
        }
Esempio n. 5
0
        public AboutDialog()
        {
            this.Build();

            AssemblyTitleAttribute title = (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute));

            //AssemblyVersionAttribute version = (AssemblyVersionAttribute)AssemblyVersionAttribute.GetCustomAttribute(
            //                System.Reflection.Assembly.GetExecutingAssembly() , typeof(AssemblyVersionAttribute));

            label2.Markup = "<span size='x-large'>" + title.Title + "</span>"; // + " " + version.Version;

            //AssemblyCompanyAttribute company = (AssemblyCompanyAttribute)AssemblyCompanyAttribute.GetCustomAttribute(
            //                System.Reflection.Assembly.GetExecutingAssembly() , typeof(AssemblyCompanyAttribute));

            AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute));

            AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)AssemblyDescriptionAttribute.GetCustomAttribute(
                System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute));

            label3.Text = description.Description;

            label4.Text = copyright.Copyright;
        }
Esempio n. 6
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() + ")";
        }
Esempio n. 7
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)");
            }
        }
Esempio n. 8
0
        private void AboutBox_Load(object sender, System.EventArgs e)
        {
            AssemblyCopyrightAttribute crAttribute = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute));

            this.lblProduct.Text   = Application.ProductName;
            this.lblVersion.Text   = "Version: " + Application.ProductVersion;
            this.lblCopyright.Text = crAttribute.Copyright;
        }
Esempio n. 9
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);
        }
        protected override void OnLoad(EventArgs e)
        {
            if (!IsPostBack)
            {
                System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();



                Attribute copyright = AssemblyCopyrightAttribute.GetCustomAttribute(assembly, typeof(AssemblyCopyrightAttribute));
                if (copyright != null)
                {
                    this.lblCopyright.Text = ((AssemblyCopyrightAttribute)copyright).Copyright;
                }

                this.lblVersion.Text = string.Format(assembly.GetName().Version.ToString());

                lblApDesc.Text          = Session["AP"].ToString();
                lblBlocoMasterDesc.Text = "0" + Session["Bloco"].ToString();


                lblProprietarioDesc.Text = Session["Proprie1"].ToString();

                string id = ConfigurationManager.AppSettings["GoogleAnalyticsId"];

                if (!string.IsNullOrEmpty(id))
                {
                    string script = "";

                    script += "<script type=\"text/javascript\">";

                    script += "var _gaq = _gaq || [];";
                    script += "_gaq.push(['_setAccount', '" + id + "']);";
                    script += "_gaq.push(['_trackPageview']);";

                    script += "(function() {";
                    script += "  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;";
                    script += "  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';";
                    script += "  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);";
                    script += "})();";

                    script += "</script>";



                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "MessageAlert",
                    //  "<script language=\"JavaScript\">" + Environment.NewLine +
                    //  "alert(\'" + "TEST" + "\');" + Environment.NewLine +
                    //  "</script>", false);


                    ScriptManager.RegisterStartupScript(this, this.GetType(), "MessageAlert", script, false);
                }
            }
        }
Esempio n. 11
0
        private void ShowCopyright()
        {
            StringBuilder sb = new StringBuilder();
            AssemblyCopyrightAttribute objCopyright = (AssemblyCopyrightAttribute)
                                                      AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                                    typeof(AssemblyCopyrightAttribute));

            sb.Append("Copyright: ");
            sb.AppendLine(objCopyright.Copyright);
            sb.AppendLine("© Games Workshop Limited 2011. Games Workshop, Warhammer 40,000, Warhammer 40,000 Role Play, Dark Heresy, the foregoing marks' respective logos, Rogue Trader, Dark Heresy and all associated marks, logos, places, names, creatures, races and race insignia/devices/logos/symbols, vehicles, locations, weapons, units and unit insignia, characters, products and illustrations from the Warhammer 40,000 universe and the Dark Heresy game setting are either ®, TM and/or © Games Workshop Ltd 2000–2011, variably registered in the UK and other countries around the world. This edition published under license to Fantasy Flight Publishing Inc. All Rights Reserved to their respective owners.");
            this.AboutText.Text = sb.ToString();
        }
Esempio n. 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LoginName.Visible   = Page.User.Identity.IsAuthenticated;
        LoginStatus.Visible = Page.User.Identity.IsAuthenticated;
        LabelVersion.Text   = Assembly.GetAssembly(GetType()).GetName().Version.ToString();
        AssemblyCopyrightAttribute assemblyCopyrightAttribute = AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                                              typeof(AssemblyCopyrightAttribute)) as AssemblyCopyrightAttribute;

        if (assemblyCopyrightAttribute != null)
        {
            HyperLinkCopyright.Text = assemblyCopyrightAttribute.Copyright;
        }
    }
Esempio n. 13
0
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));
            FileInfo info = new FileInfo(assembly.Location);
            DateTime date = info.LastWriteTime;

            MessageBox.Show("MUD Screen Editor version " + GetType().Assembly.GetName().Version + " (" +
                            date.ToShortDateString() + ").\n\n" + copyright.Copyright + "\nWritten by Jason Champion.\n([email protected])\n" +
                            "\nBasternae MUD is at http://basternae.org\n\nThis application is freeware and may be distributed freely.",
                            "About The MUD Screen Editor");
        }
Esempio n. 14
0
        /// <summary>
        /// For the about box - gather info on build date and DLLs being used.
        /// </summary>
        /// <returns></returns>
        private string BuildVersionString()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));
            AssemblyTitleAttribute title =
                (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyTitleAttribute));
            FileInfo info = new FileInfo(assembly.Location);
            DateTime date = info.LastWriteTime;

            // Create an area class just so we can get info about the base assembly.
            Area     area        = new Area();
            string   baseName    = area.GetType().Assembly.GetName().Name;
            string   baseVersion = area.GetType().Assembly.GetName().Version.ToString();
            FileInfo baseInfo    = new FileInfo(area.GetType().Assembly.Location);
            DateTime baseDate    = baseInfo.LastWriteTime;

            Spell    spell        = new Spell();
            string   baseName2    = spell.GetType().Assembly.GetName().Name;
            string   baseVersion2 = spell.GetType().Assembly.GetName().Version.ToString();
            FileInfo baseInfo2    = new FileInfo(spell.GetType().Assembly.Location);
            DateTime baseDate2    = baseInfo2.LastWriteTime;

            string version = title.Title +
                             " version " +
                             assembly.GetName().Version +
                             " built on " +
                             date.ToShortDateString() +
                             ".\nBased on version " +
                             baseVersion +
                             " of " +
                             baseName +
                             " built on " +
                             baseDate.ToShortDateString() +
                             ".\nBased on version " +
                             baseVersion2 +
                             " of " +
                             baseName2 +
                             " built on " +
                             baseDate2.ToShortDateString() +
                             ".\nThis application is " +
                             copyright.Copyright +
                             "\nWritten by Jason Champion (Xangis).\nFor the latest version, visit http://basternae.org.";

            return(version);
        }
Esempio n. 15
0
        public Window1() : this(EditLevel.FULL)
        {
            AssemblyTitleAttribute     title;
            AssemblyCopyrightAttribute copyright;
            Assembly aAssembly = Assembly.GetExecutingAssembly();


            title = (AssemblyTitleAttribute)
                    AssemblyTitleAttribute.GetCustomAttribute(
                aAssembly, typeof(AssemblyTitleAttribute));

            copyright = (AssemblyCopyrightAttribute)
                        AssemblyCopyrightAttribute.GetCustomAttribute(
                aAssembly, typeof(AssemblyCopyrightAttribute));
            APP_TITLE     = title.Title;
            APP_VERSION   = aAssembly.GetName().Version.ToString();
            APP_COPYRIGHT = copyright.Copyright;

            icl = new ICList();

            gateCanvas.ICL          = icl;
            gateCanvas.UndoProvider = (UndoRedo.UndoManager)Resources["undoManager"];
            gateCanvas.SetCaptureICLChanges();
            spGates.ICList       = icl;
            spGates.UndoProvider = (UndoRedo.UndoManager)Resources["undoManager"];

            this.Loaded += (s2, e2) => { Gates.IOGates.Clock.CalculatePrecession(); };

            this.Closing += new CancelEventHandler(Window1_Closing);

            if (!string.IsNullOrEmpty(LOAD_ON_START))
            {
                try
                {
                    CircuitXML cxml = new CircuitXML(icl);
                    RefreshGateCanvas(cxml.Load(LOAD_ON_START, icl.Add));

                    btnSave.IsEnabled = true;
                    _filename         = LOAD_ON_START;
                    UpdateTitle();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Unable to load requested circuit, reason: " + ex.ToString());
                }
            }
        }
Esempio n. 16
0
        private int get_current_version(ref string productName)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            // 获取程序集元数据
            AssemblyCopyrightAttribute copyright = (AssemblyCopyrightAttribute)
                                                   AssemblyCopyrightAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
                                                                                                 typeof(AssemblyCopyrightAttribute));
            AssemblyDescriptionAttribute description = (AssemblyDescriptionAttribute)
                                                       AssemblyDescriptionAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(),
                                                                                                       typeof(AssemblyDescriptionAttribute));

            productName = Application.ProductName;
            string ver = Application.ProductVersion;

            ver = ver.Replace(".", "");
            return(Convert.ToInt32(ver));
        }
Esempio n. 17
0
        /// <summary>Prints intro information to the console.</summary>
        static public void PrintBanner()
        {
            Assembly current = Assembly.GetExecutingAssembly();

            Console.Out.WriteLine("{0} Version {1}", current.GetName().Name, current.GetName().Version);
            AssemblyCopyrightAttribute attr = (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(current, typeof(AssemblyCopyrightAttribute));

            Console.Out.WriteLine(attr.Copyright);
            Console.Out.WriteLine("https://bitbucket.org/jayclassless/classless-hasher/");

            Console.Out.WriteLine();
            Console.Out.WriteLine("Runtime Environment:");
            Console.Out.WriteLine("               OS Version: {0}", Environment.OSVersion.VersionString);
            string framework = (Type.GetType("Mono.Runtime") == null) ? ".NET" : "Mono";

            Console.Out.WriteLine("              CLR Version: v{0} ({1})", Environment.Version, framework);

            Console.Out.WriteLine(" Classless.Hasher Version: v{0}", Assembly.GetAssembly(typeof(Classless.Hasher.HashAlgorithm)).GetName().Version);
        }
Esempio n. 18
0
        /// <summary>
        /// Get header to print on help screen.
        /// </summary>
        /// <returns>
        /// String representing header to print on help screen.
        /// </returns>
        static string GetHeader()
        {
            const char Space = ' ';

            AssemblyTitleAttribute title =
                AssemblyTitleAttribute.GetCustomAttribute(Assembly,
                                                          typeof(AssemblyTitleAttribute)) as AssemblyTitleAttribute;

            AssemblyCopyrightAttribute copyright =
                AssemblyCopyrightAttribute.GetCustomAttribute(Assembly,
                                                              typeof(AssemblyCopyrightAttribute)) as AssemblyCopyrightAttribute;

            StringBuilder header = new StringBuilder();

            header.AppendLine(title.Title + Space + Version);
            header.AppendLine(copyright.Copyright);
            header.Append(Url);

            return(header.ToString());
        }
Esempio n. 19
0
        /// <summary>
        /// Load the controls on the forms with data
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void AboutDlg_Load(object sender, System.EventArgs e)
        {
            // Get assembly information not available from the application object
            Assembly asm = Assembly.GetExecutingAssembly();
            AssemblyDescriptionAttribute aDescr = (AssemblyDescriptionAttribute)
                                                  AssemblyDescriptionAttribute.GetCustomAttribute(asm,
                                                                                                  typeof(AssemblyDescriptionAttribute));
            AssemblyCopyrightAttribute aCopyright = (AssemblyCopyrightAttribute)
                                                    AssemblyCopyrightAttribute.GetCustomAttribute(asm,
                                                                                                  typeof(AssemblyCopyrightAttribute));

            // Set the labels
            this.Text            = "About " + Application.ProductName;
            lblName.Text         = Application.ProductName;
            lblVersion.Text      = "Version: " + Application.ProductVersion;
            lblDescription.Text  = aDescr.Description;
            lblCopyright.Text    = aCopyright.Copyright;
            lnkHelp.Text         = Settings.Default.AuthorEMailAddress;
            lnkEWoodruffUrl.Text = Settings.Default.EWoodruffURL;
            lnkProjectUrl.Text   = Settings.Default.ProjectURL;

            // Display components used by this assembly sorted by name
            AssemblyName[] anComponents = asm.GetReferencedAssemblies();

            foreach (AssemblyName an in anComponents)
            {
                ListViewItem lvi = lvComponents.Items.Add(an.Name);
                lvi.SubItems.Add(an.Version.ToString());
            }

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

            // Set the e-mail and URL links
            lnkHelp.Links[0].LinkData = "mailto:" + lnkHelp.Text +
                                        "?Subject=" + Application.ProductName;
            lnkEWoodruffUrl.Links[0].LinkData = lnkEWoodruffUrl.Text;
            lnkProjectUrl.Links[0].LinkData   = lnkProjectUrl.Text;
        }
Esempio n. 20
0
        private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));
            AssemblyTitleAttribute title =
                (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyTitleAttribute));

            System.IO.FileInfo info = new System.IO.FileInfo(assembly.Location);
            DateTime           date = info.LastWriteTime;

            MessageBox.Show(
                title.Title +
                " version " +
                assembly.GetName().Version.ToString() + "\n" +
                "released " +
                date.ToShortDateString() +
                "\nWritten by Santiago Saldana." + "\n" +
                "For the latest version, visit http://code.google.com/p/steel-batallion-64/", "About Steel-Batallion-64", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button2, 0, "http://code.google.com/p/steel-batallion-64/w/list");
        }
Esempio n. 21
0
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyCopyrightAttribute copyright =
                (AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyCopyrightAttribute));
            AssemblyTitleAttribute title =
                (AssemblyTitleAttribute)AssemblyTitleAttribute.GetCustomAttribute(
                    assembly, typeof(AssemblyTitleAttribute));

            System.IO.FileInfo info = new System.IO.FileInfo(assembly.Location);
            DateTime           date = info.LastWriteTime;

            // Create an area class just so we can get info about the base assembly.
            HelpData.Help area        = new HelpData.Help();
            string        BaseName    = area.GetType().Assembly.GetName().Name;
            string        BaseVersion = area.GetType().Assembly.GetName().Version.ToString();

            System.IO.FileInfo BaseInfo = new System.IO.FileInfo(area.GetType().Assembly.Location);
            DateTime           BaseDate = info.LastWriteTime;

            MessageBox.Show(
                title.Title +
                " version " +
                assembly.GetName().Version.ToString() +
                " built on " +
                date.ToShortDateString() +
                ".\nBased on version " +
                BaseVersion +
                " of " +
                BaseName +
                " built on " +
                BaseDate.ToShortDateString() +
                ".\nThis application is " +
                copyright.Copyright +
                "\nWritten by Jason Champion (Xangis).\nFor the latest version, visit http://basternae.org.",
                "About " + title.Title);
        }
        /// <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();
        }
        /// <summary>
        /// Generate the parameter section of commandline help
        /// based on the given commandlineinfo type.
        /// The commandlineinfo type must have fields or properties
        /// decorated with CommandArg, CommandOption,... attributes.
        /// </summary>
        public string GenerateHelp(Type commandlineinfotype)
        {
            StringBuilder sb = new StringBuilder();

            Assembly   entryAssembly          = Assembly.GetEntryAssembly();
            MemberInfo help                   = null;
            SortedList <int, MemberInfo> args = new SortedList <int, MemberInfo>();
            MemberInfo        argList         = null;
            List <MemberInfo> options         = new List <MemberInfo>();

            // Retrieve members:
            foreach (MemberInfo member in commandlineinfotype.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetField | BindingFlags.GetProperty))
            {
                if (CommandArgAttribute.Get(member) != null)
                {
                    args.Add(CommandArgAttribute.Get(member).Order, member);
                }
                else if (CommandArgListAttribute.Get(member) != null)
                {
                    argList = member;
                }
                else if (CommandOptionAttribute.Get(member) != null)
                {
                    options.Add(member);
                }
                else if (CommandHelpAttribute.Get(member) != null)
                {
                    help = member;
                }
            }

            // Write application title:
            sb.AppendLine(((AssemblyTitleAttribute)entryAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false)[0]).Title);
            sb.AppendLine();

            // Write application description:
            if (commandlineinfotype.GetCustomAttributes(typeof(CommandInfoAttribute), false).Length > 0)
            {
                // Based on CommandInfoAttribute if available:
                sb.AppendLine(((CommandInfoAttribute)commandlineinfotype.GetCustomAttributes(typeof(CommandInfoAttribute), false)[0]).Description);
                sb.AppendLine();
            }
            else
            {
                // Else based on AssemblyDescriptionAttribute:
                var descattr = ((AssemblyDescriptionAttribute)entryAssembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0]);
                if ((descattr != null) && (!String.IsNullOrWhiteSpace(descattr.Description)))
                {
                    sb.AppendLine(descattr.Description);
                    sb.AppendLine();
                }
            }

            // Write syntax:
            sb.AppendLine("Syntax:");
            sb.Append(" {command}");
            foreach (MemberInfo argMember in args.Values)
            {
                CommandArgAttribute argDef = CommandArgAttribute.Get(argMember);
                sb.Append(' ');

                sb.Append((argDef.IsRequired) ? '<' : '[');
                sb.Append(argDef.Name);
                sb.Append((argDef.IsRequired) ? '>' : ']');
            }
            if (argList != null)
            {
                CommandArgListAttribute arglDef = CommandArgListAttribute.Get(argList);
                sb.Append(' ');
                sb.Append((arglDef.IsRequired) ? '<' : '[');
                sb.Append(arglDef.Name);
                sb.Append("...");
                sb.Append((arglDef.IsRequired) ? '>' : ']');
            }
            foreach (MemberInfo optMember in options)
            {
                CommandOptionAttribute optDef = CommandOptionAttribute.Get(optMember);
                Type optType = CommandOptionAttribute.GetValueType(optMember);
                CommandOptionValueAttribute[] optValues = CommandOptionAttribute.GetValues(optMember);

                sb.Append(' ');

                if (optDef.IsRequired == false)
                {
                    sb.Append('[');
                }

                sb.Append(this.optionMarker);
                sb.Append(optDef.Name);

                if (optValues.Length > 0)
                {
                    sb.Append(this.valueSeparator);
                    string separator = "";
                    foreach (CommandOptionValueAttribute value in optValues)
                    {
                        sb.Append(separator);
                        sb.Append(value.UserValue);
                        separator = "|";
                    }
                }
                else if (optType.Equals(typeof(Boolean)) == false)
                {
                    sb.Append(this.valueSeparator);
                    sb.Append("?");
                }

                if (optDef.IsRequired == false)
                {
                    sb.Append(']');
                }
            }
            sb.AppendLine();
            sb.AppendLine();

            // Write argument details:
            foreach (MemberInfo argMember in args.Values)
            {
                CommandArgAttribute  argDef = CommandArgAttribute.Get(argMember);
                CommandInfoAttribute info   = CommandInfoAttribute.Get(argMember);

                sb.Append(' ');
                sb.Append(String.Concat(argDef.Name, new String(' ', 13)).Substring(0, 13));
                sb.Append(' ');
                if (info != null)
                {
                    sb.Append(info.Description);
                }
                else
                {
                    sb.Append(argDef.Name);
                }
                sb.AppendLine();
            }
            if (argList != null)
            {
                CommandArgListAttribute arglDef = CommandArgListAttribute.Get(argList);
                CommandInfoAttribute    info    = CommandInfoAttribute.Get(argList);

                sb.Append(' ');
                sb.Append(String.Concat(arglDef.Name, new String(' ', 13)).Substring(0, 13));
                sb.Append(' ');
                if (info != null)
                {
                    sb.Append(info.Description);
                }
                else
                {
                    sb.Append("...");
                }
                sb.AppendLine();
            }

            // Write option details:
            foreach (MemberInfo optMember in options)
            {
                CommandOptionAttribute optDef = CommandOptionAttribute.Get(optMember);
                CommandInfoAttribute   info   = CommandInfoAttribute.Get(optMember);
                Type optType = CommandOptionAttribute.GetValueType(optMember);
                CommandOptionValueAttribute[] optValues = CommandOptionAttribute.GetValues(optMember);

                string optname = this.optionMarker + optDef.Name;
                if (optDef.ShortName != null)
                {
                    optname += "|" + optDef.ShortName;
                }

                sb.Append(' ');
                sb.Append(String.Concat(optname, new String(' ', 13)).Substring(0, 13));
                sb.Append(' ');
                if (info != null)
                {
                    sb.Append(info.Description);
                }
                else
                {
                    sb.Append(optDef.Name);
                }
                if (optValues.Length > 0)
                {
                    sb.Append(':');
                }
                sb.AppendLine();
                foreach (CommandOptionValueAttribute value in optValues)
                {
                    sb.Append("   ");
                    sb.Append(String.Concat(value.UserValue, new String(' ', 13)).Substring(0, 13));
                    sb.Append(' ');
                    sb.Append(value.Description);
                    sb.AppendLine();
                }
            }
            sb.AppendLine();

            // Write samples:
            if (commandlineinfotype.GetCustomAttributes(typeof(CommandExampleAttribute), false).Length > 0)
            {
                sb.AppendLine("Examples:");
                CommandExampleAttribute[] samples = CommandExampleAttribute.GetValues(commandlineinfotype);
                for (int i = samples.Length - 1; i >= 0; i--)
                {
                    CommandExampleAttribute sample = samples[i];
                    sb.Append(" {command} ");
                    sb.AppendLine(sample.Sample);
                    if (!String.IsNullOrEmpty(sample.Description))
                    {
                        sb.Append("    ");
                        sb.AppendLine(sample.Description);
                    }
                }
                sb.AppendLine();
            }

            // Write application copyright:
            if (AssemblyCopyrightAttribute.GetCustomAttribute(entryAssembly, typeof(AssemblyCopyrightAttribute)) != null)
            {
                sb.AppendLine(((AssemblyCopyrightAttribute)AssemblyCopyrightAttribute.GetCustomAttribute(entryAssembly, typeof(AssemblyCopyrightAttribute))).Copyright.Replace("©", "(C)"));
                sb.AppendLine();
            }

            // Perform substitutions of variables:
            sb = sb.Replace("{command}", System.Diagnostics.Process.GetCurrentProcess().ProcessName);

            // Returns the whole help:
            return(sb.ToString());
        }
Esempio n. 24
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);
        }
Esempio n. 25
0
        private Dictionary <String, String> GetAssemblyInfoDictionary(Assembly selectedAssembly)
        {
            //Create the dictionary
            Dictionary <String, String> dictionaryOfProperties = new Dictionary <String, String>();

            //Dim dictionaryOfProperties As New Dictionary(Of String, String)();

            //get the location of the assembly
            //Dim assemblyPath As String = selectedAssembly.Location

            //add the assembly location to out dictionary
            //dictionaryOfProperties.Add("AssemblyLocation", assemblyPath)

            //create the AssemblyName object based on our Assembly
            //this will enable us to get the version information
            //and other properties related to our assembly
            System.Reflection.AssemblyName assemblyName = selectedAssembly.GetName();

            //add the FullName of our assembly
            dictionaryOfProperties.Add("AssemblyFullName", assemblyName.FullName);
            //add the Name of the assembly
            dictionaryOfProperties.Add("AssemblyName", assemblyName.Name);

            //add the assembly version information
            dictionaryOfProperties.Add("Version", assemblyName.Version.ToString());
            dictionaryOfProperties.Add("Version.Major", assemblyName.Version.Major.ToString());
            dictionaryOfProperties.Add("Version.Minor", assemblyName.Version.Minor.ToString());
            dictionaryOfProperties.Add("Version.Build", assemblyName.Version.Build.ToString());
            dictionaryOfProperties.Add("Version.Revision", assemblyName.Version.Revision.ToString());

            //Get the Copyright info.
            AssemblyCopyrightAttribute copyrightInstance = (AssemblyCopyrightAttribute)(AssemblyCopyrightAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute)));

            dictionaryOfProperties.Add("Copyright", copyrightInstance.Copyright);

            //add the creation time
            //Dim creationTime As DateTime = File.GetCreationTime(assemblyPath)
            //dictionaryOfProperties.Add("CreationTime", creationTime.ToString())

            //add the last write time
            //Dim lastWriteTime As DateTime = File.GetLastWriteTime(assemblyPath)
            //dictionaryOfProperties.Add("LastWriteTime", creationTime.ToString())

            //return our dictionary obeject
            return(dictionaryOfProperties);
        }