43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using JD.Core.ProjectManaging;
|
|
using Packager.Parameters;
|
|
using SerializePreloadDLL;
|
|
|
|
namespace Packager.Tasks
|
|
{
|
|
[DisplayName(@"Serialize Preload")]
|
|
[Category("Extern Tools")]
|
|
public class SerializePreload: Task
|
|
{
|
|
[Input("Resources List", IOCardinality.Single, IOType.File)]
|
|
public List<string> ResList { get; set; }
|
|
|
|
[Output("Bin Preload Files", IOType.File)]
|
|
public List<string> BinPreloadFiles = new List<string>();
|
|
|
|
public SerializePreload()
|
|
{
|
|
ResList = new List<string>();
|
|
}
|
|
|
|
protected override void StartInternal(BuildConfiguration profile, cookerWrapper cooker, TaskIO inputs, string outputFolder)
|
|
{
|
|
var inputFileName = inputs["ResList"].First();
|
|
|
|
var mapname = Path.GetFileNameWithoutExtension(inputFileName);
|
|
if (mapname.LastIndexOf('_') != -1)
|
|
mapname = mapname.Substring(0, mapname.LastIndexOf('_'));
|
|
var destFile = Path.Combine(outputFolder, $"{mapname}.preres");
|
|
|
|
LogMessage(false, $"Serialize {Path.GetFileName(inputFileName)}");
|
|
|
|
var worker = new SerializeFile();
|
|
worker.Generate(DataPath.Value, profile.PlatformList.First(), inputFileName, destFile);
|
|
|
|
BinPreloadFiles.Add(destFile);
|
|
}
|
|
}
|
|
}
|