private static void UpdateBurnResources(string bundleTempPath, string outputPath, WixBundleSymbol bundleInfo, Version windowsAssemblyVersion, byte[] applicationManifestData) { const int burnLocale = 1033; var resources = new Dtf.Resources.ResourceCollection(); var version = new Dtf.Resources.VersionResource("#1", burnLocale); version.Load(bundleTempPath); resources.Add(version); version.FileVersion = windowsAssemblyVersion; version.ProductVersion = windowsAssemblyVersion; var strings = version[burnLocale] ?? version.Add(burnLocale); strings["LegalCopyright"] = bundleInfo.Copyright; strings["OriginalFilename"] = Path.GetFileName(outputPath); strings["FileVersion"] = bundleInfo.Version; // string versions do not have to be four parts. strings["ProductVersion"] = bundleInfo.Version; // string versions do not have to be four parts. if (!String.IsNullOrEmpty(bundleInfo.Name)) { strings["ProductName"] = bundleInfo.Name; strings["FileDescription"] = bundleInfo.Name; } if (!String.IsNullOrEmpty(bundleInfo.Manufacturer)) { strings["CompanyName"] = bundleInfo.Manufacturer; } else { strings["CompanyName"] = String.Empty; } if (!String.IsNullOrEmpty(bundleInfo.IconSourceFile)) { var iconGroup = new Dtf.Resources.GroupIconResource("#1", burnLocale); iconGroup.ReadFromFile(bundleInfo.IconSourceFile); resources.Add(iconGroup); foreach (var icon in iconGroup.Icons) { resources.Add(icon); } } if (!String.IsNullOrEmpty(bundleInfo.SplashScreenSourceFile)) { var bitmap = new Dtf.Resources.BitmapResource("#1", burnLocale); bitmap.ReadFromFile(bundleInfo.SplashScreenSourceFile); resources.Add(bitmap); } var manifestResource = new Resource(ResourceType.Manifest, "#1", burnLocale, applicationManifestData); resources.Add(manifestResource); resources.Save(bundleTempPath); }
private void UpdateBurnResources(string bundleTempPath, string outputPath, WixBundleSymbol bundleInfo) { var resources = new Dtf.Resources.ResourceCollection(); var version = new Dtf.Resources.VersionResource("#1", 1033); version.Load(bundleTempPath); resources.Add(version); // Ensure the bundle info provides a full four part version. var fourPartVersion = new Version(bundleInfo.Version); var major = (fourPartVersion.Major < 0) ? 0 : fourPartVersion.Major; var minor = (fourPartVersion.Minor < 0) ? 0 : fourPartVersion.Minor; var build = (fourPartVersion.Build < 0) ? 0 : fourPartVersion.Build; var revision = (fourPartVersion.Revision < 0) ? 0 : fourPartVersion.Revision; if (UInt16.MaxValue < major || UInt16.MaxValue < minor || UInt16.MaxValue < build || UInt16.MaxValue < revision) { throw new WixException(ErrorMessages.InvalidModuleOrBundleVersion(bundleInfo.SourceLineNumbers, "Bundle", bundleInfo.Version)); } fourPartVersion = new Version(major, minor, build, revision); version.FileVersion = fourPartVersion; version.ProductVersion = fourPartVersion; var strings = version[1033] ?? version.Add(1033); strings["LegalCopyright"] = bundleInfo.Copyright; strings["OriginalFilename"] = Path.GetFileName(outputPath); strings["FileVersion"] = bundleInfo.Version; // string versions do not have to be four parts. strings["ProductVersion"] = bundleInfo.Version; // string versions do not have to be four parts. if (!String.IsNullOrEmpty(bundleInfo.Name)) { strings["ProductName"] = bundleInfo.Name; strings["FileDescription"] = bundleInfo.Name; } if (!String.IsNullOrEmpty(bundleInfo.Manufacturer)) { strings["CompanyName"] = bundleInfo.Manufacturer; } else { strings["CompanyName"] = String.Empty; } if (!String.IsNullOrEmpty(bundleInfo.IconSourceFile)) { var iconGroup = new Dtf.Resources.GroupIconResource("#1", 1033); iconGroup.ReadFromFile(bundleInfo.IconSourceFile); resources.Add(iconGroup); foreach (var icon in iconGroup.Icons) { resources.Add(icon); } } if (!String.IsNullOrEmpty(bundleInfo.SplashScreenSourceFile)) { var bitmap = new Dtf.Resources.BitmapResource("#1", 1033); bitmap.ReadFromFile(bundleInfo.SplashScreenSourceFile); resources.Add(bitmap); } resources.Save(bundleTempPath); }