public static string About(this Assembly assembly) { string about = String.Empty; AssemblyProductAttribute productAttribute = assembly.GetCustomAttributes( typeof(AssemblyProductAttribute), true).FirstOrDefault() as AssemblyProductAttribute; if (productAttribute != null) { about = productAttribute.Product.ToString(); } Version version = assembly.GetName().Version; if (version != null) { if (about.Length > 0) { about = String.Format("{0} {1}.{2}.{3}", about, version.Major, version.Minor, version.Build); } else { about = String.Format("Version {1}.{2}.{3}", version.Major, version.Minor, version.Build); } } return(about); }
private static string GetSolutionName() { Assembly asm = Assembly.GetExecutingAssembly(); AssemblyProductAttribute info = AssemblyProductAttribute.GetCustomAttribute(asm, typeof(AssemblyProductAttribute)) as AssemblyProductAttribute; return(info.Product); }
private void GetCustomAttributes() { Assembly assembly = Assembly.GetExecutingAssembly(); object[] attributes = assembly.GetCustomAttributes(true); foreach (var attribute in attributes) { if (attribute is AssemblyTitleAttribute) { AssemblyTitleAttribute attr = attribute as AssemblyTitleAttribute; if (attr != null) { _assemblyTitle = attr.Title; } } if (attribute is AssemblyProductAttribute) { AssemblyProductAttribute attr = attribute as AssemblyProductAttribute; if (attr != null) { _assemblyProduct = attr.Product; } } } }
/// <summary> /// Calls the default app on the download URL /// </summary> public void Update() { // get the messagebox text string s = "The version "; s += GetVersionString(); s += " is avaliable for download."; if (m_sMessageString != null && m_sMessageString.Length > 0) { s += "\n\n"; s += m_sMessageString; } s += "\n\nDo you wish to download the update?"; // Get the Messagebox title AssemblyProductAttribute a = (AssemblyProductAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0]; string t = a.Product; t += ": Online Update"; DialogResult dr = MessageBox.Show(s, t, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { System.Diagnostics.Process.Start(m_sDownloadString); } }
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; } } }
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); }
/// <summary> /// Initializes the message queues, read and write thread /// </summary> public IrcConnection() { #if LOG4NET Logger.Init(); Logger.Main.Debug("IrcConnection created"); #endif _SendBuffer[Priority.High] = Queue.Synchronized(new Queue()); _SendBuffer[Priority.AboveMedium] = Queue.Synchronized(new Queue()); _SendBuffer[Priority.Medium] = Queue.Synchronized(new Queue()); _SendBuffer[Priority.BelowMedium] = Queue.Synchronized(new Queue()); _SendBuffer[Priority.Low] = Queue.Synchronized(new Queue()); // setup own callbacks OnReadLine += new ReadLineEventHandler(_SimpleParser); OnConnectionError += new EventHandler(_OnConnectionError); _ReadThread = new ReadThread(this); _WriteThread = new WriteThread(this); _IdleWorkerThread = new IdleWorkerThread(this); Assembly assm = Assembly.GetAssembly(this.GetType()); AssemblyName assm_name = assm.GetName(false); AssemblyProductAttribute pr = (AssemblyProductAttribute)assm.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0]; _VersionNumber = assm_name.Version.ToString(); _VersionString = pr.Product + " " + _VersionNumber; }
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(); }
/// <summary> /// 設定画面の表示 /// </summary> private void ShowSettings() { // 表示済みの場合は何もしない if (this.Visible) { return; } // キーボードフック中断 KeyboardHook.Pause(); // 保存フォルダを取得 var saveFolderPath = Properties.Settings.Default.SaveForderPath; // 保存フォルダを設定 this.saveFolderPathTextBox.Text = saveFolderPath; // 製品名 AssemblyProductAttribute attribute = (AssemblyProductAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute)); this.nameValueLabel.Text = attribute.Product; // バージョン Assembly assembly = Assembly.GetExecutingAssembly(); this.versionValueLabel.Text = assembly.GetName().Version.ToString(); // 設定画面の最前面設定 this.TopMost = true; // 設定画面の表示 this.Visible = true; }
// 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); } }; }
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."); }
public HttpResponseMessage ServiceInfo() { Assembly ass = this.GetType().Assembly; AssemblyProductAttribute assPrd = ass.GetCustomAttributes(typeof(AssemblyProductAttribute), false).FirstOrDefault() as AssemblyProductAttribute; AssemblyInformationalVersionAttribute assInfVer = ass.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false).FirstOrDefault() as AssemblyInformationalVersionAttribute; AssemblyVersionAttribute assVer = ass.GetCustomAttributes(typeof(AssemblyVersionAttribute), false).FirstOrDefault() as AssemblyVersionAttribute; Entities.ServiceInfo svcInfo = new Entities.ServiceInfo(); svcInfo.ServiceName = assPrd == null ? "<n/a>" : assPrd.Product; svcInfo.ProductVersion = assInfVer == null ? "<n/a>" : assInfVer.InformationalVersion; svcInfo.BuildVersion = assVer == null ? "<n/a>" : assVer.Version; AppDomain.CurrentDomain.GetAssemblies().ToList() .Where(w => w.CodeBase.StartsWith(ass.CodeBase)) .ToList().ForEach(a => { svcInfo.AssemblyVersions.Add(new Entities.AssemblyVersion() { NameOfAssembly = a.GetName().FullName, VersionOfAssembly = a.ImageRuntimeVersion }); }); HttpResponseMessage msg = Request.CreateResponse <Entities.ServiceInfo>(System.Net.HttpStatusCode.OK, svcInfo); return(msg); }
static DumpLogHelper() { Assembly ass = Assembly.GetEntryAssembly(); if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) { Version netVer = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion; AssemblyLongVersionInfo = string.Format("{0}.{1}.{2}.{3}", netVer.Major, netVer.Minor, netVer.Build, netVer.Revision); } else { AssemblyName assName = ass.GetName(); AssemblyLongVersionInfo = string.Format("{0}.{1}.{2}.{3}", assName.Version.Major, assName.Version.Minor, assName.Version.Build, assName.Version.Revision); } object[] attribs = ass.GetCustomAttributes(typeof(AssemblyProductAttribute), false); if (attribs != null && attribs.Length > 0) { AssemblyProductAttribute attribProd = attribs[0] as AssemblyProductAttribute; if (attribProd != null) { AssemblyProductName = attribProd.Product; //AssemblyDisplayName = string.Format("{0} ({1})", AssemblyProductName, AssemblyShortVersionInfo); AssemblyDisplayName = string.Format("{0} ({1})", AssemblyProductName, AssemblyLongVersionInfo); } } }
private void FillCombos() { AssemblyProductAttribute myProduct = (AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute)); string appName = myProduct.Product; List <Perfil> perfiles = DAL.Login.Perfil.ObtenerPerfiles(appName); cmbPerfil.DisplayMember = "Descripcion"; cmbPerfil.ValueMember = "Codigo"; Perfil per = new DAL.Login.Perfil() { Codigo = 0, Descripcion = "Todos" }; cmbPerfil.Items.Add(per); if (perfiles != null && perfiles.Count > 0) { foreach (Perfil item in perfiles) { cmbPerfil.Items.Add(item); } } cmbPerfil.SelectedItem = per; }
public AssemblyProductAttributeTest() { //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(AssemblyProductAttribute); ConstructorInfo ctrInfo = attribute.GetConstructor( new Type [] { typeof(string) } ); CustomAttributeBuilder attrBuilder = new CustomAttributeBuilder(ctrInfo, new object [1] { "Mono" }); dynAssembly.SetCustomAttribute(attrBuilder); object [] attributes = dynAssembly.GetCustomAttributes(true); attr = attributes [0] as AssemblyProductAttribute; }
static EventLogMonitor() { Assembly myAssemb = Assembly.GetEntryAssembly();// bedziemy mieli jako zrodlo - dokladnie ta aplikacje - ktora wywoluje AssemblyProductAttribute progName = (AssemblyProductAttribute)Attribute.GetCustomAttribute(myAssemb, typeof(AssemblyProductAttribute), false); if (progName != null) { elSource = progName.Product; } else { elSource = myAssemb.FullName; } try { if (!EventLog.SourceExists(elSource)) { EventLog.CreateEventSource(elSource, elLogName); } } catch { } eventLog = new System.Diagnostics.EventLog(elLogName); ((System.ComponentModel.ISupportInitialize)(eventLog)).BeginInit(); eventLog.Source = elSource; ((System.ComponentModel.ISupportInitialize)(eventLog)).EndInit(); }//EventLogMonitor
// ****************************************************************** /// <summary> /// Reads the value of the <see cref="AssemblyProductAttribute"/> /// attribute for the given assembly. /// </summary> /// <param name="assembly">The assembly to read from.</param> /// <returns>The value of the given assembly's product attribute.</returns> public static string ReadProduct(this Assembly assembly) { // Attempt to read the assembly's product attribute. object[] attributes = assembly.GetCustomAttributes( typeof(AssemblyProductAttribute), true ); // Did we fail? if (attributes.Length == 0) { return(string.Empty); } // Attempt to recover a reference to the attribute. AssemblyProductAttribute attr = attributes[0] as AssemblyProductAttribute; // Did we fail? if (attr == null || attr.Product.Length == 0) { return(string.Empty); } // Return the text for the attribute. return(attr.Product); }
/// <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(); }
public static string GetAssemblyProduct() { Assembly assembly = HttpContext.Current.ApplicationInstance.GetType().BaseType.Assembly; AssemblyProductAttribute assemblyProductAttribut = (AssemblyProductAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyProductAttribute)); return(assemblyProductAttribut.Product); }
public string ReadAssemblyProduct() { Type t = typeof(Program); AssemblyProductAttribute productAttr = t.Assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), true)[0] as AssemblyProductAttribute; return(productAttr.Product); }
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(); }
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; }
/// <summary> /// Creates foldername (in user's ApplicationData) where configuration /// is stored. /// </summary> /// <returns> /// Path to the folder with configuration file. /// </returns> public static string GetConfigurationFolder() { string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string appName = ((AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute))).Product; return(Path.Combine(appDataPath, appName)); }
public ProxyDialog() { InitializeComponent(); Assembly asm = Assembly.GetCallingAssembly(); optCurrentAppProxies.Text = ((AssemblyProductAttribute)AssemblyProductAttribute.GetCustomAttribute(asm, typeof(AssemblyProductAttribute))).Product + " Proxies"; }
private void ShowVersion() { AssemblyCompanyAttribute objCompany = (AssemblyCompanyAttribute) AssemblyCompanyAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCompanyAttribute)); AssemblyDescriptionAttribute objDescription = (AssemblyDescriptionAttribute) AssemblyDescriptionAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute)); AssemblyProductAttribute objProduct = (AssemblyProductAttribute) AssemblyProductAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute)); AssemblyTitleAttribute objTitle = (AssemblyTitleAttribute) AssemblyTitleAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute)); /* * AssemblyVersionAttribute objVersion = (AssemblyVersionAttribute) * AssemblyVersionAttribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), * typeof(AssemblyVersionAttribute)); */ StringBuilder sb = new StringBuilder(); sb.Append("Product: "); sb.AppendLine(objProduct.Product); sb.Append("Title: "); sb.AppendLine(objTitle.Title); sb.Append("Company: "); sb.AppendLine(objCompany.Company); sb.Append("Description: "); sb.AppendLine(objDescription.Description); sb.Append("Version: "); sb.AppendLine(Assembly.GetExecutingAssembly().GetName().Version.ToString()); this.AboutText.Text = sb.ToString(); }
public ExportHelper() { Assembly assembly = Assembly.GetExecutingAssembly(); _companyAttribute = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute)); _productAttribute = (AssemblyProductAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyProductAttribute)); }
private void InitializeProperties() { StatusBarIsVisible = Visibility.Hidden; Assembly assembly = Assembly.GetExecutingAssembly(); object[] titleAttr = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false); if (titleAttr.Length > 0) { AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)titleAttr[0]; if (!string.IsNullOrEmpty(titleAttribute.Title)) { Title = String.Format("About {0}", titleAttribute.Title); } } object[] productAttr = assembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false); if (productAttr.Length > 0) { AssemblyProductAttribute productAttribute = (AssemblyProductAttribute)productAttr[0]; if (!string.IsNullOrEmpty(productAttribute.Product)) { ProductName = productAttribute.Product; } } Version = assembly.GetName().Version.ToString(); object[] copyrightAttr = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); if (copyrightAttr.Length > 0) { AssemblyCopyrightAttribute copyrightAttribute = (AssemblyCopyrightAttribute)copyrightAttr[0]; if (!string.IsNullOrEmpty(copyrightAttribute.Copyright)) { Copyright = copyrightAttribute.Copyright; } } object[] descriptionAttr = assembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); if (descriptionAttr.Length > 0) { AssemblyDescriptionAttribute descriptionAttribute = (AssemblyDescriptionAttribute)descriptionAttr[0]; if (!string.IsNullOrEmpty(descriptionAttribute.Description)) { Description = descriptionAttribute.Description; } } object[] companyAttr = assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); if (companyAttr.Length > 0) { AssemblyCompanyAttribute companyAttribute = (AssemblyCompanyAttribute)companyAttr[0]; if (!string.IsNullOrEmpty(companyAttribute.Company)) { companyName = companyAttribute.Company; } } ITextSharpVersion = iTextSharp.text.Version.GetInstance().GetVersion; }
void DocumentEvents_DocumentClose(object sender, DocumentEventArgs e) { // TODO: Find a better way AssemblyProductAttribute product = (AssemblyProductAttribute) Attribute.GetCustomAttribute(Assembly.GetEntryAssembly(), typeof(AssemblyProductAttribute)); Text = product.Product; }
public string GetProductName() { AssemblyProductAttribute assemblyProductAttribute = assembly.GetCustomAttributes(typeof(AssemblyProductAttribute)) .Cast <AssemblyProductAttribute>() .FirstOrDefault(); return(assemblyProductAttribute?.Product); }
void DocumentEvents_DocumentShow(object sender, DocumentEventArgs e) { // TODO: Find a better way AssemblyProductAttribute product = (AssemblyProductAttribute) Attribute.GetCustomAttribute(Assembly.GetEntryAssembly(), typeof(AssemblyProductAttribute)); Text = String.Format("{0} - {1}", product.Product, Path.GetFileName(e.Item.Filename)); }