JD2022-TU1/main/tools/apps/Packager/Tasks/SkuConfigTask.cs

50 lines
1.4 KiB
C#

using System;
using System.ComponentModel;
using System.IO;
using JD.Core.ProjectManaging;
using Packager.Parameters;
namespace Packager.Tasks
{
[DisplayName("Sku Config")]
[Category("Config")]
public class SkuConfigTask: Task
{
[Input("SkuScene", IOCardinality.Single, IOType.File)]
public SingleReference SkuScene { get; set; }
/// <summary>
/// Renamed to RelativeSkuScenePath from SkuScene
/// </summary>
[Output("Relative SkuScene Path", IOType.File)]
public SingleReference RelativeSkuScenePath = new SingleReference();
public SkuConfigTask()
{
SkuScene = new SingleReference();
}
protected override void StartInternal(BuildConfiguration profile, cookerWrapper cooker)
{
try
{
var skuScenePath = SkuScene.Value;
// make the the data root ends with a (back)slash (required for the URI api)
if (!Path.IsPathRooted(skuScenePath))
{
throw new Exception("Sku scene path must be absolute, local data paths are deprecated.");
}
var localSkuScenePath = DataPath.GetRelativePath(skuScenePath);
RelativeSkuScenePath.Value = localSkuScenePath;
}
catch (Exception ex)
{
LogMessage(true, ex.Message);
}
}
}
}