JD2022-TU1/main/tools/apps/TeaBox/Script/Build/Version/OutputFormat.cs

70 lines
No EOL
2.4 KiB
C#

using System;
using System.Linq;
using TeaBox.Code;
using System.Collections.Generic;
namespace TeaBox.BuildVersion
{
[Flags]
public enum OutputFormat
{
pkg = 1 << 1,
}
public static class DiskFormatExtensions
{
public static string ToOrbisCommand(this OutputFormat format, GameType type, DevEnvBuildVariant variant)
{
var flags = format.FlagsDefined().Select(x => x.ToString().ToLower()).ToList();
var extraFlags = string.Empty;
if (type == GameType.Prod)
{
flags.Add("iso");
// Compression is only for iso
extraFlags = "--compress off";
}
if ((type == GameType.Prod || type == GameType.Demo || type == GameType.Patch ) && variant == DevEnvBuildVariant.Final)
{
flags.Add("subitem");
}
var orbisCommand = $"{flags.Join("+")} {extraFlags}";
// return a list of flags to pass to command
return orbisCommand;
}
public static string ToProsperoCommand(this OutputFormat format, GameType type, DevEnvBuildVariant variant)
{
// var flags = format.FlagsDefined().Select(x => x.ToString().ToLower()).ToList();
List<string> flags = new List<string> ();
var extraFlags = string.Empty;
if (type == GameType.Prod)
{
// bd+nw is specified, compatibility with either dual-layer or triple-layer discs will be automatically determined according to the package size,
// and a package compatible with that type of disc and online distribution will be created.
flags.Add("bd");
flags.Add("nw");
// Compression is only for iso
extraFlags = "--compress off";
}
if (type == GameType.Patch)
{
flags.Add("nwonly");
}
if ((type == GameType.Prod || type == GameType.Demo || type == GameType.Patch) && variant == DevEnvBuildVariant.Final)
{
//TO DO : Create master sub files
//flags.Add("subitem");
extraFlags = "--for_submission";
}
var ProsperoCommand = $"{flags.Join("+")} {extraFlags}";
// return a list of flags to pass to command
return ProsperoCommand;
}
}
}