AGS.Editor.BuildTargetWindows.CreateCompiledSetupProgram C# (CSharp) Метод

CreateCompiledSetupProgram() публичный Метод

public CreateCompiledSetupProgram ( ) : void
Результат void
        public void CreateCompiledSetupProgram()
        {
            string setupFileName = GetCompiledPath(AGSEditor.COMPILED_SETUP_FILE_NAME);
            Resources.ResourceManager.CopyFileFromResourcesToDisk(AGSEditor.SETUP_PROGRAM_SOURCE_FILE, setupFileName);

            if (File.Exists(AGSEditor.SETUP_ICON_FILE_NAME))
            {
                try
                {
                    Factory.NativeProxy.UpdateFileIcon(setupFileName, AGSEditor.SETUP_ICON_FILE_NAME);
                }
                catch (AGSEditorException ex)
                {
                    Factory.GUIController.ShowMessage("An problem occurred setting your custom icon onto the setup file. The error was: " + ex.Message, MessageBoxIcon.Warning);
                }
            }

            string gameFileName = Factory.AGSEditor.BaseGameFileName + ".exe";

            BinaryWriter sw = new BinaryWriter(File.Open(setupFileName, FileMode.Append, FileAccess.Write));
            sw.Write(Encoding.ASCII.GetBytes(gameFileName));
            sw.Write((byte)0);
            sw.Write(gameFileName.Length + 1);
            sw.Write(Encoding.ASCII.GetBytes("STCUSTOM"));
            sw.Close();
        }

Usage Example

Пример #1
0
 public override bool Build(CompileMessages errors, bool forceRebuild)
 {
     if (!base.Build(errors, forceRebuild))
     {
         return(false);
     }
     Factory.AGSEditor.SetMODMusicFlag();
     DeleteAnyExistingSplitResourceFiles();
     if (Factory.AGSEditor.Preferences.UseLegacyCompiler)
     {
         Factory.NativeProxy.CompileGameToDTAFile(Factory.AGSEditor.CurrentGame, AGSEditor.COMPILED_DTA_FILE_NAME);
         // if using the legacy compiler, make sure engine EXE is copied before calling CreateGameEXE
         string newExeName = GetCompiledPath(Factory.AGSEditor.BaseGameFileName + ".exe");
         string sourceEXE  = Path.Combine(Factory.AGSEditor.EditorDirectory, AGSEditor.ENGINE_EXE_FILE_NAME);
         File.Copy(sourceEXE, newExeName, true);
         BuildTargetWindows targetWindows = (BuildTargetsInfo.FindBuildTargetByName("Windows") as BuildTargetWindows);
         // updating the Vista game explorer resources after the EXE is fully created is deleting the data file,
         // corrupting the game resources
         targetWindows.UpdateWindowsEXE(newExeName, errors);
         // the above all needs to be done here anyway, so finish up by creating the setup EXE and copying plugins
         targetWindows.CreateCompiledSetupProgram();
         targetWindows.CopyPlugins(errors);
         Factory.NativeProxy.CreateGameEXE(ConstructFileListForDataFile(), Factory.AGSEditor.CurrentGame, Factory.AGSEditor.BaseGameFileName);
     }
     else
     {
         if (!DataFileWriter.SaveThisGameToFile(AGSEditor.COMPILED_DTA_FILE_NAME, Factory.AGSEditor.CurrentGame, errors))
         {
             return(false);
         }
         string errorMsg = DataFileWriter.MakeDataFile(ConstructFileListForDataFile(), Factory.AGSEditor.CurrentGame.Settings.SplitResources * 1000000,
                                                       Factory.AGSEditor.BaseGameFileName, true);
         if (errorMsg != null)
         {
             errors.Add(new CompileError(errorMsg));
         }
     }
     File.Delete(AGSEditor.COMPILED_DTA_FILE_NAME);
     CreateAudioVOXFile(forceRebuild);
     // Update config file with current game parameters
     Factory.AGSEditor.WriteConfigFile(AGSEditor.OUTPUT_DIRECTORY);
     return(true);
 }