Esempio n. 1
0
        private void BuildStep(int step)
        {
            if (step == -1)
            {
                BuildHelper.DisplayLine("No steps selected.");
                OnStepSuccess();
                return;
            }
            GUIElementData stepData = GuiData.Where(x => x.DataKey == "step" + step).FirstOrDefault();

            BuildHelper.DisplayLine($"{stepData.Label}...");
            stepData.ExecuteAction(stepData);
        }
Esempio n. 2
0
 private void CopyLanguageData(GUIElementData stepData)
 {
     if (_currentGuiData.ContainsKey("language"))
     {
         CopyFilesArguments args = new CopyFilesArguments(StaticPaths.ConvertNameToBuiltOutputPath(this["game"], BuildHelper.BuildTarget, this["language"]), StaticPaths.ConvertNameToMainPath(BuildHelper.BuildTarget, this["language"]))
         {
             Include = "*",
             Exclude = $"{Path.DirectorySeparatorChar}xml{Path.DirectorySeparatorChar}"
         };
         BuildHelper.RunStep(StepType.CopyFiles, args);
     }
     else
     {
         BuildHelper.DisplayLine("No language selected.");
         BuildHelper.RunStep(StepType.StepOver, null);
     }
 }
Esempio n. 3
0
 private void CreateStandalone(GUIElementData stepData)
 {
     if (_currentGuiData.ContainsKey("language"))
     {
         StringBuilder skuDef = new StringBuilder();
         skuDef.AppendLine($"set-exe {Path.Combine(BuildHelper.BuildTarget, "RetailExe", "cnc3game.dat")}");
         skuDef.AppendLine($"add-search-path {StaticPaths.ConvertNameToRelativePath(BuildHelper.BuildTarget)}");
         skuDef.AppendLine($"add-search-path {StaticPaths.ConvertNameToRelativePath(BuildHelper.BuildTarget, this["language"])}");
         CreateStandaloneArguments args = new CreateStandaloneArguments(this["game"], this["language"], this["version"], skuDef.ToString());
         BuildHelper.RunStep(StepType.CreateStandalone, args);
     }
     else
     {
         BuildHelper.DisplayLine("No language selected.");
         BuildHelper.RunStep(StepType.StepOver, null);
     }
 }
Esempio n. 4
0
        private void executeModBuildStep(int stepId)
        {
            string ModFix;

            switch (stepId)
            {
            case 1:
                BuildHelper.DisplayLine(String.Format("Step {0}: Clearing built mod",
                                                      stepId));
                RunExecutableArguments clearMod = new RunExecutableArguments(Cmd);
                clearMod.Arguments = String.Format("/C (@echo off) & (cd /D \"{0}\")"
                                                   + " & (for /R \"{1}\" %I in (\"*.*\") do ("
                                                   + "(if not \"%~xI\" == \".asset\" (del \"%I\" /F /Q))"
                                                   + "))",
                                                   SDKDirectory, BuiltModPath);
                BuildHelper.RunStep(StepType.RunExecutable, clearMod);
                break;

            case 2:
                BuildHelper.DisplayLine(String.Format("Step {0}: Clearing cache",
                                                      stepId));
                RunExecutableArguments clearCache = new RunExecutableArguments(Cmd);
                clearCache.Arguments = String.Format("/C (@echo off) & (cd /D \"{0}\")"
                                                     + " & (if exist \"{1}\\builtmods\" (rd \"{1}\\builtmods\" /S /Q))"
                                                     + " & (for /R \"{2}\" %I in (\"*.asset\") do (del \"%I\" /F /Q))"
                                                     + " & (if exist \"{1}\\stringhashes.xml\" (del \"{1}\\stringhashes.xml\" /F /Q))",
                                                     SDKDirectory, BuiltModsPath, BuiltModPath);
                BuildHelper.RunStep(StepType.RunExecutable, clearCache);
                break;

            case 3:
                BuildHelper.DisplayLine(String.Format("Step {0}: Building global data",
                                                      stepId));
                RunExecutableArguments argsGlobal = new RunExecutableArguments(Cmd);
                argsGlobal.Arguments = String.Format("/C (@echo off) & (cd /D \"{0}\")"
                                                     + " & (for /R \"{1}\\additionalmaps\" %I in (\"mapmetadata_*\") do ("
                                                     + "(del \"%I\" /F /Q)"
                                                     + " & (if exist \"%~dpnI\" ("
                                                     + "(cd /D \"%~dpnI\")"
                                                     + " & (for /R %J in (\"*.cdata\") do (del \"%J\" /F /Q))"
                                                     + " & (cd /D \"{0}\")"
                                                     + "))"
                                                     + "))"
                                                     + " & (for /R \"{3}\\additionalmaps\" %I in (\"mapmetadata_*.xml\") do ("
                                                     + "(\"{2}\" \"%I\" /od:\"{4}\" /iod:\"{4}\" /ls:true /pc:true /audio:\".\\mods\\{5}\\audio;.\\audio\" /art:\".\\mods\\{5}\\art;.\\art\" /data:\".;.\\mods;.\\mods\\{5}\\data;.\\cnc3xml\")"
                                                     + "))",
                                                     SDKDirectory, BuiltModDataPath, BinaryAssetBuilder, ModDataPath, BuiltModsPath, Mod);
                BuildHelper.RunStep(StepType.RunExecutable, argsGlobal);
                break;

            case 4:
                BuildHelper.DisplayLine(String.Format("Step {0}: Building static data",
                                                      stepId));
                RunExecutableArguments args = new RunExecutableArguments(Cmd);
                args.Arguments = String.Format("/C (@echo off) & (cd /D \"{0}\")"
                                               + " & (if exist \"{1}\\mod.bin\" (del \"{1}\\mod.bin\" /F /Q))"
                                               + " & (if exist \"{1}\\mod.imp\" (del \"{1}\\mod.imp\" /F /Q))"
                                               + " & (if exist \"{1}\\mod.manifest\" (del \"{1}\\mod.manifest\" /F /Q))"
                                               + " & (if exist \"{1}\\mod.relo\" (del \"{1}\\mod.relo\" /F /Q))"
                                               + " & (if exist \"{1}\\mod.version\" (del \"{1}\\mod.version\" /F /Q))"
                                               + " & (for /R \"{1}\\mod\" %I in (\"*.cdata\") do (del \"%I\" /F /Q))"
                                               + " & (for /R \"{1}\" %I in (\"mod_*\") do ("
                                               + "(del \"%I\" /F /Q)"
                                               + " & (if exist \"%~dpnI\" ("
                                               + "(cd /D \"%~dpnI\")"
                                               + " & (for /R %J in (\"*.cdata\") do (del \"%J\" /F /Q))"
                                               + " & (cd /D \"{0}\")"
                                               + "))"
                                               + "))"
                                               + " & (\"{2}\" \"{3}\" /od:\"{4}\" /iod:\"{4}\" /ls:true /pc:true /audio:\".\\mods\\{5}\\audio;.\\audio\" /art:\".\\mods\\{5}\\art;.\\art\" /data:\".;.\\mods;.\\mods\\{5}\\data;.\\cnc3xml\")"
                                               + " & (\"{6}\" \"{1}\\mod.manifest\")"
                                               + " & (copy \"{4}\\cnc3xml\\worldbuilder.manifest\" \"{1}\\worldbuilder.manifest\" /Y)"
                                               + " & (\"{7}\" -m \"{1}\\mod.manifest\" -s mod)"
                                               + " & (if exist \"{1}\\worldbuilder.manifest\" (del \"{1}\\worldbuilder.manifest\" /F /Q))"
                                               + " & (\"{8}\" \"{1}\\mod.manifest\")",
                                               SDKDirectory, BuiltModDataPath, BinaryAssetBuilder, ModXml, BuiltModsPath, Mod, HashFix, AssetResolver, LoDStreamBuilder);
                BuildHelper.RunStep(StepType.RunExecutable, args);
                break;

            case 5:
                BuildHelper.DisplayLine(String.Format("Step {0}: Copying additional files",
                                                      stepId));
                RunExecutableArguments argsCopyFiles = new RunExecutableArguments(Cmd);
                argsCopyFiles.Arguments = String.Format("/C (@echo off) & (cd /D \"{0}\")",
                                                        SDKDirectory);

                if (Directory.Exists(ModAdditionalFilesPath))
                {
                    CopyFolders(ModAdditionalFilesPath, BuiltModPath);
                }

                BuildHelper.RunStep(StepType.RunExecutable, argsCopyFiles);
                break;

            case 6:
                BuildHelper.DisplayLine(String.Format("Step {0}: Creating big and skudef file",
                                                      stepId));
                RunExecutableArguments argsBigSkudef = new RunExecutableArguments(Cmd);
                argsBigSkudef.Arguments = String.Format("/C (@echo off) & (cd /D \"{0}\")"
                                                        + " & (\"{1}\" -f \"{2}\" -x:*.asset -o:\"{3}\\{4}\")"
                                                        + " & (if exist \"{3}\\{5}\" (del \"{3}\\{5}\" /F /Q))"
                                                        + " & (cd /D \"{3}\")"
                                                        + " & (echo mod-game {6}>\"{5}\")"
                                                        + " & (echo add-big {4}>>\"{5}\")",
                                                        SDKDirectory, MakeBig, BuiltModPath, ModInstallPath, ModBig, ModSkudef, (string)currentGUIData["gameversion"]);
                BuildHelper.RunStep(StepType.RunExecutable, argsBigSkudef);
                break;

            default:
                // unknown build step, this is probably the end
                onStepSuccess(-1);
                break;
            }
        }
Esempio n. 5
0
 // This function is called on the failure of a build step.
 public void onStepFailure(int stepId)
 {
     BuildHelper.DisplayLine(String.Format("Build failed on step {0}", BuildHelper.CurrentStep - 1));
 }
Esempio n. 6
0
 public void OnStepFailure()
 {
     BuildHelper.DisplayLine($"Build failed on step {BuildHelper.CurrentStep}.");
 }