79 lines
3.4 KiB
C#
79 lines
3.4 KiB
C#
using System;
|
|
using System.Linq;
|
|
|
|
using JD.Core;
|
|
|
|
using TeaBox.Macros;
|
|
|
|
namespace JDSongConverter.Tasks
|
|
{
|
|
/// <summary>
|
|
/// Makes a copy of moves, recordings, and snippings datas
|
|
/// </summary>
|
|
public class CopyMovesTask : CopyDirectorySetTask
|
|
{
|
|
public override TaskResult Process(IExecutionContext executionContext)
|
|
{
|
|
foreach (PlatformId platform in Enum.GetValues(typeof(PlatformId)).Cast<PlatformId>().Where(x => x != PlatformId.UNDEFINED))
|
|
{
|
|
//We copy classifiers
|
|
var classifierInputPath = AppDefinitions.Default.AbsoluteMapPath(MapPathType.MoveClassifierDir, Context.Song, platform);
|
|
var classifierOutputPath = AppDefinitions.Default.AbsoluteMapPath(MapPathType.MoveClassifierDir, Context.OutputMap.Folder, Context.Song.Name, JDSongVersion.JD2015, JDFolderLayout.Engine, platform);
|
|
if (System.IO.Directory.Exists(classifierInputPath))
|
|
{
|
|
if (!System.IO.Directory.Exists(classifierOutputPath))
|
|
{
|
|
System.IO.Directory.CreateDirectory(classifierOutputPath);
|
|
}
|
|
var task = new CopyDirectoryTask();
|
|
task.Init(classifierInputPath, classifierOutputPath);
|
|
Tasks.Add(task);
|
|
}
|
|
}
|
|
|
|
//We copy recordings
|
|
var recordingInputPath = AppDefinitions.Default.AbsoluteMapPath(MapPathType.MoveRecordingDir, Context.Song);
|
|
var recordginOutputPath = AppDefinitions.Default.AbsoluteMapPath(MapPathType.MoveRecordingDir, Context.OutputMap.Folder, Context.Song.Name, JDSongVersion.JD2015, JDFolderLayout.Engine);
|
|
if (System.IO.Directory.Exists(recordingInputPath))
|
|
{
|
|
if (!System.IO.Directory.Exists(recordginOutputPath))
|
|
{
|
|
System.IO.Directory.CreateDirectory(recordginOutputPath);
|
|
}
|
|
var task = new CopyDirectoryTask();
|
|
task.Init(recordingInputPath, recordginOutputPath);
|
|
Tasks.Add(task);
|
|
}
|
|
|
|
//We copy snipping
|
|
var snippingInputPath = AppDefinitions.Default.AbsoluteMapPath(MapPathType.MoveSnippingDir, Context.Song);
|
|
var snippingOutputPath = AppDefinitions.Default.AbsoluteMapPath(MapPathType.MoveSnippingDir, Context.OutputMap.Folder, Context.Song.Name, JDSongVersion.JD2015, JDFolderLayout.Engine);
|
|
if (System.IO.Directory.Exists(snippingInputPath))
|
|
{
|
|
if (!System.IO.Directory.Exists(snippingOutputPath))
|
|
{
|
|
System.IO.Directory.CreateDirectory(snippingOutputPath);
|
|
}
|
|
var snipping = System.IO.Directory.EnumerateFiles(snippingInputPath, "*.csv").ToList();
|
|
foreach (var csv in snipping)
|
|
{
|
|
var outputCsv = csv.Replace(snippingInputPath, snippingOutputPath);
|
|
new CopyFileTask(csv, outputCsv).Process(executionContext);
|
|
}
|
|
}
|
|
|
|
return base.Process(executionContext);
|
|
}
|
|
|
|
public override string Name
|
|
{
|
|
get { return "Copy of moves"; }
|
|
set {}
|
|
}
|
|
|
|
public override string ProgressText
|
|
{
|
|
get { return "Copying moves"; }
|
|
}
|
|
}
|
|
}
|