56 lines
2.2 KiB
C#
56 lines
2.2 KiB
C#
using System;
|
|
using System.IO;
|
|
using TeaBox.Code;
|
|
|
|
namespace TeaBox.BuildVersion
|
|
{
|
|
public static class Version
|
|
{
|
|
public static string GetName(Platform platform, DevEnvBuildVariant variant, string branch, string tag, string codeChangelist, string dataChangelist, string versionId)
|
|
{
|
|
var platformName = new EngineExecutable(platform, variant).DeliveredPlatformName;
|
|
|
|
if (string.IsNullOrEmpty(versionId))
|
|
{
|
|
versionId = "xxx";
|
|
}
|
|
|
|
var prefix = string.IsNullOrEmpty(tag)
|
|
? $"{UAFConstants.GameName}_{versionId.PadLeft(3, '0')}"
|
|
: $"{tag.ToLower()}_{versionId.PadLeft(3, '0')}";
|
|
|
|
var versionName = $"{prefix}_{platformName}_E{codeChangelist}_D{dataChangelist}_{branch}";
|
|
|
|
// Save version name ( the generated file is created to retrieve the name from Quickbuild )
|
|
var outputFile = Path.Combine(Environment.GetEnvironmentVariable("TEMP"), "versionName.txt");
|
|
System.IO.File.WriteAllText(outputFile, versionName);
|
|
|
|
// Return the name of the version
|
|
return versionName;
|
|
}
|
|
|
|
public static string GetPackagePublishingPath(GameOnlineEnvironment gameOnlineEnvironment, string versionName, Region region, DevEnvBuildVariant variant, string platformName, bool restricted)
|
|
{
|
|
var packageRootPath = CurrentStudio.Value.PackagePublishedRoot(restricted);
|
|
|
|
// return the destination path of the version
|
|
return Path.Combine(packageRootPath,
|
|
platformName,
|
|
gameOnlineEnvironment.ToString().ToLower(),
|
|
versionName,
|
|
region.ToString().ToLower(),
|
|
variant.ToString().ToLower());
|
|
}
|
|
|
|
public static string GetLoosesPublishingPath(Region region, string versionName, GameOnlineEnvironment gameOnlineEnvironment, string platformName, bool restricted=false)
|
|
{
|
|
var loosesRootPath = CurrentStudio.Value.LoosesPublishedRoot(restricted);
|
|
|
|
return Path.Combine(loosesRootPath,
|
|
platformName,
|
|
gameOnlineEnvironment.ToString(),
|
|
versionName,
|
|
region.ToString());
|
|
}
|
|
}
|
|
}
|