public ITLAbout() { InitializeComponent(); //获取此App的Assembly(AssemblyInfo.cpp中的内容) System.Reflection.Assembly oAssembly = System.Reflection.Assembly.GetExecutingAssembly(); System.Reflection.AssemblyTitleAttribute oTiltleAttribute = System.Reflection.AssemblyTitleAttribute.GetCustomAttribute(oAssembly, typeof(System.Reflection.AssemblyTitleAttribute)) as System.Reflection.AssemblyTitleAttribute; System.Reflection.AssemblyCopyrightAttribute oCopyRightAttribute = System.Reflection.AssemblyCopyrightAttribute.GetCustomAttribute(oAssembly, typeof(System.Reflection.AssemblyCopyrightAttribute)) as System.Reflection.AssemblyCopyrightAttribute; this.labelProductName.Text = oTiltleAttribute.Title; System.Version oVer = oAssembly.GetName().Version; this.labelVersion.Text = String.Format("Ver. {0}.{1} (Build: {2})", oVer.Major, oVer.Minor, oVer.Build); //Hyper link -. link ITL to www.infbj.com linkLabelCopyrights.Text = oCopyRightAttribute.Copyright; string strITL = "INF Technologies Ltd."; int nLength = strITL.Length; if (linkLabelCopyrights.Text.Length >= nLength) { int nPos = linkLabelCopyrights.Text.IndexOf(strITL, System.StringComparison.OrdinalIgnoreCase); if (nPos >= 0) { linkLabelCopyrights.Links.Add(nPos, nLength, "www.infbj.com"); } } }
public about() { InitializeComponent(); //-----Windowの設定--------ここから MaximizeBox = false; MinimizeBox = false; FormBorderStyle = FormBorderStyle.FixedSingle; //-------------------------ここまで NameLabel.Text = Application.ProductName; //NameLabelに製品名を入れる VersionLabel.Text = ("Version:" + Application.ProductVersion); //VarsionLabelにバージョンを入れる //--------------コピーライトを取得-----------ここから System.Reflection.AssemblyCopyrightAttribute asmcpy = (System.Reflection.AssemblyCopyrightAttribute)Attribute. GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyCopyrightAttribute)); //-------------------------------------------ここまで CRLabel.Text = asmcpy.Copyright.ToString(); //CRLabelに取得したコピーライトを入れる MITLabel.Text = "Released under the MIT license"; //MITLabelに定型文 }
/// <summary> /// Shows the settings dialog, or, by default, shows a message box indicating the assembly name, version and copyright information. /// </summary> protected virtual void ShowSettingsDialog() { System.IO.StringWriter sw = new System.IO.StringWriter(); System.Reflection.AssemblyName name = System.Reflection.Assembly.GetExecutingAssembly().GetName(); sw.WriteLine(name.Name); sw.WriteLine("Version " + name.Version); object[] attribs = System.Reflection.Assembly.GetExecutingAssembly(). GetCustomAttributes(typeof(System.Reflection.AssemblyDescriptionAttribute), false); if (attribs != null && attribs.Length != 0) { System.Reflection.AssemblyDescriptionAttribute desc = attribs[0] as System.Reflection.AssemblyDescriptionAttribute; if (desc.Description != string.Empty) { sw.WriteLine(desc.Description); } } attribs = System.Reflection.Assembly.GetExecutingAssembly(). GetCustomAttributes(typeof(System.Reflection.AssemblyCopyrightAttribute), false); if (attribs != null && attribs.Length != 0) { System.Reflection.AssemblyCopyrightAttribute copyright = attribs[0] as System.Reflection.AssemblyCopyrightAttribute; if (copyright.Copyright != string.Empty) { sw.WriteLine(); sw.WriteLine(copyright.Copyright); } } if (settingsText != null && settingsText != string.Empty) { sw.WriteLine(); sw.WriteLine(SettingsText); } MessageBox.Show(sw.ToString(), "PixieSaver", MessageBoxButtons.OK); }
public About() { InitializeComponent(); //NameLabel.Content = Application.ProductName;//NameLabelに製品名を入れる //VersionLabel.Content = ("Version:" + Application.ProductVersion);//VarsionLabelにバージョンを入れる //--------------情報を取得-----------ここから System.Reflection.AssemblyTitleAttribute asmttl = (System.Reflection.AssemblyTitleAttribute)Attribute. GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyTitleAttribute)); var fullname = typeof(App).Assembly.Location; var info = System.Diagnostics.FileVersionInfo.GetVersionInfo(fullname); var ver = info.FileVersion; System.Reflection.AssemblyCopyrightAttribute asmcpy = (System.Reflection.AssemblyCopyrightAttribute)Attribute. GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyCopyrightAttribute)); //-------------------------------------------ここまで NameLabel.Content = asmttl.Title; VersionLabel.Content = ("Version:" + ver); CRLabel.Content = asmcpy.Copyright.ToString(); //CRLabelに取得したコピーライトを入れる MITLabel.Text = "Released under the MIT license"; //MITLabelに定型文 }
public static string GetApplicationCopyrightInfo() { System.Reflection.AssemblyCopyrightAttribute attribute = (System.Reflection.AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyCopyrightAttribute)); return(attribute.Copyright); }