Skip to content

Commit

Permalink
Add commandline conversion support for .loca files
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbyte committed Aug 18, 2023
1 parent 46ffad3 commit 7e05210
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Divine/CLI/CommandLineActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ private static void Process(CommandLineArguments args)
{
CommandLineDataProcessor.Convert();
break;
}

case "convert-loca":
{
CommandLineDataProcessor.ConvertLoca();
break;
}

case "extract-packages":
Expand Down
2 changes: 1 addition & 1 deletion Divine/CLI/CommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)]
Expand Down
21 changes: 21 additions & 0 deletions Divine/CLI/CommandLineDataProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7e05210

Please sign in to comment.