// public virtual bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy) public override bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy) { string ApplicationIconPath = Path.Combine(ProjectDirectory, "Build/Windows/Application.ico"); // Does a Project icon exist? if (!File.Exists(ApplicationIconPath)) { // Also check for legacy location ApplicationIconPath = Path.Combine(ProjectDirectory, "Source", ProjectName, "Resources", "Windows", ProjectName + ".ico"); if (!File.Exists(ApplicationIconPath)) { // point to the default UE4 icon instead ApplicationIconPath = Path.Combine(EngineDirectory, "Source/Runtime/Launch/Resources/Windows/UE4.ico"); } } // sets the icon on the original exe this will be used in the task bar when the bootstrap exe runs if (File.Exists(ApplicationIconPath)) { GroupIconResource GroupIcon = null; GroupIcon = GroupIconResource.FromIco(ApplicationIconPath); // Update the icon on the original exe because this will be used when the game is running in the task bar using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath, false)) { const int IconResourceId = 123; // As defined in Engine\Source\Runtime\Launch\Resources\Windows\resource.h if (GroupIcon != null) { Update.SetIcons(IconResourceId, GroupIcon); } } } return(true); }
public override void Package(ProjectParams Params, DeploymentContext SC, int WorkingCL) { // If this is a content-only project and there's a custom icon, update the executable if (!Params.HasDLCName && !Params.IsCodeBasedProject) { FileReference IconFile = FileReference.Combine(Params.RawProjectPath.Directory, "Build", "Windows", "Application.ico"); if (FileReference.Exists(IconFile)) { CommandUtils.LogInformation("Updating executable with custom icon from {0}", IconFile); GroupIconResource GroupIcon = GroupIconResource.FromIco(IconFile.FullName); List <FileReference> ExecutablePaths = GetExecutableNames(SC); foreach (FileReference ExecutablePath in ExecutablePaths) { using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath.FullName, false)) { const int IconResourceId = 123; // As defined in Engine\Source\Runtime\Launch\Resources\Windows\resource.h if (GroupIcon != null) { Update.SetIcons(IconResourceId, GroupIcon); } } } } } PrintRunTime(); }
public void SetIcons(int ResourceId, GroupIconResource GroupIcon) { // Write the icon group resource SetData(ResourceId, ResourceType.GroupIcon, GroupIcon.ToByteArray()); // Write the individual icons for (int Idx = 0; Idx < GroupIcon.Icons.Length; Idx++) { SetData(Idx + 1, ResourceType.Icon, GroupIcon.Icons[Idx].Data); } }
void StageBootstrapExecutable(DeploymentContext SC, string ExeName, string TargetFile, string StagedRelativeTargetPath, string StagedArguments) { string InputFile = CombinePaths(SC.LocalRoot, "Engine", "Binaries", SC.PlatformDir, String.Format("BootstrapPackagedGame-{0}-Shipping.exe", SC.PlatformDir)); if (InternalUtils.SafeFileExists(InputFile)) { // Create the new bootstrap program string IntermediateDir = CombinePaths(SC.ProjectRoot, "Intermediate", "Staging"); InternalUtils.SafeCreateDirectory(IntermediateDir); string IntermediateFile = CombinePaths(IntermediateDir, ExeName); CommandUtils.CopyFile(InputFile, IntermediateFile); CommandUtils.SetFileAttributes(IntermediateFile, ReadOnly: false); // currently the icon updating doesn't run under mono if (UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 || UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32) { // Get the icon from the build directory if possible GroupIconResource GroupIcon = null; if (InternalUtils.SafeFileExists(CombinePaths(SC.ProjectRoot, "Build/Windows/Application.ico"))) { GroupIcon = GroupIconResource.FromIco(CombinePaths(SC.ProjectRoot, "Build/Windows/Application.ico")); } if (GroupIcon == null) { GroupIcon = GroupIconResource.FromExe(TargetFile); } // Update the resources in the new file using (ModuleResourceUpdate Update = new ModuleResourceUpdate(IntermediateFile, true)) { const int IconResourceId = 101; if (GroupIcon != null) { Update.SetIcons(IconResourceId, GroupIcon); } const int ExecFileResourceId = 201; Update.SetData(ExecFileResourceId, ResourceType.RawData, Encoding.Unicode.GetBytes(StagedRelativeTargetPath + "\0")); const int ExecArgsResourceId = 202; Update.SetData(ExecArgsResourceId, ResourceType.RawData, Encoding.Unicode.GetBytes(StagedArguments + "\0")); } } // Copy it to the staging directory SC.StageFiles(StagedFileType.NonUFS, IntermediateDir, ExeName, false, null, ""); } }
// public virtual bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy) public override bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, string ExecutablePath, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy) { // set the icon on the original exe this will be used in the task bar when the bootstrap exe runs if (File.Exists(Path.Combine(ProjectDirectory, "Build/Windows/Application.ico"))) { GroupIconResource GroupIcon = null; GroupIcon = GroupIconResource.FromIco(Path.Combine(ProjectDirectory, "Build/Windows/Application.ico")); // Update the icon on the original exe because this will be used when the game is running in the task bar using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath, false)) { const int IconResourceId = 101; if (GroupIcon != null) { Update.SetIcons(IconResourceId, GroupIcon); } } } return(true); }
public bool SetApplicationIcon(FileReference ProjectFile, string ProjectName, string ProjectDirectory, List <UnrealTargetConfiguration> TargetConfigurations, List <string> ExecutablePaths, string EngineDirectory) { string ApplicationIconPath = Path.Combine(ProjectDirectory, "Build/Windows/Application.ico"); // Does a Project icon exist? if (!File.Exists(ApplicationIconPath)) { // Also check for legacy location ApplicationIconPath = Path.Combine(ProjectDirectory, "Source", ProjectName, "Resources", "Windows", ProjectName + ".ico"); if (!File.Exists(ApplicationIconPath)) { // point to the default UE4 icon instead ApplicationIconPath = Path.Combine(EngineDirectory, "Source/Runtime/Launch/Resources/Windows/UE4.ico"); } } // sets the icon on the original exe this will be used in the task bar when the bootstrap exe runs if (File.Exists(ApplicationIconPath)) { GroupIconResource GroupIcon = null; GroupIcon = GroupIconResource.FromIco(ApplicationIconPath); foreach (string ExecutablePath in ExecutablePaths) { // Update the icon on the original exe because this will be used when the game is running in the task bar using (ModuleResourceUpdate Update = new ModuleResourceUpdate(ExecutablePath, false)) { const int IconResourceId = 123; // As defined in Engine\Source\Runtime\Launch\Resources\Windows\resource.h if (GroupIcon != null) { Update.SetIcons(IconResourceId, GroupIcon); } } } } return(true); }
public void SetIcons(int ResourceId, GroupIconResource GroupIcon) { // Write the icon group resource SetData(ResourceId, ResourceType.GroupIcon, GroupIcon.ToByteArray()); // Write the individual icons for(int Idx = 0; Idx < GroupIcon.Icons.Length; Idx++) { SetData(Idx + 1, ResourceType.Icon, GroupIcon.Icons[Idx].Data); } }
private void btnBuild_Click(object sender, EventArgs e) { lblBStatus.Text = ""; new System.Threading.Thread(() => { updateBStatus("Building ..."); byte[] createServer = Properties.Resources.server; string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, txtOFN.Text); try { File.WriteAllBytes(path, createServer); updateBStatus("File Created: " + txtOFN.Text); AssemblyDefinition asmDefinition = AssemblyDefinition.ReadAssembly(path); if (cbNoIP.Checked) { noIP = "yes"; ReplaceString("noip", noIP, asmDefinition); updateBStatus("Setting Up No-IP Host Address: " + txtIPAddress.Text); } else { noIP = "no"; ReplaceString("noip", noIP, asmDefinition); updateBStatus("Setting Up IP-Address: " + txtIPAddress.Text); } ReplaceString("ip", txtIPAddress.Text, asmDefinition); ReplaceString("port", nudPort.Value.ToString(), asmDefinition); updateBStatus("Setting Up Port-Number: " + nudPort.Value); ReplaceString("delay", nudDelay.Value.ToString(), asmDefinition); updateBStatus("Setting Up Reconnect-Delay: " + nudDelay.Value + " ms"); asmDefinition.Write(path); updateBStatus("Settings Completed."); char n = '\0'; VersionResource oVersionResource = new VersionResource(); oVersionResource.LoadFrom(path); oVersionResource.FileVersion = txtFV1.Text + "." + txtFV2.Text + "." + txtFV3.Text + "." + txtFV4.Text; //txtFilev.Text; 14,13,12,5 oVersionResource.ProductVersion = txtPV1.Text + "." + txtPV2.Text + "." + txtPV3.Text + "." + txtPV4.Text; // txtProductv.Text; 6,,9,10,11 StringFileInfo oStringFileInfo = (StringFileInfo)oVersionResource["StringFileInfo"]; updateBStatus("Adding Assembly Information: " + txtOFN.Text); oStringFileInfo["OriginalFilename"] = txtOFN.Text + n; oStringFileInfo["FileVersion"] = oVersionResource.FileVersion + n; oStringFileInfo["ProductName"] = txtPN.Text + n; oStringFileInfo["ProductVersion"] = oVersionResource.ProductVersion + n; oStringFileInfo["Assembly Version"] = oVersionResource.ProductVersion + n; oStringFileInfo["LegalCopyright"] = txtLC.Text + n; oStringFileInfo["FileDescription"] = txtFD.Text + n; oVersionResource.SaveTo(path); updateBStatus("Assembly Information Added."); if (!string.IsNullOrEmpty(iconPath)) { updateBStatus("Icon Added: " + iconPath); IconFile icon = new IconFile(iconPath); GroupIconResource gr = icon.ConvertToGroupIconResource(); gr.SaveTo(txtOFN.Text); } updateBStatus(txtOFN.Text + " Created Successfully."); updateBStatus("Building Completed."); //File.Delete(txtOFN.Text); } catch (Exception error) { MessageBox.Show(error.Message, "Builder", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }).Start(); }