diff --git a/Divine/CLI/CommandLineActions.cs b/Divine/CLI/CommandLineActions.cs index a0e24af1..505c3abc 100644 --- a/Divine/CLI/CommandLineActions.cs +++ b/Divine/CLI/CommandLineActions.cs @@ -185,6 +185,12 @@ private static void Process(CommandLineArguments args) { CommandLineDataProcessor.Convert(); break; + } + + case "convert-loca": + { + CommandLineDataProcessor.ConvertLoca(); + break; } case "extract-packages": diff --git a/Divine/CLI/CommandLineArguments.cs b/Divine/CLI/CommandLineArguments.cs index c9012fc3..3d58dbe5 100644 --- a/Divine/CLI/CommandLineArguments.cs +++ b/Divine/CLI/CommandLineArguments.cs @@ -81,7 +81,7 @@ public class CommandLineArguments [EnumeratedValueArgument(typeof(string), 'a', "action", Description = "Set action to execute", DefaultValue = "extract-package", - AllowedValues = "create-package;list-package;extract-single-file;extract-package;extract-packages;convert-model;convert-models;convert-resource;convert-resources", + AllowedValues = "create-package;list-package;extract-single-file;extract-package;extract-packages;convert-model;convert-models;convert-resource;convert-resources;convert-loca", ValueOptional = false, Optional = false )] diff --git a/Divine/CLI/CommandLineDataProcessor.cs b/Divine/CLI/CommandLineDataProcessor.cs index d9303027..0b2fc10e 100644 --- a/Divine/CLI/CommandLineDataProcessor.cs +++ b/Divine/CLI/CommandLineDataProcessor.cs @@ -38,6 +38,27 @@ private static void ConvertResource(string sourcePath, string destinationPath, R } } + public static void ConvertLoca() + { + ConvertLoca(CommandLineActions.SourcePath, CommandLineActions.DestinationPath); + } + + private static void ConvertLoca(string sourcePath, string destinationPath) + { + try + { + var loca = LocaUtils.Load(sourcePath); + LocaUtils.Save(loca, destinationPath); + CommandLineLogger.LogInfo($"Wrote localization to: {destinationPath}"); + } + catch (Exception e) + { + CommandLineLogger.LogFatal($"Failed to convert localization file: {e.Message}", 2); + CommandLineLogger.LogTrace($"{e.StackTrace}"); + } + } + + private static void BatchConvertResource(string sourcePath, string destinationPath, ResourceFormat inputFormat, ResourceFormat outputFormat, ResourceConversionParameters conversionParams) { try