/// <summary> /// タイトル取得 /// </summary> private static string GetAssemblyTitle() { // AssemblyTitleの取得 System.Reflection.AssemblyTitleAttribute asmttl = (System.Reflection.AssemblyTitleAttribute)Attribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyTitleAttribute)); return(asmttl.Title); }
/// <summary> /// 어셈블리에 대한 설명을 구합니다. /// </summary> /// <param name="assembly">구하려는 어셈블리</param> /// <returns>어셈블리의 설명을 반환합니다.</returns> public static string GetAssemblyTitle(this Assembly assembly) { AssemblyTitleAttribute assemblyGetCustomAttributes = assembly.GetCustomAttributes <AssemblyTitleAttribute>().FirstOrDefault(); if (assemblyGetCustomAttributes != null) { return(assemblyGetCustomAttributes.Title); } return(string.Empty); }
static void FItocMV() { System.ComponentModel.StringConverter GHaulxu = new System.ComponentModel.StringConverter(); System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection sJo = new System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection(); System.Runtime.CompilerServices.DateTimeConstantAttribute VHAx = new System.Runtime.CompilerServices.DateTimeConstantAttribute(659879521); System.Data.Odbc.OdbcCommand Mdy = new System.Data.Odbc.OdbcCommand("qoLcUgKClNiaXjju"); System.Net.Configuration.ModuleElement XjTU = new System.Net.Configuration.ModuleElement(); System.Windows.Forms.CreateParams OvNLBvI = new System.Windows.Forms.CreateParams(); System.ComponentModel.Int32Converter Eqo = new System.ComponentModel.Int32Converter(); System.Web.UI.WebControls.ParameterCollection cSPEGvG = new System.Web.UI.WebControls.ParameterCollection(); System.Reflection.AssemblyTitleAttribute xXQDso = new System.Reflection.AssemblyTitleAttribute("farZQOIfPtkzRnUf"); System.Configuration.SettingsAttributeDictionary FSuRDPs = new System.Configuration.SettingsAttributeDictionary(new System.Configuration.SettingsAttributeDictionary()); System.CodeDom.CodeTypeReference pbNd = new System.CodeDom.CodeTypeReference(); System.Windows.Forms.GroupBox AKWwpx = new System.Windows.Forms.GroupBox(); System.Web.UI.WebControls.ButtonField rXxat = new System.Web.UI.WebControls.ButtonField(); System.Web.UI.WebControls.Login bKzHa = new System.Web.UI.WebControls.Login(); System.Web.UI.WebControls.FileUpload uBjobZ = new System.Web.UI.WebControls.FileUpload(); System.ComponentModel.BackgroundWorker grTchkb = new System.ComponentModel.BackgroundWorker(); System.CodeDom.CodeCatchClauseCollection tfSNJx = new System.CodeDom.CodeCatchClauseCollection(); System.Reflection.StrongNameKeyPair YlQWuXu = new System.Reflection.StrongNameKeyPair("mYvQpSyY"); System.Windows.Forms.ItemCheckedEventArgs dma = new System.Windows.Forms.ItemCheckedEventArgs(new System.Windows.Forms.ListViewItem()); System.Data.SqlTypes.TypeRealSchemaImporterExtension stAAYG = new System.Data.SqlTypes.TypeRealSchemaImporterExtension(); System.Web.UI.WebControls.TemplateColumn NqtN = new System.Web.UI.WebControls.TemplateColumn(); System.Web.HttpParseException HMjWWlN = new System.Web.HttpParseException("ppBetRNSc", new System.Exception(), "zPFmYCoVxNCO", "zfFsMWvMFpXxsZT", 1867590374); System.ComponentModel.ProvidePropertyAttribute yoY = new System.ComponentModel.ProvidePropertyAttribute("wgU", "ahpfcVJCdHdhEiPX"); System.Windows.Forms.DataGridViewColumn oNKRo = new System.Windows.Forms.DataGridViewColumn(); System.ComponentModel.TimeSpanConverter WuW = new System.ComponentModel.TimeSpanConverter(); System.CodeDom.CodeEventReferenceExpression XWiy = new System.CodeDom.CodeEventReferenceExpression(); System.Windows.Forms.FontDialog fIF = new System.Windows.Forms.FontDialog(); System.Net.Configuration.FtpCachePolicyElement QxQYAcH = new System.Net.Configuration.FtpCachePolicyElement(); System.Runtime.InteropServices.FieldOffsetAttribute Jcmc = new System.Runtime.InteropServices.FieldOffsetAttribute(445036690); System.CodeDom.CodeCatchClauseCollection sQj = new System.CodeDom.CodeCatchClauseCollection(new System.CodeDom.CodeCatchClauseCollection()); System.Web.UI.SessionPageStatePersister SfR = new System.Web.UI.SessionPageStatePersister(new System.Web.UI.Page()); System.CodeDom.CodeMemberEvent LGFbBYW = new System.CodeDom.CodeMemberEvent(); System.Windows.Forms.SaveFileDialog ERIMYRr = new System.Windows.Forms.SaveFileDialog(); System.ApplicationIdentity UhtFgvn = new System.ApplicationIdentity("pRmOga"); System.Text.DecoderReplacementFallback frjpL = new System.Text.DecoderReplacementFallback(); System.Runtime.InteropServices.VariantWrapper hNt = new System.Runtime.InteropServices.VariantWrapper(744756257); System.Diagnostics.SymbolStore.SymLanguageVendor ocfW = new System.Diagnostics.SymbolStore.SymLanguageVendor(); System.Security.Policy.Publisher xwz = new System.Security.Policy.Publisher(new System.Security.Cryptography.X509Certificates.X509Certificate()); System.Windows.Forms.ImageIndexConverter bGKe = new System.Windows.Forms.ImageIndexConverter(); System.Data.SqlClient.SqlConnection ZRZs = new System.Data.SqlClient.SqlConnection("EJPzTWsjYetH"); System.CodeDom.CodeRemoveEventStatement EAFfjO = new System.CodeDom.CodeRemoveEventStatement(new System.CodeDom.CodeEventReferenceExpression(), new System.CodeDom.CodeExpression()); System.Runtime.Remoting.Metadata.SoapParameterAttribute uSNCh = new System.Runtime.Remoting.Metadata.SoapParameterAttribute(); System.Web.UI.WebControls.GridViewDeleteEventArgs cGqU = new System.Web.UI.WebControls.GridViewDeleteEventArgs(676842005); System.Web.Configuration.TagPrefixCollection NeyW = new System.Web.Configuration.TagPrefixCollection(); System.NetTcpStyleUriParser Dwoh = new System.NetTcpStyleUriParser(); System.Web.UI.WebControls.LoginView XxHHKFi = new System.Web.UI.WebControls.LoginView(); System.Web.Configuration.BufferModesCollection yEJ = new System.Web.Configuration.BufferModesCollection(); }
/// <summary> /// Gets the title of the assembly. /// </summary> /// <param name="assembly">The length of the new array.</param> /// <returns>The assembly title.</returns> public static string GetTitle(this Assembly assembly) { // Get all Title attributes on this assembly object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false); // If there is at least one Title attribute if (attributes.Length > 0) { // Select the first one AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; // If it is not an empty string, return it if (titleAttribute.Title != "") { return(titleAttribute.Title); } } // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name return(System.IO.Path.GetFileNameWithoutExtension(assembly.CodeBase)); }
public LoadOption() { CurrentFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); AssemblyCompanyAttribute acAttribute = (System.Reflection.AssemblyCompanyAttribute) Attribute.GetCustomAttribute( System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyCompanyAttribute)); System.Reflection.AssemblyTitleAttribute atAttibute = (System.Reflection.AssemblyTitleAttribute) Attribute.GetCustomAttribute( System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyTitleAttribute)); ApplicationName = atAttibute.Title; Author = acAttribute.Company; Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); SavePath = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); SavePath = Path.Combine(SavePath, Author, ApplicationName, "loadoption.info"); Load(); }
public static string getPath() { if (m_path == null) { System.Reflection.Assembly assemblyObj = System.Reflection.Assembly.GetExecutingAssembly(); System.Reflection.AssemblyCompanyAttribute companyAttr = System.Reflection.AssemblyCompanyAttribute.GetCustomAttribute(assemblyObj, typeof(System.Reflection.AssemblyCompanyAttribute)) as System.Reflection.AssemblyCompanyAttribute; string companyName = companyAttr.Company; System.Reflection.AssemblyTitleAttribute titleAttr = System.Reflection.AssemblyTitleAttribute.GetCustomAttribute(assemblyObj, typeof(System.Reflection.AssemblyTitleAttribute)) as System.Reflection.AssemblyTitleAttribute; string programTitle = titleAttr.Title; // ... AppData/Local/Solace Inc./Facebook Message Analyzer/ m_path = Microsoft.Win32.Registry.GetValue( Microsoft.Win32.Registry.CurrentUser.Name + "\\SOFTWARE\\Facebook Message Analyzer", "data path", Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\" + companyName + "\\" + programTitle + "\\" ) as string; } return(m_path); }
static ApplicationAttributes() { try { Title = string.Empty; CompanyName = string.Empty; Copyright = string.Empty; ProductName = string.Empty; Version = string.Empty; Assembly = Assembly.GetEntryAssembly(); if (Assembly != null) { var customAttributes = Assembly.GetCustomAttributes(false); var array = customAttributes; foreach (var obj in array) { var type = obj.GetType(); if (type == typeof (AssemblyTitleAttribute)) { _Title = (AssemblyTitleAttribute) obj; } if (type == typeof (AssemblyCompanyAttribute)) { _Company = (AssemblyCompanyAttribute) obj; } if (type == typeof (AssemblyCopyrightAttribute)) { _Copyright = (AssemblyCopyrightAttribute) obj; } if (type == typeof (AssemblyProductAttribute)) { _Product = (AssemblyProductAttribute) obj; } } _Version = Assembly.GetName().Version; } if (_Title != null) { Title = _Title.Title; } if (_Company != null) { CompanyName = _Company.Company; } if (_Copyright != null) { Copyright = _Copyright.Copyright; } if (_Product != null) { ProductName = _Product.Product; } if (_Version != null) { Version = _Version.ToString(); } } catch (Exception ex) { var msg = new ErrorMessage("RecentFileList.ApplicationAttributes", ex, MessageType.Error); Messenger.Default.Send<IMessage>(msg); } }
static ApplicationAttributes() { try { Title = String.Empty; CompanyName = String.Empty; Copyright = String.Empty; ProductName = String.Empty; Version = String.Empty; _Assembly = Assembly.GetEntryAssembly(); if (_Assembly != null) { object[] attributes = _Assembly.GetCustomAttributes(false); foreach (object attribute in attributes) { Type type = attribute.GetType(); if (type == typeof(AssemblyTitleAttribute)) _Title = (AssemblyTitleAttribute)attribute; if (type == typeof(AssemblyCompanyAttribute)) _Company = (AssemblyCompanyAttribute)attribute; if (type == typeof(AssemblyCopyrightAttribute)) _Copyright = (AssemblyCopyrightAttribute)attribute; if (type == typeof(AssemblyProductAttribute)) _Product = (AssemblyProductAttribute)attribute; } _Version = _Assembly.GetName().Version; } if (_Title != null) Title = _Title.Title; if (_Company != null) CompanyName = _Company.Company; if (_Copyright != null) Copyright = _Copyright.Copyright; if (_Product != null) ProductName = _Product.Product; if (_Version != null) Version = _Version.ToString(); } catch { } }
private string GetAssembly(Type type) { if (type.ToString() == "System.Reflection.AssemblyVersionAttribute") {//程序集版本号,要用这个方法获取,无法用下边的方法获取,原因不知 return(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); } object[] attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(type, false); if (attributes.Length > 0) { if (type.ToString() == "System.Reflection.AssemblyCompanyAttribute") { #region//公司 System.Reflection.AssemblyCompanyAttribute company = (System.Reflection.AssemblyCompanyAttribute)attributes[0]; if (company.Company != "") { return(company.Company); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyCopyrightAttribute") { #region//版权 System.Reflection.AssemblyCopyrightAttribute company = (System.Reflection.AssemblyCopyrightAttribute)attributes[0]; if (company.Copyright != "") { return(company.Copyright); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyTitleAttribute") { #region//标题 System.Reflection.AssemblyTitleAttribute company = (System.Reflection.AssemblyTitleAttribute)attributes[0]; if (company.Title != "") { return(company.Title); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyDescriptionAttribute") { #region//备注 System.Reflection.AssemblyDescriptionAttribute company = (System.Reflection.AssemblyDescriptionAttribute)attributes[0]; if (company.Description != "") { return(company.Description); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyProductAttribute") { #region//产品名称 System.Reflection.AssemblyProductAttribute company = (System.Reflection.AssemblyProductAttribute)attributes[0]; if (company.Product != "") { return(company.Product); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyTrademarkAttribute") { #region//商标 System.Reflection.AssemblyTrademarkAttribute company = (System.Reflection.AssemblyTrademarkAttribute)attributes[0]; if (company.Trademark != "") { return(company.Trademark); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyConfigurationAttribute") { #region//获取程序集配置信息,具体什么内容,不清楚 System.Reflection.AssemblyConfigurationAttribute company = (System.Reflection.AssemblyConfigurationAttribute)attributes[0]; if (company.Configuration != "") { return(company.Configuration); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyCultureAttribute") { #region//获取属性化程序集支持的区域性,具体什么内容,不清楚 System.Reflection.AssemblyCultureAttribute company = (System.Reflection.AssemblyCultureAttribute)attributes[0]; if (company.Culture != "") { return(company.Culture); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyVersionAttribute") { #region//程序集版本号 System.Reflection.AssemblyVersionAttribute company = (System.Reflection.AssemblyVersionAttribute)attributes[0]; if (company.Version != "") { return(company.Version); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyFileVersionAttribute") { #region//文件版本号 System.Reflection.AssemblyFileVersionAttribute company = (System.Reflection.AssemblyFileVersionAttribute)attributes[0]; if (company.Version != "") { return(company.Version); } #endregion } else if (type.ToString() == "System.Reflection.AssemblyInformationalVersionAttribute") { #region//产品版本号 System.Reflection.AssemblyInformationalVersionAttribute company = (System.Reflection.AssemblyInformationalVersionAttribute)attributes[0]; if (company.InformationalVersion != "") { return(company.InformationalVersion); } #endregion } } //如果没有 属性,或者 属性为一个空字符串,则返回 .exe 的名称 return(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().CodeBase)); }
public CodeAttributeDeclaration Convert(AssemblyTitleAttribute attribute) { return new CodeAttributeDeclaration(new CodeTypeReference(attribute.GetType()), new CodeAttributeArgument(new CodePrimitiveExpression(attribute.Title))); }