コード例 #1
0
        public static string ReplacePlaceholders(string original, Assembly assembly)
        {
            if (null != assembly)
            {
                FileVersionInfo fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location);

                original = original.Replace("[FileComments]", fileVersion.Comments);
                original = original.Replace("[FileCopyright]", fileVersion.LegalCopyright);
                original = original.Replace("[FileProductName]", fileVersion.ProductName);
                original = original.Replace("[FileVersion]", fileVersion.FileVersion);

                if (original.Contains("[FileVersionMajorMinor]"))
                {
                    Version version = new Version(fileVersion.FileVersion);
                    original = original.Replace("[FileVersionMajorMinor]", String.Concat(version.Major, ".", version.Minor));
                }

                AssemblyCompanyAttribute company;
                if (WixDistribution.TryGetAttribute(assembly, out company))
                {
                    original = original.Replace("[AssemblyCompany]", company.Company);
                }

                AssemblyCopyrightAttribute copyright;
                if (WixDistribution.TryGetAttribute(assembly, out copyright))
                {
                    original = original.Replace("[AssemblyCopyright]", copyright.Copyright);
                }

                AssemblyDescriptionAttribute description;
                if (WixDistribution.TryGetAttribute(assembly, out description))
                {
                    original = original.Replace("[AssemblyDescription]", description.Description);
                }

                AssemblyProductAttribute product;
                if (WixDistribution.TryGetAttribute(assembly, out product))
                {
                    original = original.Replace("[AssemblyProduct]", product.Product);
                }

                AssemblyTitleAttribute title;
                if (WixDistribution.TryGetAttribute(assembly, out title))
                {
                    original = original.Replace("[AssemblyTitle]", title.Title);
                }
            }

            original = original.Replace("[NewsUrl]", WixDistribution.NewsUrl);
            original = original.Replace("[ShortProduct]", WixDistribution.ShortProduct);
            original = original.Replace("[SupportUrl]", WixDistribution.SupportUrl);
            return(original);
        }
コード例 #2
0
ファイル: AppCommon.cs プロジェクト: jeason0813/Core
        /// <summary>
        /// Displays help message header on Console for caller tool.
        /// </summary>
        public static void DisplayToolFooter()
        {
            var assembly = Assembly.GetCallingAssembly();

            Console.Write(WixDistribution.ReplacePlaceholders("\r\nFor more information see: [SupportUrl]", assembly));
        }
コード例 #3
0
ファイル: AppCommon.cs プロジェクト: jeason0813/Core
        /// <summary>
        /// Displays help message header on Console for caller tool.
        /// </summary>
        public static void DisplayToolHeader()
        {
            var assembly = Assembly.GetCallingAssembly();

            Console.WriteLine(WixDistribution.ReplacePlaceholders("[AssemblyProduct] [AssemblyDescription] version [FileVersion]\r\n[AssemblyCopyright]", assembly));
        }
コード例 #4
0
ファイル: AppCommon.cs プロジェクト: jeason0813/Core
        /// <summary>
        /// Creates and returns the string for CreatingApplication field (MSI Summary Information Stream).
        /// </summary>
        /// <remarks>It reads the AssemblyProductAttribute and AssemblyVersionAttribute of executing assembly
        /// and builds the CreatingApplication string of the form "[ProductName] ([ProductVersion])".</remarks>
        /// <returns>Returns value for PID_APPNAME."</returns>
        public static string GetCreatingApplicationString()
        {
            var assembly = Assembly.GetExecutingAssembly();

            return(WixDistribution.ReplacePlaceholders("[AssemblyProduct] ([FileVersion])", assembly));
        }
コード例 #5
0
        /// <summary>
        /// Displays help message header on Console for caller tool.
        /// </summary>
        public static void DisplayToolHeader()
        {
            Assembly assembly = Assembly.GetCallingAssembly();

            Console.WriteLine(WixDistribution.ReplacePlaceholders(WixDistributionSpecificStrings.ToolsetHelpHeader, assembly));
        }
コード例 #6
0
 /// <summary>
 /// Displays help message header on Console for caller tool.
 /// </summary>
 public static void DisplayToolFooter()
 {
     Console.Write(WixDistribution.ReplacePlaceholders(WixDistributionSpecificStrings.ToolsetHelpFooter, null));
 }