Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Changes for v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
amrshaheen61 committed Mar 16, 2023
1 parent d95bf63 commit 500331b
Show file tree
Hide file tree
Showing 35 changed files with 1,070 additions and 316 deletions.
69 changes: 66 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,67 @@
# UE4 Localizations Tool
is a simple tool to edit unreal engine 4 text files.
# UE4LocalizationsTool
simple tool to edit unreal engine 4 text files.

Author: amr shaheeen
By: Amr Shaheen
<hr>

## Command Lines
### for export single file use:
```
UE4localizationsTool.exe export <(Locres/Uasset/Umap) FilePath> <Options>
Example:
UE4localizationsTool.exe export Actions.uasset
```
### for import single file use:
```
UE4localizationsTool.exe import <(txt) FilePath> <Options>
Example:
UE4localizationsTool.exe import Actions.uasset.txt
```
### for import single file without rename it use:
```
UE4localizationsTool.exe -import <(txt) FilePath> <Options>
Example:
UE4localizationsTool.exe -import Actions.uasset.txt
```

### for export many files from folder use:
```
UE4localizationsTool.exe exportall <Folder> <TxtFile> <Options>
Example:
UE4localizationsTool.exe exportall Actions text.txt
```
### for import many files in folder use:
```
UE4localizationsTool.exe importall <Folder> <TxtFile> <Options>
Example:
UE4localizationsTool.exe importall Actions text.txt
```
### for import many files in folder without rename files use:
```
UE4localizationsTool.exe -importall <Folder> <TxtFile> <Options>
Example:
UE4localizationsTool.exe -importall Actions text.txt
```

### Options: (Remember to apply the same OPTIONS when importing)

#### To use last filter you applied before in GUI use: (apply only in name table)
```
-f or -filter
Example:
UE4localizationsTool.exe export Actions.uasset -filter
```

#### To export file without including name table use:
```
-nn or -NoName
Example:
UE4localizationsTool.exe export Actions.uasset -NoName
```
#### To use method 2 use:(trying to catch text without using ue4 asset structure (for uasset and umap only))
```
-m2 or -method2
Examplemethod2
UE4localizationsTool.exe export Actions.uasset -method2
UE4localizationsTool.exe export Actions.uasset -method2 -NoName -filter
```
12 changes: 12 additions & 0 deletions UE4localizationsTool/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="UE4localizationsTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<userSettings>
<UE4localizationsTool.Properties.Settings>
<setting name="DarkMode" serializeAs="String">
<value>False</value>
</setting>
</UE4localizationsTool.Properties.Settings>
</userSettings>
</configuration>
22 changes: 11 additions & 11 deletions UE4localizationsTool/Commands.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using AssetParser;
using Microsoft.SqlServer.Server;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -28,8 +27,9 @@ public class Commands
private bool RegularExpression = false;
private bool ReverseMode = false;
private List<string> ArrayValues;
public Commands(string Options, string SourcePath)
public Commands(string Options, string SourcePath, Args args)
{
Flags = args;
if (Flags.HasFlag(Args.filter))
{
GetFilterValues();
Expand Down Expand Up @@ -161,10 +161,10 @@ private List<List<string>> Export(string FilePath)
return locres.Strings;
// SizeOfRecord = locres.Strings.Count;
}
else if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase)|| FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase))
else if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase) || FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase))
{
Uasset Uasset = new Uasset(FilePath);

if (Flags.HasFlag(Args.method2))
{
Uasset.UseMethod2 = true;
Expand Down Expand Up @@ -192,7 +192,7 @@ private void ExportFolder(string FolderPath)
Console.WriteLine(ConsoleText);
Console.ForegroundColor = ConsoleColor.White;

string[] LanguageFiles = Directory.GetFiles(FolderPath, "*.*", SearchOption.AllDirectories).Where(x => x.EndsWith(".locres", StringComparison.OrdinalIgnoreCase) || x.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase)|| x.EndsWith(".umap", StringComparison.OrdinalIgnoreCase)).ToArray<string>();
string[] LanguageFiles = Directory.GetFiles(FolderPath, "*.*", SearchOption.AllDirectories).Where(x => x.EndsWith(".locres", StringComparison.OrdinalIgnoreCase) || x.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase) || x.EndsWith(".umap", StringComparison.OrdinalIgnoreCase)).ToArray<string>();
Console.ForegroundColor = ConsoleColor.Green;
Console.SetCursorPosition(ConsoleText.Length, Console.CursorTop - 1);
Console.WriteLine("Done");
Expand All @@ -206,7 +206,7 @@ private void ExportFolder(string FolderPath)
for (int i = 0; i < LanguageFiles.Count(); i++)
{
Console.ForegroundColor = ConsoleColor.Blue;
ConsoleText = $"[{ i + 1}:{LanguageFiles.Count()}] Exporting... '{Path.GetFileName(LanguageFiles[i])}' ";
ConsoleText = $"[{i + 1}:{LanguageFiles.Count()}] Exporting... '{Path.GetFileName(LanguageFiles[i])}' ";
Console.WriteLine(ConsoleText);
Console.ForegroundColor = ConsoleColor.White;

Expand Down Expand Up @@ -302,14 +302,14 @@ private void Import(string FilePath, string[] Values, string Option)
FilePath = Path.ChangeExtension(FilePath, null) + "_NEW.locres";
locres.SaveFile(FilePath);
}
else if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase)|| FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase))
else if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase) || FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase))
{
Uasset Uasset = new Uasset(FilePath);
if (Flags.HasFlag(Args.method2))
{
Uasset.UseMethod2 = true;
}

Uexp Uexp = new Uexp(Uasset);
EditList(Uexp.Strings, Values);

Expand All @@ -318,16 +318,16 @@ private void Import(string FilePath, string[] Values, string Option)
Uexp.SaveFile(FilePath);
return;
}
if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase))

if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase))
{
FilePath = Path.ChangeExtension(FilePath, null) + "_NEW.uasset";
}
else if (FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase))
{
FilePath = Path.ChangeExtension(FilePath, null) + "_NEW.umap";
}

Uexp.SaveFile(FilePath);
}
else
Expand Down
Loading

0 comments on commit 500331b

Please sign in to comment.