├── UE4localizationsTool
├── UE4.ico
├── UpdateInfo.txt
├── packages.config
├── UE4localizationsTool.csproj.DotSettings
├── Core
│ ├── IAsset.cs
│ ├── Spreadsheet.cs
│ ├── Object
│ │ └── Objects.cs
│ ├── ConsoleMode.cs
│ ├── Games
│ │ ├── MuseStringTable.cs
│ │ ├── TheLastOricru.cs
│ │ ├── RED Game
│ │ │ ├── REDLocalizeTextData.cs
│ │ │ ├── REDLibraryTextData.cs
│ │ │ └── REDAdvTextData.cs
│ │ ├── UDataTable.cs
│ │ ├── OctopathTraveler.cs
│ │ └── J5BinderAsset.cs
│ ├── StringTable.cs
│ ├── IUasset.cs
│ ├── DataTable.cs
│ ├── locres.cs
│ ├── IoPackage.cs
│ └── Uexp.cs
├── Forms
│ ├── FrmAbout.cs
│ ├── FrmState.cs
│ ├── FrmState.Designer.cs
│ ├── FrmAbout.Designer.cs
│ ├── FrmFilter.cs
│ ├── FrmLocresEntryEditor.cs
│ ├── FrmLocresEntryEditor.resx
│ └── FrmFilter.Designer.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── Resources.Designer.cs
│ ├── app.manifest
│ └── Resources.resx
├── App.config
├── Settings.cs
├── Controls
│ ├── NTextBox.cs
│ ├── SearchBox.resx
│ ├── NForm.cs
│ ├── SearchBox.cs
│ └── SearchBox.Designer.cs
├── Helper
│ └── CSVFile.cs
├── Program.cs
└── UE4localizationsTool.csproj
├── LICENSE
├── UE4localizationsTool.sln
├── README.md
├── .gitattributes
└── .gitignore
/UE4localizationsTool/UE4.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/release/UE4LocalizationsTool/master/UE4localizationsTool/UE4.ico
--------------------------------------------------------------------------------
/UE4localizationsTool/UpdateInfo.txt:
--------------------------------------------------------------------------------
1 | UpdateFile
2 | Tool_UpdateVer = 2.7
3 | Tool_UpdateSite = https://github.com/amrshaheen61/UE4LocalizationsTool/releases/tag/v2.7
--------------------------------------------------------------------------------
/UE4localizationsTool/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/UE4localizationsTool/UE4localizationsTool.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | CSharp120
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/IAsset.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Windows.Forms;
3 |
4 | namespace AssetParser
5 | {
6 | public interface IAsset
7 | {
8 | bool IsGood { get; }
9 | // List> Strings { get; }
10 | void AddItemsToDataGridView(DataGridView dataGrid);
11 | void LoadFromDataGridView(DataGridView dataGrid);
12 | void SaveFile(string FilPath);
13 | List> ExtractTexts();
14 | void ImportTexts(List> strings);
15 |
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Spreadsheet.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 |
3 | namespace AssetParser
4 | {
5 | public class Spreadsheet
6 | {
7 | public Spreadsheet(MemoryList memoryList, Uexp uexp, bool Modify = false)
8 | {
9 | memoryList.GetIntValue();//Null
10 | int TableCount = memoryList.GetIntValue();
11 |
12 | for (int TableIndex = 0; TableIndex < TableCount; TableIndex++)
13 | {
14 | _ = new StructProperty(memoryList, uexp, uexp.UassetData.UseFromStruct, false, Modify);
15 | }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Forms/FrmAbout.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using UE4localizationsTool.Controls;
5 |
6 | namespace UE4localizationsTool
7 | {
8 | public partial class FrmAbout : NForm
9 | {
10 | public FrmAbout(Form form)
11 | {
12 | InitializeComponent();
13 | this.Location = new Point(form.Location.X + (form.Width - this.Width) / 2, form.Location.Y + (form.Height - this.Height) / 2);
14 | }
15 |
16 | private void button1_Click(object sender, EventArgs e)
17 | {
18 | this.Close();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 |
5 | [assembly: AssemblyTitle("UE4 localizations Tool")]
6 | [assembly: AssemblyDescription("Simple tool to edit engine texts")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("Arabic Subtitles")]
9 | [assembly: AssemblyProduct("UE4 localizations Tool Final Version")]
10 | [assembly: AssemblyCopyright("Copyright © 2022 - By Amr Shaheen")]
11 | [assembly: AssemblyTrademark("amr shaheen")]
12 | [assembly: ComVisible(false)]
13 | [assembly: AssemblyVersion("1.0")]
14 | [assembly: AssemblyFileVersion("2.7")]
15 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | False
7 |
8 |
9 | True
10 |
11 |
12 | False
13 |
14 |
15 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Object/Objects.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace AssetParser.Object
4 | {
5 | public struct ImportsDirectory
6 | {
7 |
8 | public long ParentDirectoryNameID { get; set; }
9 | public long ClassID { get; set; }
10 | public int ParentImportObjectID { get; set; }
11 | public int NameID { get; set; }
12 |
13 | }
14 | public struct ExportsDirectory
15 | {
16 | public int ExportClass { get; set; }
17 | public int ExportParent_1 { get; set; }
18 | public int ExportParent_2 { get; set; }
19 | public int Value { get; set; }
20 | public int ExportName { get; set; }
21 | public short ExportMemberType { get; set; }
22 | public int ExportLength { get; set; }
23 | public int ExportStart { get; set; }
24 |
25 | public List ExportData;
26 | }
27 |
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/ConsoleMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace AssetParser
4 | {
5 | public static class ConsoleMode
6 | {
7 | public enum ConsoleModeType
8 | {
9 | Normal,
10 | Error
11 | }
12 | public static bool Show = false;
13 | public static bool StopInError = false;
14 | public static void Print(string Str, ConsoleColor color = ConsoleColor.White, ConsoleModeType type = ConsoleModeType.Normal)
15 | {
16 | if (Show)
17 | {
18 | Console.ForegroundColor = color;
19 | Console.WriteLine(Str);
20 | Console.ForegroundColor = ConsoleColor.White;
21 | if (type == ConsoleModeType.Error && StopInError)
22 | {
23 | Print("Press \"Enter\" to continue...", ConsoleColor.White);
24 | Console.ReadLine();
25 | }
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Amr Shaheen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Games/MuseStringTable.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 |
3 | namespace AssetParser
4 | {
5 | public class MuseStringTable
6 | {
7 |
8 | public MuseStringTable(MemoryList memoryList, Uexp uexp, bool Modify = false)
9 | {
10 | memoryList.GetIntValue();//Null
11 |
12 | memoryList.GetStringUE();
13 | int TablesCount = memoryList.GetIntValue();
14 | for (int i = 0; i < TablesCount; i++)
15 | {
16 | new ReadStringProperty(memoryList, uexp, memoryList.GetStringUE(), Modify);
17 | }
18 |
19 | TablesCount = memoryList.GetIntValue();
20 |
21 | for (int i = 0; i < TablesCount; i++)
22 | {
23 | string TableName = memoryList.GetStringUE();
24 | int TableCount = memoryList.GetIntValue();
25 | for (int n = 0; n < TableCount; n++)
26 | {
27 | memoryList.Skip(8);
28 | new ReadStringProperty(memoryList, uexp, TableName, Modify);
29 | }
30 | }
31 | }
32 |
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/StringTable.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System.Collections.Generic;
3 | namespace AssetParser
4 | {
5 | public class StringTable
6 | {
7 |
8 | public StringTable(MemoryList memoryList, Uexp uexp, bool Modify = false)
9 | {
10 |
11 | memoryList.GetIntValue();//Null
12 | int TableNameLenght = memoryList.GetIntValue();
13 | string TableName = memoryList.GetStringValue(TableNameLenght);
14 | int TableCount = memoryList.GetIntValue();
15 |
16 | for (int TableIndex = 0; TableIndex < TableCount; TableIndex++)
17 | {
18 | string TableId = memoryList.GetStringUE();
19 | if (!Modify)
20 | {
21 | string TableValue = memoryList.GetStringUE();
22 |
23 | uexp.Strings.Add(new List() { TableId, TableValue });
24 | }
25 | else
26 | {
27 | memoryList.ReplaceStringUE(uexp.Strings[uexp.CurrentIndex][1]);
28 | uexp.CurrentIndex++;
29 | }
30 | }
31 |
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/UE4localizationsTool.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.1.32414.318
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UE4localizationsTool", "UE4localizationsTool\UE4localizationsTool.csproj", "{C8AA2127-04A4-400B-9CA3-1951639BB0A3}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {C8AA2127-04A4-400B-9CA3-1951639BB0A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {C8AA2127-04A4-400B-9CA3-1951639BB0A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {C8AA2127-04A4-400B-9CA3-1951639BB0A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {C8AA2127-04A4-400B-9CA3-1951639BB0A3}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {A92F4454-AC04-449C-AE18-173E3E6C0695}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/UE4localizationsTool/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | False
15 |
16 |
17 | True
18 |
19 |
20 | False
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Settings.cs:
--------------------------------------------------------------------------------
1 | namespace UE4localizationsTool.Properties
2 | {
3 |
4 |
5 | // This class allows you to handle specific events on the settings class:
6 | // The SettingChanging event is raised before a setting's value is changed.
7 | // The PropertyChanged event is raised after a setting's value is changed.
8 | // The SettingsLoaded event is raised after the setting values are loaded.
9 | // The SettingsSaving event is raised before the setting values are saved.
10 | internal sealed partial class Settings
11 | {
12 |
13 | public Settings()
14 | {
15 | // // To add event handlers for saving and changing settings, uncomment the lines below:
16 | //
17 | // this.SettingChanging += this.SettingChangingEventHandler;
18 | //
19 | // this.SettingsSaving += this.SettingsSavingEventHandler;
20 | //
21 | }
22 |
23 | private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e)
24 | {
25 | // Add code to handle the SettingChangingEvent event here.
26 | }
27 |
28 | private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e)
29 | {
30 | // Add code to handle the SettingsSaving event here.
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/IUasset.cs:
--------------------------------------------------------------------------------
1 | using AssetParser.Object;
2 | using Helper.MemoryList;
3 | using System.Collections.Generic;
4 |
5 | namespace AssetParser
6 | {
7 | public interface IUasset
8 | {
9 | int LegacyFileVersion { get; set; }
10 | UEVersions EngineVersion { get; set; }
11 | EPackageFlags PackageFlags { get; set; }
12 | int File_Directory_Offset { get; set; }
13 | int Number_of_Names { get; set; }
14 | int Name_Directory_Offset { get; set; }
15 | int Number_Of_Exports { get; set; }
16 | int Exports_Directory_Offset { get; set; }
17 | int Number_Of_Imports { get; set; }
18 | int Imports_Directory_Offset { get; set; }
19 | List NAMES_DIRECTORY { get; set; }
20 | List Imports_Directory { get; set; }
21 | List Exports_Directory { get; set; }
22 | MemoryList UassetFile { get; set; }
23 | bool IOFile { get; set; }
24 | bool IsNotUseUexp { get; set; }
25 | bool UseFromStruct { get; set; }
26 | bool AutoVersion { get; set; }
27 | bool UseMethod2 { get; set; }
28 | int PathCount { get; set; }
29 | bool PathModify { get; set; }
30 | void EditName(string NewStr, int Index);
31 | void ExportReadOrEdit(bool Modify = false);
32 | void UpdateOffset();
33 | }
34 | }
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/DataTable.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 |
3 | namespace AssetParser
4 | {
5 | public class DataTable
6 | {
7 | public DataTable(MemoryList memoryList, Uexp uexp, bool Modify = false)
8 | {
9 | memoryList.GetIntValue();//Null
10 | int TableCount = memoryList.GetIntValue();
11 |
12 | for (int TableIndex = 0; TableIndex < TableCount; TableIndex++)
13 | {
14 |
15 | //for DRAGON.QUEST.XI.S.Echoes.of.an.Elusive.Age.Definitive.Edition
16 |
17 | #if false
18 | string Name = uexp.UassetData.GetPropertyName(memoryList.GetIntValue());
19 | memoryList.Skip(4);//null or something
20 | int ThisPosition = memoryList.GetPosition();
21 | memoryList.Skip(4);//Block size
22 | new ReadStringProperty(memoryList, uexp, Name, Modify);
23 | int ThisPositionAfterEdit = memoryList.GetPosition();
24 | memoryList.Skip(13);//Block size
25 |
26 |
27 |
28 | if (Modify)
29 | {
30 | memoryList.SetIntValue((ThisPositionAfterEdit - ThisPosition - 4) + 13, false, ThisPosition);
31 | }
32 |
33 | #else
34 |
35 |
36 | memoryList.Skip(8); //no neeed
37 | _ = new StructProperty(memoryList, uexp, uexp.UassetData.UseFromStruct, false, Modify);
38 | #endif
39 |
40 |
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Forms/FrmState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using UE4localizationsTool.Controls;
5 |
6 | namespace UE4localizationsTool
7 | {
8 | public partial class FrmState : NForm
9 | {
10 | private readonly DateTime dateTime;
11 | private readonly Timer timer1;
12 |
13 | public FrmState()
14 | {
15 | InitializeComponent();
16 | dateTime = DateTime.Now;
17 | timer1 = new Timer { Interval = 1000 };
18 | timer1_Tick(null, null);
19 | timer1.Tick += timer1_Tick;
20 | timer1.Start();
21 | }
22 |
23 | public FrmState(Form form, string title, string state) : this()
24 | {
25 | label1.Text = state;
26 | Text = title;
27 | Location = new Point(form.Location.X + (form.Width - Width) / 2, form.Location.Y + (form.Height - Height) / 2);
28 | }
29 |
30 | public FrmState(string title, string state) : this()
31 | {
32 | label1.Text = state;
33 | Text = title;
34 | }
35 |
36 | private void timer1_Tick(object sender, EventArgs e)
37 | {
38 | TimeSpan dateElapsed = DateTime.Now - dateTime;
39 | label2.Text = "Elapsed time: " + dateElapsed.ToString("hh':'mm':'ss");
40 | }
41 |
42 | protected override void Dispose(bool disposing)
43 | {
44 | if (disposing && (components != null))
45 | {
46 | components.Dispose();
47 | }
48 |
49 | if (disposing)
50 | {
51 | timer1.Stop();
52 | timer1.Dispose();
53 | }
54 | base.Dispose(disposing);
55 | }
56 |
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Controls/NTextBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Windows.Forms;
4 |
5 | namespace UE4localizationsTool.Controls
6 | {
7 | public partial class NTextBox : TextBox
8 | {
9 |
10 | private string _placeholderText = string.Empty;
11 | [Browsable(true)]
12 | public string PlaceholderText
13 | {
14 | get { return _placeholderText; }
15 | set
16 | {
17 | _placeholderText = value;
18 | UpdatePlaceholderText();
19 | }
20 | }
21 | [Browsable(true)]
22 | public bool StopEnterKey { get; set; } = false;
23 |
24 | protected override void OnHandleCreated(EventArgs e)
25 | {
26 | base.OnHandleCreated(e);
27 | UpdatePlaceholderText();
28 | }
29 |
30 | protected override void OnTextChanged(EventArgs e)
31 | {
32 | base.OnTextChanged(e);
33 | UpdatePlaceholderText();
34 | }
35 |
36 | private void UpdatePlaceholderText()
37 | {
38 | if (IsHandleCreated && string.IsNullOrEmpty(this.Text) && !string.IsNullOrEmpty(_placeholderText))
39 | {
40 | SendMessage(this.Handle, EM_SETCUEBANNER, 0, _placeholderText);
41 | }
42 | }
43 |
44 | protected override void OnKeyPress(KeyPressEventArgs e)
45 | {
46 | if (Multiline && StopEnterKey && e.KeyChar == '\r' || StopEnterKey && e.KeyChar == '\n')
47 | {
48 | e.Handled = true;
49 | }
50 |
51 |
52 | base.OnKeyPress(e);
53 | }
54 |
55 |
56 | private const int EM_SETCUEBANNER = 0x1501;
57 |
58 | [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
59 | private static extern int SendMessage(IntPtr hWnd, int msg, int wParam, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string lParam);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UE4LocalizationsTool
2 | simple tool to edit unreal engine 4 text files.
3 |
4 | By: Amr Shaheen
5 |
6 |
7 | ## Command Lines
8 | ### for export single file use:
9 | ```
10 | UE4localizationsTool.exe export <(Locres/Uasset/Umap) FilePath>
11 | Example:
12 | UE4localizationsTool.exe export Actions.uasset
13 | ```
14 | ### for import single file use:
15 | ```
16 | UE4localizationsTool.exe import <(txt) FilePath>
17 | Example:
18 | UE4localizationsTool.exe import Actions.uasset.txt
19 | ```
20 | ### for import single file without rename it use:
21 | ```
22 | UE4localizationsTool.exe -import <(txt) FilePath>
23 | Example:
24 | UE4localizationsTool.exe -import Actions.uasset.txt
25 | ```
26 |
27 | ### for export many files from folder use:
28 | ```
29 | UE4localizationsTool.exe exportall
30 | Example:
31 | UE4localizationsTool.exe exportall Actions text.txt
32 | ```
33 | ### for import many files in folder use:
34 | ```
35 | UE4localizationsTool.exe importall
36 | Example:
37 | UE4localizationsTool.exe importall Actions text.txt
38 | ```
39 | ### for import many files in folder without rename files use:
40 | ```
41 | UE4localizationsTool.exe -importall
42 | Example:
43 | UE4localizationsTool.exe -importall Actions text.txt
44 | ```
45 |
46 | ### Options: (Remember to apply the same OPTIONS when importing)
47 |
48 | #### To use last filter you applied before in GUI use: (apply only in name table)
49 | ```
50 | -f or -filter
51 | Example:
52 | UE4localizationsTool.exe export Actions.uasset -filter
53 | ```
54 |
55 | #### To export file without including name table use:
56 | ```
57 | -nn or -NoName
58 | Example:
59 | UE4localizationsTool.exe export Actions.uasset -NoName
60 | ```
61 | #### To use method 2 use:(trying to catch text without using ue4 asset structure (for uasset and umap only))
62 | ```
63 | -m2 or -method2
64 | Examplemethod2
65 | UE4localizationsTool.exe export Actions.uasset -method2
66 | UE4localizationsTool.exe export Actions.uasset -method2 -NoName -filter
67 | ```
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Games/TheLastOricru.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace AssetParser
7 | {
8 | public class TheLastOricru
9 | {
10 | public TheLastOricru(MemoryList memoryList, string PropertyName, Uexp uexp, bool Modify = false)
11 | {
12 |
13 |
14 | try
15 | {
16 |
17 | while (true)
18 | {
19 |
20 |
21 | RemoveBytes:
22 | while (memoryList.GetByteValue(false) != 1)
23 | {
24 | memoryList.Skip(1);
25 | }
26 |
27 | memoryList.Skip(1);
28 |
29 | if (memoryList.GetByteValue(false) == 1)
30 | {
31 | goto RemoveBytes;
32 | }
33 |
34 | var Position = memoryList.GetPosition();
35 | if (!UDataTable.IsGoodText(memoryList.GetStringValue(memoryList.GetByteValue(), true, -1, Encoding.UTF8)))
36 | {
37 | memoryList.SetPosition(Position);
38 | goto RemoveBytes;
39 | }
40 | memoryList.SetPosition(Position);
41 |
42 | if (!Modify)
43 | {
44 | uexp.Strings.Add(new List() { PropertyName, AssetHelper.ReplaceBreaklines(memoryList.GetStringValue(memoryList.GetByteValue(), true, -1, Encoding.UTF8)) });
45 | ConsoleMode.Print(uexp.Strings[uexp.Strings.Count - 1][1], ConsoleColor.Magenta);
46 | }
47 | else
48 | {
49 |
50 | memoryList.DeleteBytes(memoryList.GetByteValue(false) + 1);
51 | var StrBytes = Encoding.UTF8.GetBytes(AssetHelper.ReplaceBreaklines(uexp.Strings[uexp.CurrentIndex][1], true));
52 | memoryList.InsertByteValue((byte)StrBytes.Length);
53 | memoryList.InsertBytes(StrBytes);
54 | uexp.CurrentIndex++;
55 | }
56 | }
57 | }
58 | catch
59 | {
60 | //nothing
61 | }
62 |
63 |
64 |
65 |
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Games/RED Game/REDLocalizeTextData.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace AssetParser
7 | {
8 | public class REDLocalizeTextData
9 | {
10 | public REDLocalizeTextData(MemoryList memoryList, Uexp uexp, bool Modify = false)
11 | {
12 |
13 | memoryList.GetIntValue();//null
14 | memoryList.Skip(4 + 8 + 4 /*uexp position*/ + 4 + 4);//Unkown
15 | int ValuesPosition = memoryList.GetPosition();
16 | int UncompressedSize = memoryList.GetIntValue();
17 | int CompressedSize = memoryList.GetIntValue();
18 | if (UncompressedSize != CompressedSize)
19 | {
20 | throw new Exception("Can't Parse this file.");
21 | }
22 | int StartPosition = memoryList.GetIntValue();// Uasset+Position
23 | memoryList.Skip(4);
24 | StartPosition = memoryList.GetPosition();
25 | short Value = memoryList.GetShortValue();
26 | string[] String = memoryList.GetStringValue(UncompressedSize - 2, false, -1, Encoding.Unicode).Split(new string[] { "\r\n" }, StringSplitOptions.None);
27 |
28 |
29 | for (int n = 0; n < String.Length - 1; n = n + 2)
30 | {
31 | if (!Modify)
32 | {
33 | uexp.Strings.Add(new List() { String[n], String[n + 1] });
34 | }
35 | else
36 | {
37 | String[n + 1] = uexp.Strings[uexp.CurrentIndex][1];
38 | uexp.CurrentIndex++;
39 | }
40 | }
41 |
42 | if (Modify)
43 | {
44 | MemoryList memory = new MemoryList();
45 |
46 | memory.SetShortValue(Value);
47 |
48 | for (int n = 0; n < String.Length - 1; n++)
49 | {
50 | memory.SetStringValue(String[n] + "\r\n", true, -1, Encoding.Unicode);
51 | }
52 |
53 | memoryList.SetSize(StartPosition);
54 | memoryList.Seek(StartPosition);
55 | memoryList.SetBytes(memory.ToArray());
56 |
57 | memoryList.Seek(ValuesPosition);
58 | memoryList.SetIntValue(memory.GetSize());
59 | memoryList.SetIntValue(memory.GetSize());
60 | }
61 |
62 |
63 |
64 | }
65 |
66 |
67 |
68 |
69 |
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace UE4localizationsTool.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
29 | public bool DarkMode {
30 | get {
31 | return ((bool)(this["DarkMode"]));
32 | }
33 | set {
34 | this["DarkMode"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
41 | public bool CheckForUpdates {
42 | get {
43 | return ((bool)(this["CheckForUpdates"]));
44 | }
45 | set {
46 | this["CheckForUpdates"] = value;
47 | }
48 | }
49 |
50 | [global::System.Configuration.UserScopedSettingAttribute()]
51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
52 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
53 | public bool GoodByeMessage {
54 | get {
55 | return ((bool)(this["GoodByeMessage"]));
56 | }
57 | set {
58 | this["GoodByeMessage"] = value;
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Games/RED Game/REDLibraryTextData.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace AssetParser
7 | {
8 | public class REDLibraryTextData
9 | {
10 | public REDLibraryTextData(MemoryList memoryList, Uexp uexp, bool Modify = false)
11 | {
12 | memoryList.GetIntValue();//Null
13 |
14 | memoryList.Skip(12); //Unknown
15 | memoryList.GetIntValue(); //Start Data offset
16 | memoryList.Skip(8); //Unknown2
17 | int ValuesPosition = memoryList.GetPosition();
18 | int UncompressedSize = memoryList.GetIntValue();
19 | int CompressedSize = memoryList.GetIntValue();
20 | if (UncompressedSize != CompressedSize)
21 | {
22 | throw new Exception("Can't Parse this file.");
23 | }
24 | memoryList.Skip(4); //Unknown3
25 |
26 | memoryList.GetIntValue();//Null
27 |
28 | int StartOffset = memoryList.GetPosition();
29 |
30 | MemoryList Block = new MemoryList(memoryList.GetBytes(UncompressedSize));
31 |
32 | int StringCount = Block.GetIntValue();
33 |
34 |
35 | string[] IdValues = new string[StringCount];
36 |
37 |
38 | for (int i = 0; i < StringCount; i++)
39 | {
40 |
41 | Block.GetIntValue(); //unknown maybe flag
42 |
43 | IdValues[i] = Block.GetStringValue(128, true, -1, Encoding.Unicode).Trim('\0');
44 | }
45 |
46 | Block.GetIntValue(); //unknown maybe flag also idk
47 |
48 | if (!Modify)
49 | {
50 | for (int i = 0; i < StringCount; i++)
51 | {
52 | uexp.Strings.Add(new List() { IdValues[i], Block.GetStringUE(Encoding.Unicode) });
53 | }
54 | }
55 | else
56 | {
57 | Block.SetSize(Block.GetPosition());
58 |
59 | for (int i = 0; i < StringCount; i++)
60 | {
61 | Block.SetStringUE(uexp.Strings[uexp.CurrentIndex][1], Encoding.Unicode);
62 | uexp.CurrentIndex++;
63 | }
64 |
65 | memoryList.Seek(ValuesPosition);
66 | memoryList.SetIntValue(Block.GetSize());
67 | memoryList.SetIntValue(Block.GetSize());
68 |
69 | memoryList.SetSize(StartOffset);
70 |
71 | memoryList.Seek(StartOffset);
72 | memoryList.Add(Block.ToArray());
73 | }
74 |
75 |
76 | }
77 |
78 |
79 |
80 |
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace UE4localizationsTool.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UE4localizationsTool.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Forms/FrmState.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace UE4localizationsTool
2 | {
3 | partial class FrmState
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 |
11 | #region Windows Form Designer generated code
12 |
13 | ///
14 | /// Required method for Designer support - do not modify
15 | /// the contents of this method with the code editor.
16 | ///
17 | private void InitializeComponent()
18 | {
19 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmState));
20 | this.label1 = new System.Windows.Forms.Label();
21 | this.label2 = new System.Windows.Forms.Label();
22 | this.SuspendLayout();
23 | //
24 | // label1
25 | //
26 | this.label1.AutoSize = true;
27 | this.label1.Dock = System.Windows.Forms.DockStyle.Top;
28 | this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
29 | this.label1.Location = new System.Drawing.Point(0, 0);
30 | this.label1.Name = "label1";
31 | this.label1.Padding = new System.Windows.Forms.Padding(5, 30, 5, 30);
32 | this.label1.Size = new System.Drawing.Size(45, 73);
33 | this.label1.TabIndex = 0;
34 | this.label1.Text = "label1";
35 | //
36 | // label2
37 | //
38 | this.label2.AutoSize = true;
39 | this.label2.Dock = System.Windows.Forms.DockStyle.Top;
40 | this.label2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
41 | this.label2.Location = new System.Drawing.Point(0, 73);
42 | this.label2.Name = "label2";
43 | this.label2.Padding = new System.Windows.Forms.Padding(5, 0, 5, 30);
44 | this.label2.Size = new System.Drawing.Size(38, 43);
45 | this.label2.TabIndex = 1;
46 | this.label2.Text = "-------";
47 | //
48 | // FrmState
49 | //
50 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
51 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
52 | this.AutoSize = true;
53 | this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
54 | this.ClientSize = new System.Drawing.Size(165, 41);
55 | this.ControlBox = false;
56 | this.Controls.Add(this.label2);
57 | this.Controls.Add(this.label1);
58 | this.Cursor = System.Windows.Forms.Cursors.AppStarting;
59 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
60 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
61 | this.MaximizeBox = false;
62 | this.Name = "FrmState";
63 | this.ShowIcon = false;
64 | this.ShowInTaskbar = false;
65 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
66 | this.Text = "State";
67 | this.ResumeLayout(false);
68 | this.PerformLayout();
69 |
70 | }
71 |
72 | #endregion
73 |
74 | private System.Windows.Forms.Label label1;
75 | private System.Windows.Forms.Label label2;
76 | }
77 | }
--------------------------------------------------------------------------------
/UE4localizationsTool/Helper/CSVFile.cs:
--------------------------------------------------------------------------------
1 | using Csv;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 |
7 | namespace UE4localizationsTool.Helper
8 | {
9 | public class CSVFile
10 | {
11 | public static CSVFile Instance { get; } = new CSVFile();
12 |
13 | public char Delimiter { get; set; } = ',';
14 | public bool HasHeader { get; set; } = true;
15 |
16 | public void Load(NDataGridView dataGrid, string filePath)
17 | {
18 | int i = -1;
19 | using (var textReader = new StreamReader(filePath))
20 | {
21 | var options = new CsvOptions() { AllowNewLineInEnclosedFieldValues = true };
22 | foreach (var line in CsvReader.Read(textReader, options))
23 | {
24 | ++i;
25 | if (line.ColumnCount < 3)
26 | continue;
27 |
28 | if (!string.IsNullOrEmpty(line[2]))
29 | dataGrid.SetValue(dataGrid.Rows[i].Cells["Text value"], line[2]);
30 | }
31 | }
32 |
33 | }
34 |
35 | public void Save(DataGridView dataGrid, string filePath)
36 | {
37 | using (var writer = new StreamWriter(filePath))
38 | {
39 | var rows = new List();
40 | foreach (DataGridViewRow row in dataGrid.Rows)
41 | {
42 | rows.Add(new[] { row.Cells["Name"].Value.ToString(), row.Cells["Text value"].Value.ToString(), "" });
43 | }
44 | CsvWriter.Write(writer, new string[] { "key", "source", "Translation" }, rows);
45 | }
46 | }
47 |
48 | public string[] Load(string filePath, bool NoNames = false)
49 | {
50 | var list = new List();
51 | using (var textReader = new StreamReader(filePath))
52 | {
53 | var options = new CsvOptions() { AllowNewLineInEnclosedFieldValues = true };
54 | foreach (var line in CsvReader.Read(textReader, options))
55 | {
56 | list.Add(Merge(line.Values, NoNames));
57 | }
58 | }
59 |
60 | return list.ToArray();
61 | }
62 |
63 | private string Merge(string[] strings, bool NoNames = false)
64 | {
65 | int i = 0;
66 | int CollsCount = !NoNames ? 2 : 3;
67 | string text = "";
68 | if (!NoNames && strings[i++] != "[~PATHFile~]")
69 | {
70 | text += strings[i - 1] + "=";
71 | }
72 | else
73 | {
74 | return strings[i];
75 | }
76 |
77 | if (strings.Length < CollsCount || string.IsNullOrEmpty(strings.LastOrDefault()))
78 | {
79 | text += strings[i++];
80 | }
81 | else
82 | {
83 | text += strings.LastOrDefault();
84 | }
85 |
86 | return text;
87 |
88 | }
89 |
90 | public void Save(List> Strings, string filePath, bool NoNames = true)
91 | {
92 | using (var writer = new StreamWriter(filePath))
93 | {
94 | var rows = Strings.Select(x => NoNames ? new string[] { x[1], "" } : new string[] { x[0], x[1], "" });
95 | CsvWriter.Write(writer, NoNames ? new string[] { "source", "Translation" } : new string[] { "key", "source", "Translation" }, rows);
96 | }
97 | }
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Properties/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
50 |
58 |
59 |
73 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Games/UDataTable.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System;
3 | using System.Text;
4 |
5 | namespace AssetParser
6 | {
7 | public class UDataTable
8 | {
9 |
10 |
11 | public UDataTable(MemoryList memoryList, Uexp uexp, bool Modify = false)
12 | {
13 |
14 | int pos;
15 | int Name = 0;
16 | while (!memoryList.EndofFile())
17 | {
18 | int BlockSize = 0;
19 | int ID1 = memoryList.GetIntValue();
20 | int ID2 = memoryList.GetIntValue();
21 | memoryList.Skip(-8);
22 | pos = memoryList.GetPosition();
23 | int StringSize = memoryList.GetIntValue();
24 | BlockSize = StringSize;
25 | string Text;
26 | if (StringSize > 2000)
27 | {
28 | memoryList.Seek(pos + 1);
29 | continue;
30 | }
31 | if (StringSize < 0)
32 | {
33 | StringSize = (StringSize * -1);
34 | Text = memoryList.GetStringValueN(true, -1, Encoding.Unicode);
35 | BlockSize *= -2;
36 | }
37 | else
38 | {
39 | Text = memoryList.GetStringValueN();
40 | }
41 |
42 | if ((uexp.UassetData.NAMES_DIRECTORY.Count > ID1 && ID1 >= uexp.UassetData.PathCount) && (uexp.UassetData.NAMES_DIRECTORY.Count > ID2 && ID2 >= 0))
43 | {
44 | if (uexp.UassetData.GetPropertyName(ID1) != "None")
45 | {
46 | Name = ID1;
47 | }
48 | }
49 |
50 | if (((StringSize - 1) == Text.Length) && IsGoodText(Text))
51 | {
52 |
53 | try
54 | {
55 | long num = memoryList.GetInt64Value(false, pos - 9);
56 | if (num == BlockSize + 4)
57 | {
58 | ID1 = Name = memoryList.GetIntValue(false, pos - 25);
59 | }
60 | else
61 | {
62 | num = memoryList.GetInt64Value(false, pos - 8);
63 | if (num == BlockSize + 4)
64 | {
65 | ID1 = Name = memoryList.GetIntValue(false, pos - 24);
66 | }
67 | }
68 |
69 |
70 | }
71 | catch
72 | {
73 |
74 | }
75 |
76 | memoryList.Seek(pos);
77 | new ReadStringProperty(memoryList, uexp, uexp.UassetData.GetPropertyName(Name), Modify);
78 | }
79 | else
80 | {
81 | memoryList.Seek(pos + 1);
82 | }
83 |
84 |
85 |
86 |
87 |
88 | }
89 | }
90 |
91 |
92 | public static bool IsGoodText(string text)
93 | {
94 | if (String.IsNullOrEmpty(text))
95 | {
96 | return false;
97 | }
98 |
99 | //if (Regex.IsMatch(text, @"[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F]"))
100 | //{
101 | // return false;
102 | //}
103 |
104 | foreach (char c in text)
105 | {
106 | if ((c >= 0x00 && c <= 0x1F || c == 0x7f) && c != 0x09 && c != 0x0A && c != 0x0D)
107 | {
108 |
109 | return false;
110 | }
111 | }
112 |
113 | return true;
114 |
115 | }
116 |
117 | }
118 | }
119 |
120 |
121 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Games/OctopathTraveler.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace AssetParser
7 | {
8 | public class OctopathTraveler
9 | {
10 | //Octopath Traveler: Champions of the Continent
11 | readonly MemoryList MemoryData;
12 | public OctopathTraveler(MemoryList memoryList, string PropertyName, Uexp uexp, bool Modify = false)
13 | {
14 | MemoryData = memoryList;
15 | if (GetString() != "m_DataList")
16 | {
17 | throw new Exception("Not supported data type: !m_DataList");
18 | }
19 | MemoryData.Skip(1);//0xdc
20 | int Count = MemoryData.GetUShortValue(true, -1, Endian.Big);
21 |
22 |
23 | for (int i = 0; i < Count; i++)
24 | {
25 | while (GetString() != "m_gametext")
26 | {
27 | SkipIds();
28 | }
29 |
30 | for (int n = 0; n < 12; n++)
31 | {
32 | string value = GetString();
33 | if (value == null) continue;
34 |
35 | if (!Modify)
36 | {
37 | uexp.Strings.Add(new List() { "m_gametext", AssetHelper.ReplaceBreaklines(value) });
38 | ConsoleMode.Print(uexp.Strings[uexp.Strings.Count - 1][1], ConsoleColor.Magenta);
39 | }
40 | else
41 | {
42 | string replacevalue = AssetHelper.ReplaceBreaklines(uexp.Strings[uexp.CurrentIndex++][1], true);
43 | if (value != replacevalue)
44 | ReplaceString(replacevalue);
45 | }
46 | }
47 |
48 | }
49 |
50 |
51 | }
52 |
53 |
54 |
55 | private int StringOffset;
56 | private string GetString(int m_size)
57 | {
58 | return MemoryData.GetStringValue(m_size, true, -1, Encoding.UTF8);
59 | }
60 |
61 | private void ReplaceString(string value)
62 | {
63 | byte[] bytes = Encoding.UTF8.GetBytes(value);
64 | int StringLenght = MemoryData.GetPosition() - StringOffset;
65 | MemoryData.Seek(StringOffset);
66 | MemoryData.DeleteBytes(StringLenght);
67 |
68 | MemoryData.InsertByteValue(0xda);
69 | MemoryData.InsertShortValue((short)bytes.Length, true, -1, Endian.Big);
70 | MemoryData.InsertBytes(bytes);
71 | }
72 |
73 |
74 | private void SkipIds()
75 | {
76 | byte value = MemoryData.GetByteValue();//unsigned byte
77 |
78 | if (value >> 4 == 0xd)
79 | {
80 | byte casebyte = (byte)(value & 0xf);
81 | //this should be m_id value (byte - word - dword) -> big endian
82 | //0 -> dword
83 | if (casebyte != 0)
84 | MemoryData.Skip(sizeof(short) * casebyte);
85 | else
86 | MemoryData.Skip(sizeof(short) * 2);
87 | }
88 |
89 |
90 | if (value == 0x9c)
91 | {
92 | for (int n = 0; n < 12; n++)
93 | {
94 | SkipIds();
95 | }
96 | }
97 |
98 | }
99 |
100 |
101 |
102 | private string GetString()
103 | {
104 | byte value = MemoryData.GetByteValue();//unsigned byte
105 | if (value == 0xa0)
106 | {
107 | return null;
108 | }
109 |
110 | if ((value >> 4) == 0xa)
111 | {
112 | StringOffset = MemoryData.GetPosition() - 1;
113 | return GetString(value & 0xf);
114 | }
115 |
116 | if (value >> 4 == 0xd)
117 | {
118 | byte casebyte = (byte)(value & 0xf);
119 | if (casebyte == 0xa)
120 | {
121 | StringOffset = MemoryData.GetPosition() - 1;
122 | return GetString(MemoryData.GetShortValue(true, -1, Endian.Big));
123 | }
124 | }
125 |
126 |
127 | if (value == 0x9c)
128 | {
129 | return GetString();
130 | }
131 |
132 | return GetString();
133 | }
134 |
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Forms/FrmAbout.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace UE4localizationsTool
2 | {
3 | partial class FrmAbout
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAbout));
32 | this.label2 = new System.Windows.Forms.Label();
33 | this.button1 = new System.Windows.Forms.Button();
34 | this.textBox1 = new System.Windows.Forms.TextBox();
35 | this.SuspendLayout();
36 | //
37 | // label2
38 | //
39 | this.label2.Location = new System.Drawing.Point(0, 0);
40 | this.label2.Name = "label2";
41 | this.label2.Size = new System.Drawing.Size(100, 23);
42 | this.label2.TabIndex = 0;
43 | //
44 | // button1
45 | //
46 | this.button1.Location = new System.Drawing.Point(160, 132);
47 | this.button1.Name = "button1";
48 | this.button1.Size = new System.Drawing.Size(80, 23);
49 | this.button1.TabIndex = 1;
50 | this.button1.Text = "ok";
51 | this.button1.UseVisualStyleBackColor = true;
52 | this.button1.Click += new System.EventHandler(this.button1_Click);
53 | //
54 | // textBox1
55 | //
56 | this.textBox1.BackColor = System.Drawing.SystemColors.Control;
57 | this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
58 | this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
59 | this.textBox1.Location = new System.Drawing.Point(5, 37);
60 | this.textBox1.Multiline = true;
61 | this.textBox1.Name = "textBox1";
62 | this.textBox1.ReadOnly = true;
63 | this.textBox1.ShortcutsEnabled = false;
64 | this.textBox1.Size = new System.Drawing.Size(387, 73);
65 | this.textBox1.TabIndex = 2;
66 | this.textBox1.Text = "UE4 localizations Tool is a simple tool to edit unreal engine 4 text files.\r\n\r\nAu" +
67 | "thor: amr shaheeen(@amrshaheen61)\r\n";
68 | this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
69 | //
70 | // FrmAbout
71 | //
72 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
73 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
74 | this.AutoSize = true;
75 | this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
76 | this.ClientSize = new System.Drawing.Size(396, 167);
77 | this.Controls.Add(this.textBox1);
78 | this.Controls.Add(this.button1);
79 | this.Controls.Add(this.label2);
80 | this.Cursor = System.Windows.Forms.Cursors.AppStarting;
81 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
82 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
83 | this.MaximumSize = new System.Drawing.Size(412, 206);
84 | this.MinimumSize = new System.Drawing.Size(412, 206);
85 | this.Name = "FrmAbout";
86 | this.ShowIcon = false;
87 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
88 | this.Text = "About";
89 | this.ResumeLayout(false);
90 | this.PerformLayout();
91 |
92 | }
93 |
94 | #endregion
95 | private System.Windows.Forms.Label label2;
96 | private System.Windows.Forms.Button button1;
97 | private System.Windows.Forms.TextBox textBox1;
98 | }
99 | }
--------------------------------------------------------------------------------
/UE4localizationsTool/Forms/FrmFilter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.IO;
5 | using System.Windows.Forms;
6 | using UE4localizationsTool.Controls;
7 |
8 | namespace UE4localizationsTool
9 | {
10 | public partial class FrmFilter : NForm
11 | {
12 | public bool UseMatching;
13 | public bool RegularExpression;
14 | public bool ReverseMode;
15 | public string ColumnName;
16 | public List ArrayValues;
17 |
18 | public FrmFilter(Form form)
19 | {
20 | InitializeComponent();
21 | this.Location = new Point(form.Location.X + (form.Width - this.Width) / 2, form.Location.Y + (form.Height - this.Height) / 2);
22 | ColumnPanel.Visible = false;
23 | }
24 |
25 | public FrmFilter(NDataGridView dataGridView)
26 | {
27 | InitializeComponent();
28 | Location = new Point(
29 | dataGridView.PointToScreen(Point.Empty).X + (dataGridView.Width - this.Width) / 2,
30 | dataGridView.PointToScreen(Point.Empty).Y + (dataGridView.Height - this.Height) / 2
31 | );
32 | ColumnPanel.Visible = true;
33 |
34 | foreach (DataGridViewColumn HeaderText in dataGridView.Columns)
35 | {
36 | if (HeaderText.Visible)
37 | {
38 | Columns.Items.Add(HeaderText.Name);
39 | }
40 | }
41 |
42 | Columns.SelectedIndex = 0;
43 | }
44 |
45 |
46 |
47 | private void button1_Click(object sender, EventArgs e)
48 | {
49 | ArrayValues = new List();
50 |
51 | ArrayValues.Add(matchcase.Checked + "|" + regularexpression.Checked + "|" + reversemode.Checked+"|"+Columns.Text);
52 | foreach (string val in listBox1.Items)
53 | {
54 | ArrayValues.Add(val);
55 | }
56 |
57 | File.WriteAllLines("FilterValues.txt", ArrayValues.ToArray());
58 | ArrayValues.RemoveAt(0);
59 | UseMatching = matchcase.Checked;
60 | RegularExpression = regularexpression.Checked;
61 | ReverseMode = reversemode.Checked;
62 | ColumnName = Columns.Text;
63 | this.Close();
64 | }
65 |
66 | private void ClearList_Click(object sender, EventArgs e)
67 | {
68 | listBox1.Items.Clear();
69 | }
70 |
71 | private void RemoveSelected_Click(object sender, EventArgs e)
72 | {
73 | if (listBox1.SelectedIndex != -1)
74 | listBox1.Items.RemoveAt(listBox1.SelectedIndex);
75 | else
76 | {
77 | MessageBox.Show("Select value from list", "no selected value", MessageBoxButtons.OK, MessageBoxIcon.Stop);
78 | }
79 | }
80 |
81 | private void Add_Click(object sender, EventArgs e)
82 | {
83 |
84 | if (string.IsNullOrEmpty(textBox1.Text))
85 | {
86 | MessageBox.Show("Can't input null value", "Null value", MessageBoxButtons.OK, MessageBoxIcon.Stop);
87 | return;
88 | }
89 |
90 | if (!listBox1.Items.Contains(textBox1.Text))
91 | listBox1.Items.Add(textBox1.Text);
92 | else
93 | {
94 | MessageBox.Show($"The Value '{textBox1.Text}' is already in list", "Existed value", MessageBoxButtons.OK, MessageBoxIcon.Stop);
95 | }
96 |
97 | }
98 |
99 | private void FrmFilter_Load(object sender, EventArgs e)
100 | {
101 | if (File.Exists("FilterValues.txt"))
102 | {
103 | listBox1.Items.Clear();
104 | List FV = new List();
105 | FV.AddRange(File.ReadAllLines("FilterValues.txt"));
106 | string[] Controls = FV[0].Split(new char[] { '|' });
107 |
108 | if (Controls.Length >0)
109 | {
110 | if(Controls.Length > 0)
111 | matchcase.Checked = Convert.ToBoolean(Controls[0]);
112 | if (Controls.Length > 1)
113 | regularexpression.Checked = Convert.ToBoolean(Controls[1]);
114 | if (Controls.Length > 2)
115 | reversemode.Checked = Convert.ToBoolean(Controls[2]);
116 | if (Controls.Length > 3)
117 | Columns.Text = Controls[3];
118 | FV.RemoveAt(0);
119 | }
120 | listBox1.Items.AddRange(FV.ToArray());
121 | }
122 | }
123 |
124 | private void Close_Click(object sender, EventArgs e)
125 | {
126 | this.Close();
127 | }
128 |
129 | private void regularexpression_CheckedChanged(object sender, EventArgs e)
130 | {
131 |
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Forms/FrmLocresEntryEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Data;
3 | using System.Drawing;
4 | using System.Windows.Forms;
5 | using UE4localizationsTool.Controls;
6 | using UE4localizationsTool.Core.Hash;
7 | using UE4localizationsTool.Core.locres;
8 |
9 | namespace UE4localizationsTool.Forms
10 | {
11 | public partial class FrmLocresEntryEditor : NForm
12 | {
13 | public string NameSpace { get; set; }
14 | public string Key { get; set; }
15 | public string Value { get; set; }
16 |
17 | public HashTable HashTable
18 | {
19 | get
20 | {
21 | return new HashTable()
22 | {
23 | NameHash = uint.Parse(txtNameSapceHash.Text),
24 | KeyHash = uint.Parse(txtKeyHash.Text),
25 | ValueHash = uint.Parse(txtValueHash.Text),
26 | };
27 | }
28 | }
29 |
30 | public LocresFile asset { get; set; }
31 |
32 | public FrmLocresEntryEditor()
33 | {
34 | InitializeComponent();
35 | }
36 |
37 |
38 | public FrmLocresEntryEditor(NDataGridView gridView, LocresFile asset)
39 | {
40 | InitializeComponent();
41 | Location = new Point(
42 | gridView.PointToScreen(Point.Empty).X + (gridView.Width - this.Width) / 2,
43 | gridView.PointToScreen(Point.Empty).Y + (gridView.Height - this.Height) / 2
44 | );
45 |
46 | this.asset = asset;
47 | var items = gridView.CurrentCell.OwningRow.Cells["Name"].Value.ToString().Split(new string[] { "::" }, StringSplitOptions.None);
48 |
49 | if (items.Length == 2)
50 | {
51 | NameSpace = items[0];
52 | Key = items[1];
53 | Value = gridView.CurrentCell.OwningRow.Cells["Text value"].Value.ToString();
54 | }
55 | else
56 | {
57 | Key = items[0];
58 | Value = gridView.CurrentCell.OwningRow.Cells["Text value"].Value.ToString();
59 | }
60 |
61 | var Hashs = gridView.CurrentCell.OwningRow.Cells["Hash Table"].Value as HashTable;
62 |
63 | txtNameSapceHash.Text = Hashs.NameHash.ToString();
64 | txtKeyHash.Text = Hashs.KeyHash.ToString();
65 | txtValueHash.Text = Hashs.ValueHash.ToString();
66 | Print();
67 | }
68 |
69 | public FrmLocresEntryEditor(Form form, LocresFile asset)
70 | {
71 | InitializeComponent();
72 | this.Location = new Point(form.Location.X + (form.Width - this.Width) / 2, form.Location.Y + (form.Height - this.Height) / 2);
73 | Apply.Text = "Add";
74 | this.asset = asset;
75 | }
76 |
77 | private void Print()
78 | {
79 | txtNameSpace.Text = NameSpace;
80 | txtKey.Text = Key;
81 | txtValue.Text = Value;
82 | }
83 |
84 | public void AddRow(NDataGridView gridView)
85 | {
86 | DataTable dt = (DataTable)gridView.DataSource;
87 |
88 | string RowName = GetName();
89 |
90 | //bool rowExists = false;
91 | //foreach (DataRow row in dt.Rows)
92 | //{
93 | // if (string.Equals(row["Name"].ToString(), RowName, StringComparison.OrdinalIgnoreCase))
94 | // {
95 | // rowExists = true;
96 | // break;
97 | // }
98 | //}
99 |
100 | //if (rowExists)
101 | //{
102 | // throw new Exception("this NameSpace and Key already exists in the table.");
103 | //}
104 |
105 | dt.Rows.Add(RowName, Value, HashTable);
106 |
107 | }
108 |
109 | private string GetName()
110 | {
111 | string RowName;
112 | if (!string.IsNullOrEmpty(NameSpace))
113 | RowName = NameSpace + "::" + Key;
114 | else
115 | RowName = Key;
116 | return RowName;
117 | }
118 |
119 | public void EditRow(NDataGridView DGV)
120 | {
121 | DGV.SetValue(DGV.CurrentCell.OwningRow.Cells["Name"], GetName());
122 | DGV.SetValue(DGV.CurrentCell.OwningRow.Cells["Text value"], txtValue.Text);
123 | DGV.SetValue(DGV.CurrentCell.OwningRow.Cells["Hash Table"], HashTable);
124 | }
125 |
126 | private void txtNameSpace_TextChanged(object sender, EventArgs e)
127 | {
128 | NameSpace = txtNameSpace.Text;
129 | }
130 |
131 | private void txtKey_TextChanged(object sender, EventArgs e)
132 | {
133 | Key = txtKey.Text;
134 | }
135 |
136 | private void txtValue_TextChanged(object sender, EventArgs e)
137 | {
138 | Value = AssetParser.AssetHelper.ReplaceBreaklines(txtValue.Text);
139 | }
140 |
141 | private void BtnNameSpace_Click(object sender, EventArgs e)
142 | {
143 | txtNameSapceHash.Text = asset.CalcHash(txtNameSpace.Text).ToString();
144 | }
145 |
146 | private void BtnKey_Click(object sender, EventArgs e)
147 | {
148 | txtKeyHash.Text = asset.CalcHash(txtKey.Text).ToString();
149 | }
150 |
151 | private void BtnValue_Click(object sender, EventArgs e)
152 | {
153 | txtValueHash.Text = txtValue.Text.StrCrc32().ToString();
154 | }
155 |
156 | private void Apply_Click(object sender, EventArgs e)
157 | {
158 | if (string.IsNullOrEmpty(txtNameSapceHash.Text) || string.IsNullOrEmpty(txtKeyHash.Text) || string.IsNullOrEmpty(txtValueHash.Text))
159 | {
160 | MessageBox.Show("NameSpace or Key or Value is empty");
161 | return;
162 | }
163 |
164 | if (!uint.TryParse(txtNameSapceHash.Text, out uint temp) || !uint.TryParse(txtKeyHash.Text, out uint temp1) || !uint.TryParse(txtValueHash.Text, out uint temp2))
165 | {
166 | MessageBox.Show("NameSpace or Key or Value is not a number");
167 | return;
168 | }
169 | }
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Controls/SearchBox.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Forms/FrmLocresEntryEditor.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Windows.Forms;
4 | namespace UE4localizationsTool
5 | {
6 | internal static class Program
7 | {
8 |
9 | [DllImport("kernel32.dll", SetLastError = true)]
10 | static extern bool AttachConsole(int dwProcessId);
11 | private const int ATTACH_PARENT_PROCESS = -1;
12 |
13 |
14 | public static string commandlines =
15 | $"{AppDomain.CurrentDomain.FriendlyName} export <(Locres/Uasset/Umap) FilePath> \n" +
16 | $"{AppDomain.CurrentDomain.FriendlyName} import <(txt) FilePath> \n" +
17 | $"{AppDomain.CurrentDomain.FriendlyName} -import <(txt) FilePath> \n" +
18 | $"{AppDomain.CurrentDomain.FriendlyName} exportall \n" +
19 | $"{AppDomain.CurrentDomain.FriendlyName} importall \n" +
20 | $"{AppDomain.CurrentDomain.FriendlyName} -importall \n\n" +
21 | "- for import without rename file be careful with this command.\n\n" +
22 |
23 | "Options:\n" +
24 | "To use last filter you applied before in GUI, add (-f \\ -filter) after command line\n" +
25 | "filter will apply only in name table " +
26 | "\n(Remember to apply the same filter when importing)\n\n" +
27 |
28 | "To export file without including the names use (-nn \\ -NoName)" +
29 | "\n(Remember to use this command when importing)\n\n" +
30 |
31 | "To use method 2 (-m2 \\ -method2)" +
32 | "\n(Remember to use this command when importing)\n\n" +
33 |
34 | "Examples:\n" +
35 | $"{AppDomain.CurrentDomain.FriendlyName} export Actions.uasset\n" +
36 | $"{AppDomain.CurrentDomain.FriendlyName} import Actions.uasset.txt\n" +
37 | $"{AppDomain.CurrentDomain.FriendlyName} exportall Actions text.txt\n" +
38 | $"{AppDomain.CurrentDomain.FriendlyName} importall Actions text.txt\n";
39 |
40 | public static Args GetArgs(int Index, string[] args)
41 | {
42 | Args args1 = new Args();
43 |
44 | for (int n = Index; n < args.Length; n++)
45 | {
46 | switch (args[n].ToLower())
47 | {
48 | case "-f":
49 | case "-filter":
50 | args1 |= Args.filter;
51 | break;
52 | case "-nn":
53 | case "-noname":
54 | args1 |= Args.noname;
55 | break;
56 | case "-m2":
57 | case "-method2":
58 | args1 |= Args.method2;
59 | break;
60 |
61 | case "-c":
62 | case "-csv":
63 | args1 |= Args.CSV;
64 | break;
65 | default:
66 | Console.ForegroundColor = ConsoleColor.Yellow;
67 | Console.WriteLine("Invalid command: " + args[n]);
68 | Console.ForegroundColor = ConsoleColor.White;
69 | break;
70 | }
71 | }
72 | return args1;
73 | }
74 |
75 |
76 | public static void CheckArges(int Index, string[] args)
77 | {
78 | for (int n = 0; n < Index; n++)
79 | {
80 | switch (args[n].ToLower())
81 | {
82 | case "-f":
83 | case "-filter":
84 | case "-nn":
85 | case "-noname":
86 | case "-method2":
87 | case "-m2":
88 | case "-c":
89 | case "-csv":
90 | throw new Exception("Invalid number of arguments.\n\n" + commandlines);
91 | }
92 | }
93 | }
94 |
95 |
96 |
97 | [STAThread]
98 |
99 | static void Main(string[] args)
100 | {
101 |
102 | if (args.Length > 0)
103 | {
104 | if (args.Length == 1 && (args[0].EndsWith(".uasset") || args[0].EndsWith(".umap") || args[0].EndsWith(".locres")))
105 | {
106 | Application.EnableVisualStyles();
107 | Application.SetCompatibleTextRenderingDefault(false);
108 | var FrmMain = new FrmMain();
109 | FrmMain.Show();
110 | FrmMain.LoadFile(args[0]);
111 | Application.Run(FrmMain);
112 | return;
113 | }
114 |
115 |
116 | AttachConsole(ATTACH_PARENT_PROCESS);
117 | Console.WriteLine("");
118 | // Console.SetCursorPosition(0, Console.CursorTop + 1);
119 |
120 | if (args.Length < 2)
121 | {
122 | Console.ForegroundColor = ConsoleColor.Red;
123 | Console.WriteLine("Invalid number of arguments.\n\n" + commandlines);
124 | Console.ForegroundColor = ConsoleColor.White;
125 | return;
126 | }
127 | try
128 | {
129 |
130 | if (args[0].ToLower() == "importall" || args[0].ToLower() == "-importall" || args[0].ToLower() == "exportall")
131 | {
132 | if (args.Length < 3)
133 | {
134 | throw new Exception("Invalid number of arguments.\n\n" + commandlines);
135 | }
136 |
137 | CheckArges(3, args);
138 | new Commands(args[0], args[1] + "*" + args[2], GetArgs(3, args));
139 | }
140 | else
141 | {
142 | CheckArges(2, args);
143 | new Commands(args[0], args[1], GetArgs(2, args));
144 | }
145 |
146 | }
147 | catch (Exception ex)
148 | {
149 | Console.ForegroundColor = ConsoleColor.Red;
150 | Console.WriteLine("\n"+ex.Message);
151 | Console.ForegroundColor = ConsoleColor.White;
152 | }
153 | return;
154 | }
155 |
156 | Application.EnableVisualStyles();
157 | Application.SetCompatibleTextRenderingDefault(false);
158 | Application.Run(new FrmMain());
159 | }
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Games/RED Game/REDAdvTextData.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace AssetParser
7 | {
8 | public class REDAdvTextData
9 | {
10 |
11 | int StartOffset;
12 | int ATFBlockHeaderSize;
13 | int UncompressedSize;
14 | int CompressedSize;
15 | string MagicId;
16 | int StringCount;
17 |
18 | public REDAdvTextData(MemoryList memoryList, Uexp uexp, bool Modify = false)
19 | {
20 | memoryList.GetIntValue();//Null
21 |
22 | memoryList.Skip(12); //Unknown
23 | memoryList.GetIntValue(); //Start Data offset
24 | memoryList.Skip(8); //Unknown2
25 | int ValuesPosition = memoryList.GetPosition();
26 | UncompressedSize = memoryList.GetIntValue();
27 | CompressedSize = memoryList.GetIntValue();
28 | if (UncompressedSize != CompressedSize)
29 | {
30 | throw new Exception("Can't Parse this file.");
31 | }
32 | memoryList.Skip(4); //Unknown3
33 |
34 | memoryList.GetIntValue();//Null
35 |
36 | StartOffset = memoryList.GetPosition();
37 |
38 | MemoryList ATFBlock = new MemoryList(memoryList.GetBytes(UncompressedSize));
39 |
40 | MagicId = ATFBlock.GetStringValueN();
41 |
42 | if (MagicId != "ATF")
43 | {
44 | throw new Exception("Can't Parse this file.\nSend this file to author.");
45 | }
46 |
47 | StringCount = ATFBlock.GetIntValue();
48 | ATFBlock.Skip(8); //Null
49 |
50 | int StringsIdPosition = ATFBlock.GetPosition();
51 | int StringsIdOffset = ATFBlock.GetIntValue();
52 | int StringsIdCount = ATFBlock.GetIntValue();
53 | int StringsIdSize = ATFBlock.GetIntValue();
54 | ATFBlock.Skip(4); //Null
55 | byte[] IdBlock = ATFBlock.GetBytes(StringsIdSize, false, StringsIdOffset);
56 |
57 | int StringsInfoPosition = ATFBlock.GetPosition();
58 | int StringsInfoOffset = ATFBlock.GetIntValue();
59 | int StringsInfoCount = ATFBlock.GetIntValue();
60 | int StringsInfoSize = ATFBlock.GetIntValue();
61 | ATFBlock.Skip(4); //Null
62 | MemoryList StringsInfo = new MemoryList(ATFBlock.GetBytes(StringsInfoSize, false, StringsInfoOffset));
63 |
64 | int StringsTagsPosition = ATFBlock.GetPosition();
65 | int StringsTagsOffset = ATFBlock.GetIntValue();
66 | int StringsTagsSize = ATFBlock.GetIntValue();
67 | _ = ATFBlock.GetIntValue();//StringsTagsSize
68 | ATFBlock.Skip(4); //Null
69 | MemoryList StringsTags = new MemoryList(ATFBlock.GetBytes(StringsTagsSize, false, StringsTagsOffset));
70 |
71 | int StringsBlockPosition = ATFBlock.GetPosition();
72 | int StringsBlockOffset = ATFBlock.GetIntValue();
73 | int StringLenght = ATFBlock.GetIntValue();
74 | int StringsBlockSize = ATFBlock.GetIntValue();
75 | ATFBlock.Skip(4); //Null
76 | MemoryList StringsBlock = new MemoryList(ATFBlock.GetBytes(StringsBlockSize, false, StringsBlockOffset));
77 |
78 | ATFBlockHeaderSize = ATFBlock.GetPosition();
79 |
80 | if (!Modify)
81 | {
82 | for (int n = 0; n < StringCount; n++)
83 | {
84 | int tagsOffsets = StringsInfo.GetIntValue();
85 | int tagsLength = StringsInfo.GetIntValue();
86 | StringsInfo.Skip(8);//Null
87 | int stringOffsets = StringsInfo.GetIntValue();
88 | int stringLength = StringsInfo.GetIntValue();
89 | StringsInfo.Skip(8);//Null
90 |
91 | // Console.WriteLine(n+": " + tagsOffsets +" - "+ tagsLength + " - "+ stringOffsets + " - "+ stringLength);
92 | uexp.Strings.Add(new List() { StringsTags.GetStringUE(tagsLength, false, tagsOffsets), StringsBlock.GetStringUE(stringLength * 2, false, stringOffsets * 2, System.Text.Encoding.Unicode) });
93 |
94 | }
95 | }
96 | else
97 | {
98 | StringsBlock.Clear();
99 | for (int n = 0; n < StringCount; n++)
100 | {
101 |
102 | byte[] StrBytes = Encoding.Unicode.GetBytes(AssetHelper.ReplaceBreaklines(uexp.Strings[uexp.CurrentIndex][1] + '\0', true));
103 | uexp.CurrentIndex++;
104 |
105 | StringsInfo.GetIntValue(); //tagsOffsets
106 | StringsInfo.GetIntValue();//tagsLength
107 | StringsInfo.Skip(8);//Null
108 | StringsInfo.SetIntValue(StringsBlock.GetSize() / 2); //stringOffsets
109 | StringsInfo.SetIntValue((StrBytes.Length - 2) / 2);
110 | StringsInfo.Skip(8);//Null
111 | StringsBlock.Add(StrBytes);
112 | }
113 |
114 |
115 |
116 | ATFBlock.SetSize(ATFBlockHeaderSize);
117 |
118 |
119 | ATFBlock.Seek(StringsIdPosition);
120 | ATFBlock.SetIntValue(ATFBlock.GetSize());
121 | ATFBlock.Skip(4);
122 | ATFBlock.SetIntValue(IdBlock.Length);
123 | ATFBlock.Add(IdBlock);
124 |
125 |
126 | ATFBlock.Seek(StringsInfoPosition);
127 | ATFBlock.SetIntValue(ATFBlock.GetSize());
128 | ATFBlock.Skip(4);
129 | ATFBlock.SetIntValue(StringsInfo.GetSize());
130 | ATFBlock.Add(StringsInfo.ToArray());
131 |
132 |
133 | ATFBlock.Seek(StringsTagsPosition);
134 | ATFBlock.SetIntValue(ATFBlock.GetSize());
135 | ATFBlock.SetIntValue(StringsTags.GetSize());
136 | ATFBlock.SetIntValue(StringsTags.GetSize());
137 | ATFBlock.Add(StringsTags.ToArray());
138 |
139 | ATFBlock.Seek(StringsBlockPosition);
140 | ATFBlock.SetIntValue(ATFBlock.GetSize());
141 | ATFBlock.SetIntValue(StringsBlock.GetSize() / 2);
142 | ATFBlock.SetIntValue(StringsBlock.GetSize());
143 | ATFBlock.Add(StringsBlock.ToArray());
144 |
145 |
146 |
147 | memoryList.SetSize(StartOffset);
148 | memoryList.Add(ATFBlock.ToArray());
149 |
150 |
151 | memoryList.Seek(ValuesPosition);
152 | memoryList.SetIntValue(ATFBlock.GetSize());
153 | memoryList.SetIntValue(ATFBlock.GetSize());
154 |
155 |
156 | }
157 |
158 |
159 | }
160 |
161 |
162 |
163 |
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/locres.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 |
7 | namespace AssetParser
8 | {
9 | public class locres : IAsset
10 | {
11 | public enum LocresVersion : byte
12 | {
13 | Legacy = 0,
14 | Compact,
15 | Optimized,
16 | Optimized_CityHash64_UTF16,
17 | }
18 |
19 | //{7574140E-4A67-FC03-4A15-909DC3377F1B}
20 | private readonly byte[] MagicGUID = { 0x0E, 0x14, 0x74, 0x75, 0x67, 0x4A, 0x03, 0xFC, 0x4A, 0x15, 0x90, 0x9D, 0xC3, 0x37, 0x7F, 0x1B };
21 | public bool IsGood { get; set; } = true;
22 | public List> Strings { get; set; }
23 | public int CurrentIndex;
24 | MemoryList locresData;
25 | public locres(string FilePath)
26 | {
27 | Strings = new List>();//[Text id,Text Value,...]
28 | locresData = new MemoryList(FilePath);
29 | ReadOrEdit();
30 |
31 | }
32 |
33 | private void ReadOrEdit(bool Modify = false)
34 | {
35 | locresData.Seek(0);
36 | byte[] FileGUID = locresData.GetBytes(16);
37 | LocresVersion Version;
38 | if (FileGUID.SequenceEqual(MagicGUID))
39 | {
40 | Version = (LocresVersion)locresData.GetByteValue();
41 | }
42 | else
43 | {
44 | Version = LocresVersion.Legacy;
45 | locresData.Seek(0);
46 | }
47 |
48 | if (Version > LocresVersion.Optimized_CityHash64_UTF16)
49 | {
50 | throw new Exception("Unsupported locres version");
51 | }
52 |
53 |
54 | if (Version >= LocresVersion.Compact)
55 | {
56 |
57 | int localizedStringOffset = (int)locresData.GetInt64Value();
58 | int currentFileOffset = locresData.GetPosition();
59 |
60 |
61 | if (localizedStringOffset == -1)
62 | {
63 | return;
64 | }
65 |
66 | locresData.Seek(localizedStringOffset);
67 |
68 | int localizedStringCount = locresData.GetIntValue();
69 |
70 | if (Version >= LocresVersion.Optimized)
71 | {
72 | for (int i = 0; i < localizedStringCount; i++)
73 | {
74 | if (!Modify)
75 | {
76 | Strings.Add(new List() { Strings.Count.ToString(), locresData.GetStringUE() });
77 | locresData.Skip(4);
78 | }
79 | else
80 | {
81 | locresData.ReplaceStringUE(Strings[CurrentIndex][1]);
82 | CurrentIndex++;
83 | locresData.Skip(4);
84 | }
85 | }
86 | }
87 | else
88 | {
89 | for (int i = 0; i < localizedStringCount; i++)
90 | {
91 | if (!Modify)
92 | {
93 | Strings.Add(new List() { Strings.Count.ToString(), locresData.GetStringUE() });
94 | }
95 | else
96 | {
97 |
98 | locresData.ReplaceStringUE(Strings[CurrentIndex][1]);
99 | CurrentIndex++;
100 | }
101 | }
102 | }
103 | locresData.Seek(currentFileOffset);
104 |
105 | }
106 | else if (Version == LocresVersion.Legacy)
107 | {
108 | int HashTablesCount = locresData.GetIntValue();
109 |
110 |
111 | for (int i = 0; i < HashTablesCount; i++)
112 | {
113 | locresData.GetStringUE(); //hash namespace
114 |
115 | int localizedStringCount = locresData.GetIntValue();
116 |
117 |
118 | for (int n = 0; n < localizedStringCount; n++)
119 | {
120 | if (!Modify)
121 | {
122 | string KeyHash = locresData.GetStringUE(); //string hash
123 | locresData.Skip(4); //Unkown
124 | Strings.Add(new List() { KeyHash, locresData.GetStringUE() });
125 |
126 | }
127 | else
128 | {
129 | locresData.GetStringUE(); //string hash
130 | locresData.Skip(4); //Unkown
131 | locresData.ReplaceStringUE(Strings[CurrentIndex][1]);
132 | CurrentIndex++;
133 | }
134 | }
135 |
136 | }
137 | return;
138 | }
139 |
140 |
141 | if (Version >= LocresVersion.Optimized)
142 | {
143 | locresData.Skip(4); //FileHash
144 | }
145 |
146 |
147 | int namespaceCount = locresData.GetIntValue();
148 |
149 | for (int n = 0; n < namespaceCount; n++)
150 | {
151 | string nameSpaceStr;
152 | uint StrHash;
153 | ReadTextKey(locresData, Version, out StrHash, out nameSpaceStr); //no need right now
154 | uint keyCount = locresData.GetUIntValue();
155 | for (int k = 0; k < keyCount; k++)
156 | {
157 | string KeyStr;
158 | uint KeyStrHash;
159 | ReadTextKey(locresData, Version, out KeyStrHash, out KeyStr);
160 | locresData.Skip(4);//SourceStringHash
161 |
162 | if (Version >= LocresVersion.Compact)
163 | {
164 | int localizedStringIndex = locresData.GetIntValue();
165 | if (Strings.Count > localizedStringIndex)
166 | {
167 | Strings[localizedStringIndex][0] = nameSpaceStr + "::" + KeyStr;
168 | }
169 | }
170 |
171 | }
172 |
173 | }
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 | }
185 |
186 | private void ReadTextKey(MemoryList memoryList, LocresVersion locresVersion, out uint StrHash, out string Str)
187 | {
188 | StrHash = 0;
189 | Str = "";
190 | if (locresVersion >= LocresVersion.Optimized)
191 | {
192 | StrHash = memoryList.GetUIntValue();
193 | }
194 |
195 | Str = memoryList.GetStringUE();
196 | }
197 |
198 |
199 | private void ModifyStrings()
200 | {
201 | CurrentIndex = 0;
202 | ReadOrEdit(true);
203 | }
204 |
205 | public void SaveFile(string FilPath)
206 | {
207 | ModifyStrings();
208 | locresData.WriteFile(FilPath);
209 | }
210 |
211 | public void AddItemsToDataGridView(DataGridView dataGrid)
212 | {
213 | throw new NotImplementedException();
214 | }
215 |
216 | public void LoadFromDataGridView(DataGridView dataGrid)
217 | {
218 | throw new NotImplementedException();
219 | }
220 |
221 | public List> ExtractTexts()
222 | {
223 | throw new NotImplementedException();
224 | }
225 |
226 | public void ImportTexts(List> strings)
227 | {
228 | throw new NotImplementedException();
229 | }
230 | }
231 | }
232 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Games/J5BinderAsset.cs:
--------------------------------------------------------------------------------
1 | using AssetParser;
2 | using Helper.MemoryList;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Runtime.InteropServices;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace UE4localizationsTool.Core.Games
12 | {
13 |
14 |
15 | /*
16 | * Game:Jump Force
17 | * File:systemtext_EN.uasset
18 | */
19 |
20 | public class J5BinderAsset
21 | {
22 | //public MemoryList MemoryList { get; }
23 | public Uexp Uexp { get; }
24 | public bool Modify { get; }
25 |
26 | MemoryList StreamMemory;
27 |
28 | public J5BinderAsset(MemoryList memoryList, Uexp uexp, bool Modify = false)
29 | {
30 | // MemoryList = memoryList;
31 | Uexp = uexp;
32 | this.Modify = Modify;
33 |
34 | memoryList.GetIntValue();//Null
35 | var Baseposition = memoryList.GetPosition();
36 | var BufferSize = (int)memoryList.GetInt64Value();
37 | StreamMemory=new MemoryList(memoryList.GetBytes(BufferSize));
38 | load();
39 |
40 |
41 | if (Modify)
42 | {
43 | Build();
44 | memoryList.SetSize(Baseposition);
45 |
46 | memoryList.SetInt64Value(StreamMemory.MemoryListSize);
47 | memoryList.SetBytes(StreamMemory.ToArray());
48 | }
49 |
50 | }
51 |
52 |
53 | [StructLayout(LayoutKind.Sequential, Pack = 1)]
54 | private class Header
55 | {
56 | public ulong Magic;
57 | public int Type;//??
58 | public int TablesCount;
59 | public int unk;//=48
60 | public int TableBlockSize;
61 | public long unk2;//=0
62 | public long Baseoffset;
63 | public long unk3;//=48
64 | }
65 |
66 | private class TableInfo
67 | {
68 | public int TableIndex;
69 | public int Type;//=16 ??
70 | public long TableSize;
71 | public long TableUSize;
72 | public ulong TableHash;
73 | public long TableNameoffset;
74 | public long NextTableOffset;
75 | public long TableOffset;//from +=Baseoffset
76 |
77 | public string TableName;
78 | public STXTENLL Stxt;
79 |
80 |
81 | public static TableInfo Read(MemoryList memoryList)
82 | {
83 | var tableInfo = new TableInfo();
84 | tableInfo.TableIndex = memoryList.GetIntValue();
85 | tableInfo.Type = memoryList.GetIntValue();
86 | tableInfo.TableSize= memoryList.GetInt64Value();
87 | tableInfo.TableUSize = memoryList.GetInt64Value();
88 | tableInfo.TableHash = memoryList.GetUInt64Value();
89 | tableInfo.TableNameoffset = memoryList.GetInt64Value();
90 | tableInfo.NextTableOffset = memoryList.GetInt64Value();
91 | tableInfo.TableOffset = memoryList.GetInt64Value();
92 |
93 | tableInfo.TableName= memoryList.GetStringValueN(false,(int)tableInfo.TableNameoffset);
94 |
95 | return tableInfo;
96 | }
97 |
98 | public void Write(MemoryList memoryList)
99 | {
100 | memoryList.SetIntValue(TableIndex);
101 | memoryList.SetIntValue(Type);
102 | memoryList.SetInt64Value(TableSize);
103 | memoryList.SetInt64Value(TableUSize);
104 | memoryList.SetUInt64Value(TableHash);
105 | memoryList.SetInt64Value(TableNameoffset);
106 | memoryList.SetInt64Value(NextTableOffset);
107 | memoryList.SetInt64Value(TableOffset);
108 | }
109 |
110 | }
111 |
112 |
113 | public class STXTENLL
114 | {
115 | [StructLayout(LayoutKind.Sequential, Pack = 1)]
116 | public class Header
117 | {
118 | public ulong Magic;
119 | public int Type;//??
120 | public int HeaderSize;
121 | public int TableBufferSize;
122 | public int TablesCount;
123 | public ulong unko;//??=1200
124 | }
125 |
126 | public class TableInfo
127 | {
128 | public int Index;
129 | public int StringOffset;
130 | public string Value;
131 | public static TableInfo Read(MemoryList memoryList)
132 | {
133 | var tableInfo = new TableInfo();
134 | tableInfo.Index = memoryList.GetIntValue();
135 | tableInfo.StringOffset = memoryList.GetIntValue();
136 | tableInfo.Value = memoryList.GetStringUE(SavePosition: false,SeekAndRead: tableInfo.StringOffset, encoding: Encoding.Unicode);
137 | return tableInfo;
138 | }
139 | public void Write(MemoryList memoryList)
140 | {
141 | memoryList.SetIntValue(Index);
142 | memoryList.SetIntValue(StringOffset);
143 | }
144 | }
145 |
146 |
147 | public Header header;
148 | public TableInfo[] tableInfos;
149 |
150 | public static STXTENLL Read(MemoryList memoryList)
151 | {
152 | var stxt = new STXTENLL();
153 | stxt.header = memoryList.GetStructureValues();
154 |
155 | if(stxt.header.Magic!= 0x4C4C4E4554585453)
156 | {
157 | throw new Exception("stxt.header.Magic!=0x4C4C4E4554585453");
158 | }
159 |
160 | stxt.tableInfos = new TableInfo[stxt.header.TablesCount];
161 | for (int i = 0; i < stxt.header.TablesCount; i++)
162 | {
163 | stxt.tableInfos[i] = TableInfo.Read(memoryList);
164 | }
165 | return stxt;
166 | }
167 |
168 | public byte[] Build()
169 | {
170 | var memoryList = new MemoryList();
171 | memoryList.SetStructureValus(header);
172 |
173 | var Position = memoryList.GetPosition();
174 | memoryList.SetBytes(new byte[header.TableBufferSize*header.TablesCount]);
175 |
176 | foreach (var tableInfo in tableInfos)
177 | {
178 | tableInfo.StringOffset = memoryList.GetPosition();
179 | memoryList.SetStringUE(tableInfo.Value,encoding:Encoding.Unicode);
180 | }
181 | memoryList.Seek(Position);
182 |
183 |
184 | foreach (var tableInfo in tableInfos)
185 | {
186 | tableInfo.Write(memoryList);
187 | }
188 |
189 | return memoryList.ToArray();
190 | }
191 |
192 |
193 | }
194 |
195 |
196 |
197 | Header header;
198 | TableInfo[] tableInfos;
199 | private void load()
200 | {
201 | header = StreamMemory.GetStructureValues();
202 |
203 | if(header.Magic != 0x4C4C46444E42)
204 | {
205 | throw new Exception("J5BinderAssetMagic!=0x4C4C46444E42");
206 | }
207 |
208 | tableInfos=new TableInfo[header.TablesCount];
209 | for (int i = 0; i < header.TablesCount; i++)
210 | {
211 | tableInfos[i] = TableInfo.Read(StreamMemory);
212 | }
213 |
214 | for (int i = 0; i < header.TablesCount; i++)
215 | {
216 | StreamMemory.Seek((int)(header.Baseoffset + tableInfos[i].TableOffset));
217 | tableInfos[i].Stxt = STXTENLL.Read(new MemoryList(StreamMemory.GetBytes((int)tableInfos[i].TableSize)));
218 | }
219 |
220 |
221 | foreach(var tableInfo in tableInfos)
222 | {
223 | foreach(var stxt in tableInfo.Stxt.tableInfos)
224 | {
225 | Uexp.Strings.Add(new List() { tableInfo.TableName, stxt.Value });
226 | }
227 | }
228 |
229 |
230 | }
231 |
232 |
233 | private void Build()
234 | {
235 | StreamMemory.Seek((int)(header.Baseoffset));
236 | StreamMemory.SetSize((int)(header.Baseoffset));
237 |
238 | foreach (var tableInfo in tableInfos)
239 | {
240 | foreach (var stxt in tableInfo.Stxt.tableInfos)
241 | {
242 | stxt.Value = Uexp.Strings[Uexp.CurrentIndex++][1];
243 | }
244 | }
245 |
246 |
247 | foreach (var tableInfo in tableInfos)
248 | {
249 | var buffer= tableInfo.Stxt.Build();
250 | tableInfo.TableOffset = StreamMemory.GetPosition() - header.Baseoffset;
251 | tableInfo.TableSize= buffer.Length;
252 | tableInfo.TableUSize = buffer.Length;
253 | StreamMemory.SetBytes(buffer);
254 | }
255 |
256 | StreamMemory.Seek(0);
257 |
258 | StreamMemory.SetStructureValus(header);
259 |
260 | foreach (var tableInfo in tableInfos)
261 | {
262 | tableInfo.Write(StreamMemory);
263 | }
264 |
265 | }
266 |
267 |
268 |
269 |
270 | }
271 | }
272 |
--------------------------------------------------------------------------------
/UE4localizationsTool/UE4localizationsTool.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C8AA2127-04A4-400B-9CA3-1951639BB0A3}
8 | WinExe
9 | UE4localizationsTool
10 | UE4localizationsTool
11 | v4.8
12 | 512
13 | true
14 |
15 | false
16 | false
17 | publish\
18 | true
19 | Disk
20 | false
21 | Foreground
22 | 7
23 | Days
24 | false
25 | false
26 | true
27 | 30
28 | 1.0.0.%2a
29 | false
30 | true
31 | true
32 |
33 |
34 | AnyCPU
35 | true
36 | full
37 | false
38 | bin\Debug\
39 | TRACE;DEBUG
40 | prompt
41 | 4
42 | true
43 | false
44 | MinimumRecommendedRules.ruleset
45 | false
46 | true
47 | false
48 |
49 |
50 | AnyCPU
51 | pdbonly
52 | true
53 | bin\Release\
54 | TRACE
55 | prompt
56 | 4
57 | true
58 | false
59 |
60 |
61 |
62 |
63 |
64 |
65 | UE4.ico
66 |
67 |
68 | 229D3435F313D5500E79AF3C1D8B4B3C8AD39913
69 |
70 |
71 | UE4localizationsTool_TemporaryKey.pfx
72 |
73 |
74 | false
75 |
76 |
77 | false
78 |
79 |
80 |
81 |
82 | LocalIntranet
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | true
91 |
92 |
93 |
94 |
95 | Component
96 |
97 |
98 | Form
99 |
100 |
101 | Component
102 |
103 |
104 | UserControl
105 |
106 |
107 | SearchBox.cs
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 | Form
136 |
137 |
138 | FrmAbout.cs
139 |
140 |
141 | Form
142 |
143 |
144 | FrmFilter.cs
145 |
146 |
147 | Form
148 |
149 |
150 | FrmLocresEntryEditor.cs
151 |
152 |
153 | Form
154 |
155 |
156 | FrmMain.cs
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 | SearchBox.cs
165 |
166 |
167 | FrmAbout.cs
168 |
169 |
170 | FrmFilter.cs
171 |
172 |
173 | FrmLocresEntryEditor.cs
174 |
175 |
176 | FrmMain.cs
177 | Designer
178 |
179 |
180 | ResXFileCodeGenerator
181 | Resources.Designer.cs
182 | Designer
183 |
184 |
185 | True
186 | Resources.resx
187 | True
188 |
189 |
190 |
191 |
192 | SettingsSingleFileGenerator
193 | Settings.Designer.cs
194 |
195 |
196 | True
197 | Settings.settings
198 | True
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 | False
207 | Microsoft .NET Framework 4.7.2 %28x86 and x64%29
208 | true
209 |
210 |
211 | False
212 | .NET Framework 3.5 SP1
213 | false
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 | ..\packages\Csv.2.0.93\lib\net40\Csv.dll
223 | False
224 | False
225 | True
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/IoPackage.cs:
--------------------------------------------------------------------------------
1 | using AssetParser.Object;
2 | using Helper.MemoryList;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 |
8 | namespace AssetParser
9 | {
10 | public class IoPackage : IUasset
11 | {
12 | public int LegacyFileVersion { get; set; }
13 | public UEVersions EngineVersion { get; set; }
14 | public EPackageFlags PackageFlags { get; set; }
15 | public int File_Directory_Offset { get; set; }
16 | public int Number_of_Names { get; set; }
17 | public int Name_Directory_Offset { get; set; }
18 | public int Number_Of_Exports { get; set; }
19 | public int Exports_Directory_Offset { get; set; }
20 | public int Number_Of_Imports { get; set; }
21 | public int Imports_Directory_Offset { get; set; }
22 | public int ExportBundleEntriesOffset { get; set; }
23 | public List NAMES_DIRECTORY { get; set; }
24 | public List Imports_Directory { get; set; }
25 | public List Exports_Directory { get; set; }
26 | public MemoryList UassetFile { get; set; }
27 | public bool IOFile { get; set; } = true;
28 | public bool IsNotUseUexp { get; set; }
29 | public bool UseFromStruct { get; set; } = true;
30 | public bool AutoVersion { get; set; }
31 | public bool UseMethod2 { get; set; }
32 |
33 |
34 | public int Header_Size { get; set; }
35 | public int Name_Directory_Size { get; set; }
36 | public int Hash_Directory_offset { get; set; }
37 | public int Hash_Directory_Size { get; set; }
38 | public int Bundles_Offset { get; set; }
39 | public int GraphData_Offset { get; set; }
40 | public int GraphData_Size { get; set; }
41 | public int PathCount { get; set; } = 0;
42 | public bool PathModify { get; set; } = true;
43 |
44 | public IoPackage(string FilePath)
45 | {
46 | UassetFile = new MemoryList(FilePath);
47 | //Todo
48 |
49 | IsNotUseUexp = true;
50 | UassetFile.MemoryListPosition = 0;
51 | ConsoleMode.Print("Reading Uasset Header...");
52 | Console.WriteLine(UassetFile.GetIntValue(false, 4));
53 |
54 |
55 |
56 | UassetFile.Seek(UassetFile.GetIntValue(false, 24), SeekOrigin.Begin);
57 |
58 | string path = UassetFile.GetStringUES();
59 | UassetFile.Seek(0, SeekOrigin.Begin);
60 |
61 |
62 | if (path.StartsWith("/"))
63 | {
64 | EngineVersion = UEVersions.VER_UE4_16; //?!
65 | UE4Header();
66 | }
67 | else
68 | {
69 | EngineVersion = UEVersions.VER_UE5_0; //?!
70 | UE5Header();
71 | }
72 |
73 | //ScarletNexus-> Game/L10N
74 | if (NAMES_DIRECTORY.First().StartsWith("/Game/L10N/"))
75 | {
76 | UseMethod2 = true;
77 | }
78 | }
79 |
80 | private void UE4Header()
81 | {
82 | UassetFile.Skip(16 + 4);
83 | Header_Size = UassetFile.GetIntValue();
84 | Name_Directory_Offset = UassetFile.GetIntValue();
85 | Name_Directory_Size = UassetFile.GetIntValue();
86 | Hash_Directory_offset = UassetFile.GetIntValue();
87 | Hash_Directory_Size = UassetFile.GetIntValue();
88 | Imports_Directory_Offset = UassetFile.GetIntValue();
89 | Exports_Directory_Offset = UassetFile.GetIntValue();
90 | Bundles_Offset = UassetFile.GetIntValue();
91 | GraphData_Offset = UassetFile.GetIntValue();
92 | GraphData_Size = UassetFile.GetIntValue();
93 |
94 |
95 | File_Directory_Offset = GraphData_Offset + GraphData_Size;
96 | Number_of_Names = Hash_Directory_Size / 8;
97 | Number_Of_Exports = (Bundles_Offset - Exports_Directory_Offset) / 72 /*Block Size*/;
98 | Number_Of_Imports = (Exports_Directory_Offset - Imports_Directory_Offset) / 8 /*Block Size*/;
99 |
100 |
101 | //seek to position
102 | UassetFile.Seek(Name_Directory_Offset, SeekOrigin.Begin);
103 | //Get Names
104 | NAMES_DIRECTORY = new List();
105 | for (int n = 0; n < Number_of_Names; n++)
106 | {
107 | NAMES_DIRECTORY.Add(UassetFile.GetStringUES());
108 | if (NAMES_DIRECTORY[n].Contains(@"/") && PathModify)
109 | {
110 | PathCount++;
111 | }
112 | else
113 | {
114 | PathModify = false;
115 | }
116 | }
117 |
118 | //UassetFile.Seek(Hash_Directory_offset, SeekOrigin.Begin);
119 |
120 | //seek to position
121 | UassetFile.Seek(Exports_Directory_Offset, SeekOrigin.Begin);
122 | //Get Exports
123 | Exports_Directory = new List();
124 | ExportReadOrEdit();
125 | }
126 |
127 | private void UE5Header()
128 | {
129 | //this for ue5_0 only
130 | bool bHasVersioningInfo = UassetFile.GetUIntValue() == 1;
131 | Header_Size = UassetFile.GetIntValue();
132 | UassetFile.Skip(8); //name
133 | UassetFile.Skip(4); //PackageFlags
134 | UassetFile.Skip(4); //CookedHeaderSize
135 | UassetFile.Skip(4); //ImportedPublicExportHashesOffset
136 | Imports_Directory_Offset = UassetFile.GetIntValue();
137 | Exports_Directory_Offset = UassetFile.GetIntValue();
138 | ExportBundleEntriesOffset = UassetFile.GetIntValue();
139 | UassetFile.Skip(4); //GraphDataOffset
140 |
141 | File_Directory_Offset = Header_Size;
142 | Number_Of_Exports = (ExportBundleEntriesOffset - Exports_Directory_Offset) / 72;
143 | Number_Of_Imports = (Exports_Directory_Offset - Imports_Directory_Offset) / sizeof(long);
144 |
145 |
146 | if (bHasVersioningInfo)
147 | {
148 | throw new Exception("Not supported uasset!");
149 | }
150 |
151 | //----------------------
152 | //Get Names
153 | NAMES_DIRECTORY = new List();
154 | Number_of_Names = UassetFile.GetIntValue();
155 | int NamesBlockSize = UassetFile.GetIntValue();
156 | UassetFile.Skip(8); //hashVersion
157 | UassetFile.Skip(Number_of_Names * sizeof(long));//hashes
158 | var NamesHeader = UassetFile.GetShorts(Number_of_Names);
159 |
160 | foreach (var header in NamesHeader)
161 | {
162 | NAMES_DIRECTORY.Add(UassetFile.GetStringUES(header));
163 | }
164 |
165 |
166 | //Get Exports
167 | UassetFile.Seek(Exports_Directory_Offset, SeekOrigin.Begin);
168 | Exports_Directory = new List();
169 | ExportReadOrEdit();
170 | }
171 |
172 | public void EditName(string NewStr, int Index)
173 | {
174 | return;
175 | }
176 |
177 | public void ExportReadOrEdit(bool Modify = false)
178 | {
179 | //seek to position
180 | UassetFile.Seek(Exports_Directory_Offset, SeekOrigin.Begin);
181 | int NextExportPosition = File_Directory_Offset;
182 |
183 | for (int n = 0; n < Number_Of_Exports; n++)
184 | {
185 | int Start = UassetFile.GetPosition();
186 | ExportsDirectory ExportsDirectory = new ExportsDirectory();
187 | ExportsDirectory.ExportStart = File_Directory_Offset;
188 | if (!Modify)
189 | {
190 | UassetFile.Skip(8);
191 | ExportsDirectory.ExportLength = (int)UassetFile.GetInt64Value();
192 | }
193 | else
194 | {
195 | UassetFile.SetInt64Value(Header_Size + (NextExportPosition - File_Directory_Offset));
196 | UassetFile.SetInt64Value(Exports_Directory[n].ExportData.Count);
197 | }
198 | ExportsDirectory.ExportName = UassetFile.GetIntValue();
199 | UassetFile.Skip(4);
200 | UassetFile.Skip(8);
201 |
202 | //Wrong way
203 | ulong Class = UassetFile.GetUInt64Value();//CityHash64 ?!
204 |
205 | switch (Class)
206 | {
207 | case 0x71E24A29987BD1EDu:
208 | if (!NAMES_DIRECTORY.Contains("DataTable"))
209 | {
210 | NAMES_DIRECTORY.Add("DataTable");
211 | }
212 | ExportsDirectory.ExportClass = NAMES_DIRECTORY.IndexOf("DataTable");
213 | break;
214 | case 0x70289FB93F770603u:
215 |
216 | if (!NAMES_DIRECTORY.Contains("StringTable"))
217 | {
218 | NAMES_DIRECTORY.Add("StringTable");
219 | }
220 | ExportsDirectory.ExportClass = NAMES_DIRECTORY.IndexOf("StringTable");
221 |
222 | break;
223 | case 0x574F27AEC05072D0u:
224 | if (!NAMES_DIRECTORY.Contains("Function"))
225 | {
226 | NAMES_DIRECTORY.Add("Function");
227 | }
228 | ExportsDirectory.ExportClass = NAMES_DIRECTORY.IndexOf("Function");
229 | break;
230 | default:
231 | {
232 | if (!NAMES_DIRECTORY.Contains("StructProperty"))
233 | {
234 | NAMES_DIRECTORY.Add("StructProperty");
235 | }
236 | ExportsDirectory.ExportClass = NAMES_DIRECTORY.IndexOf("StructProperty");
237 | break;
238 | }
239 | }
240 |
241 |
242 | if (!Modify)
243 | {
244 | ExportsDirectory.ExportData = new List();
245 | ExportsDirectory.ExportData.AddRange(UassetFile.GetBytes(ExportsDirectory.ExportLength, false, NextExportPosition));
246 | Exports_Directory.Add(ExportsDirectory);
247 | }
248 |
249 | NextExportPosition += ExportsDirectory.ExportLength;
250 | UassetFile.Seek(Start + 72);
251 | }
252 |
253 |
254 | }
255 |
256 |
257 | public void UpdateOffset()
258 | {
259 |
260 | }
261 | }
262 | }
263 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Controls/NForm.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 | using System.Windows.Forms;
3 |
4 | namespace UE4localizationsTool.Controls
5 | {
6 | public class NForm : Form
7 | {
8 | protected override void CreateHandle()
9 | {
10 | base.CreateHandle();
11 | if (Properties.Settings.Default.DarkMode)
12 | DarkMode(this);
13 | }
14 |
15 | #if DEBUG
16 |
17 | protected override void OnLoad(System.EventArgs e)
18 | {
19 | GetAllControlNames(this, Name);
20 | }
21 |
22 | private void GetAllControlNames(Control control, string parentName)
23 | {
24 | string controlName = parentName;
25 |
26 | if (control is TextBox || control is Label || control is Button || control is ComboBox
27 | || control is ListBox || control is DataGridView || control is CheckBox)
28 | {
29 | controlName += $".{control.Name}";
30 | //control.GetType().GetProperty("Text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).SetValue(column, "amr");
31 | Console.WriteLine(controlName);
32 |
33 | if (control is DataGridView)
34 | {
35 | foreach (DataGridViewColumn column in ((DataGridView)control).Columns)
36 | {
37 | Console.WriteLine(controlName + "." + column.Name);
38 | //column.HeaderText = "amr";
39 | // column.GetType().GetProperty("HeaderText", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).SetValue(column, "amr");
40 | }
41 | }
42 |
43 | }
44 | else if (control is ToolStripMenuItem)
45 | {
46 | controlName += $".{control.Name}";
47 | //control.GetType().GetProperty("Text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).SetValue(column, "amr");
48 | Console.WriteLine(controlName);
49 | }
50 |
51 | foreach (Control childControl in control.Controls)
52 | {
53 | GetAllControlNames(childControl, controlName);
54 | }
55 |
56 | if (control.ContextMenuStrip != null)
57 | {
58 | foreach (ToolStripMenuItem toolStripItem in control.ContextMenuStrip.Items)
59 | {
60 | GetAllContextMenuNames(toolStripItem, controlName);
61 | }
62 | }
63 |
64 | if (control is MenuStrip)
65 | {
66 | foreach (var toolStripItem in ((MenuStrip)control).Items)
67 | {
68 | if (toolStripItem is ToolStripMenuItem)
69 | GetAllContextMenuNames((ToolStripMenuItem)toolStripItem, controlName);
70 | }
71 | }
72 | }
73 |
74 | private void GetAllContextMenuNames(ToolStripMenuItem control, string parentName)
75 | {
76 | string controlName = parentName;
77 |
78 | if (control is ToolStripMenuItem)
79 | {
80 | controlName += $".{(control as ToolStripMenuItem).Name}";
81 | //control.GetType().GetProperty("Text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).SetValue(column, "amr");
82 | Console.WriteLine(controlName);
83 | }
84 |
85 | // Recursively call the method for child controls
86 | foreach (ToolStripItem childControl in control.DropDownItems)
87 | {
88 | if (childControl is ToolStripMenuItem)
89 | {
90 | GetAllContextMenuNames(childControl as ToolStripMenuItem, controlName);
91 | }
92 | }
93 | }
94 |
95 | #endif
96 |
97 | public void DarkMode(Control control)
98 | {
99 | if (control == null) return;
100 |
101 | if (!(control.BackColor.R == control.BackColor.G && control.BackColor.G == control.BackColor.B) ||
102 | !(control.ForeColor.R == control.ForeColor.G && control.ForeColor.G == control.ForeColor.B))
103 | {
104 | return;
105 | }
106 |
107 | control.BackColor = Color.FromArgb(30, 30, 30);
108 | control.ForeColor = Color.White;
109 |
110 | if (control is ListView listView)
111 | {
112 | listView.OwnerDraw = true;
113 | listView.DrawItem += (c, e) => e.DrawDefault = true;
114 | listView.DrawSubItem += (c, e) => e.DrawDefault = true;
115 | listView.DrawColumnHeader += (c, e) =>
116 | {
117 | e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(50, 50, 50)), e.Bounds);
118 | e.Graphics.DrawString(e.Header.Text, e.Font, new SolidBrush(Color.White), e.Bounds);
119 | };
120 | }
121 | else if (control is DataGridView dataGridView)
122 | {
123 | dataGridView.BackgroundColor = Color.FromArgb(30, 30, 30);
124 | dataGridView.DefaultCellStyle.BackColor = Color.FromArgb(40, 40, 40);
125 | dataGridView.DefaultCellStyle.ForeColor = Color.White;
126 | dataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(50, 50, 50);
127 | dataGridView.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
128 | dataGridView.EnableHeadersVisualStyles = false;
129 | dataGridView.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
130 | dataGridView.RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(70, 70, 70);
131 | dataGridView.RowsDefaultCellStyle.SelectionForeColor = Color.White;
132 | DarkMode(dataGridView.ContextMenuStrip);
133 | }
134 | else if (control is Panel panel)
135 | {
136 | panel.BackColor = Color.FromArgb(30, 30, 30);
137 | foreach (Control childControl in panel.Controls)
138 | {
139 | DarkMode(childControl);
140 | }
141 | }
142 | else if (control is TextBox textBox)
143 | {
144 | textBox.BackColor = Color.FromArgb(40, 40, 40);
145 | textBox.ForeColor = Color.White;
146 | textBox.BorderStyle = BorderStyle.FixedSingle;
147 | }
148 | else if (control is ComboBox comboBox)
149 | {
150 | comboBox.BackColor = Color.FromArgb(40, 40, 40);
151 | comboBox.ForeColor = Color.White;
152 | }
153 | else if (control is CheckBox || control is RadioButton)
154 | {
155 | control.ForeColor = Color.White;
156 | }
157 | else if (control is Button button)
158 | {
159 | button.BackColor = Color.FromArgb(40, 40, 40);
160 | button.ForeColor = Color.White;
161 | button.FlatStyle = FlatStyle.Flat;
162 | button.FlatAppearance.BorderColor = Color.FromArgb(60, 60, 60);
163 | button.FlatAppearance.MouseOverBackColor = Color.FromArgb(60, 60, 60);
164 | }
165 | else if (control is MenuStrip || control is ContextMenuStrip)
166 | {
167 | control.BackColor = Color.FromArgb(30, 30, 30);
168 | control.ForeColor = Color.White;
169 | if (control is MenuStrip menuStrip)
170 | {
171 | menuStrip.RenderMode = ToolStripRenderMode.Professional;
172 | menuStrip.Renderer = new DarkModeMenuStripRenderer(new CustomColorTable());
173 | }
174 | else if (control is ContextMenuStrip contextMenuStrip)
175 | {
176 | contextMenuStrip.RenderMode = ToolStripRenderMode.Professional;
177 | contextMenuStrip.Renderer = new DarkModeMenuStripRenderer(new CustomColorTable());
178 | }
179 | }
180 | else if (control is SplitContainer splitContainer)
181 | {
182 | splitContainer.BackColor = Color.FromArgb(30, 30, 30);
183 | splitContainer.ForeColor = Color.White;
184 | DarkMode(splitContainer.Panel1);
185 | DarkMode(splitContainer.Panel2);
186 | }
187 | else if (control is PictureBox || control is Label)
188 | {
189 | control.BackColor = Color.FromArgb(30, 30, 30);
190 | control.ForeColor = Color.White;
191 | }
192 |
193 | foreach (Control childControl in control.Controls)
194 | {
195 | DarkMode(childControl);
196 | }
197 | }
198 |
199 | public class DarkModeMenuStripRenderer : ToolStripProfessionalRenderer
200 | {
201 | public DarkModeMenuStripRenderer(ProfessionalColorTable colorTable)
202 | : base(colorTable)
203 | {
204 | }
205 |
206 | protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
207 | {
208 | e.TextColor = Color.White;
209 | base.OnRenderItemText(e);
210 | }
211 | }
212 |
213 | public class CustomColorTable : ProfessionalColorTable
214 | {
215 | public override Color MenuStripGradientBegin => Color.FromArgb(30, 30, 30);
216 | public override Color MenuStripGradientEnd => Color.FromArgb(30, 30, 30);
217 | public override Color MenuItemSelected => Color.FromArgb(63, 63, 70);
218 | public override Color MenuItemBorder => Color.FromArgb(63, 63, 70);
219 | public override Color MenuItemSelectedGradientBegin => Color.FromArgb(63, 63, 70);
220 | public override Color MenuItemSelectedGradientEnd => Color.FromArgb(63, 63, 70);
221 | public override Color MenuItemPressedGradientBegin => Color.FromArgb(63, 63, 70);
222 | public override Color MenuItemPressedGradientEnd => Color.FromArgb(63, 63, 70);
223 | public override Color MenuBorder => Color.FromArgb(63, 63, 70);
224 | public override Color ToolStripDropDownBackground => Color.FromArgb(30, 30, 30);
225 | public override Color ImageMarginGradientBegin => Color.FromArgb(30, 30, 30);
226 | public override Color ImageMarginGradientMiddle => Color.FromArgb(30, 30, 30);
227 | public override Color ImageMarginGradientEnd => Color.FromArgb(30, 30, 30);
228 | public override Color ToolStripBorder => Color.FromArgb(63, 63, 70);
229 | public override Color ToolStripContentPanelGradientBegin => Color.FromArgb(30, 30, 30);
230 | public override Color ToolStripContentPanelGradientEnd => Color.FromArgb(30, 30, 30);
231 | public override Color ToolStripGradientBegin => Color.FromArgb(30, 30, 30);
232 | public override Color ToolStripGradientMiddle => Color.FromArgb(30, 30, 30);
233 | public override Color ToolStripGradientEnd => Color.FromArgb(30, 30, 30);
234 | }
235 | }
236 | }
237 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Controls/SearchBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Text.RegularExpressions;
4 | using System.Windows.Forms;
5 |
6 | namespace UE4localizationsTool.Controls
7 | {
8 | public partial class SearchBox : UserControl
9 | {
10 |
11 | private string ColumnName = "Text value";
12 |
13 | [Browsable(true)]
14 | public NDataGridView DataGridView { get; set; }
15 | int CurrentRowIndex = -1;
16 | int CurrentColumnIndex = -1;
17 |
18 | public SearchBox()
19 | {
20 | InitializeComponent();
21 | Hide();
22 | }
23 | public SearchBox(NDataGridView dataGrid)
24 | {
25 | DataGridView = dataGrid;
26 | InitializeComponent();
27 | Hide();
28 | }
29 |
30 | private void SearchHide_Click(object sender, System.EventArgs e)
31 | {
32 | Hide();
33 | listView1.Visible = false;
34 | label2.Text = string.Empty;
35 | }
36 |
37 | private bool IsMatch(string value)
38 | {
39 | string searchText = InputSearch.Text;
40 |
41 | if (string.IsNullOrWhiteSpace(searchText))
42 | return false;
43 |
44 | return value.IndexOf(searchText, StringComparison.OrdinalIgnoreCase) > -1;
45 | }
46 |
47 | private bool IsMatch(string value, string match)
48 | {
49 | if (string.IsNullOrWhiteSpace(match))
50 | return false;
51 |
52 | return value.IndexOf(match, StringComparison.OrdinalIgnoreCase) > -1;
53 | }
54 |
55 |
56 | private DataGridViewCell FindCell(int startRowIndex, int endRowIndex, string columnName, string value, bool endToTop = false, bool returnNullIfNotFound = false)
57 | {
58 | int step = endToTop ? -1 : 1;
59 |
60 | for (int rowIndex = startRowIndex; endToTop ? rowIndex > endRowIndex : rowIndex < endRowIndex; rowIndex += step)
61 | {
62 | if (DataGridView.Columns.Contains(columnName))
63 | {
64 | DataGridViewCell cell = DataGridView.Rows[rowIndex].Cells[columnName];
65 | if (cell.Value != null && IsMatch(cell.Value.ToString(), value))
66 | {
67 | return cell;
68 | }
69 | }
70 | }
71 |
72 | if (returnNullIfNotFound)
73 | {
74 | return null;
75 | }
76 |
77 | return FindCell(endToTop ? DataGridView.Rows.Count - 1 : 0, endToTop ? startRowIndex : endRowIndex, columnName, value, endToTop, true);
78 | }
79 |
80 |
81 | private void FindNext_Click(object sender, EventArgs e)
82 | {
83 | if (DataGridView.Rows.Count == 0)
84 | {
85 | MessageBox.Show("No data found.", "Search Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
86 | return;
87 | }
88 |
89 | var selectedCell = DataGridView.SelectedCells.Count > 0 ? DataGridView.SelectedCells[0] : DataGridView.Rows[0].Cells[ColumnName];
90 |
91 | var cell = FindCell(selectedCell.RowIndex + 1, DataGridView.Rows.Count, ColumnName, InputSearch.Text);
92 |
93 | if (cell != null)
94 | {
95 |
96 | if (object.ReferenceEquals(cell, DataGridView.SelectedCells[0]))
97 | {
98 | MessageBox.Show("No more matches found.", "Search Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
99 | return;
100 | }
101 |
102 | SelectCell(cell.RowIndex, cell.ColumnIndex);
103 | }
104 | else
105 | {
106 | Failedmessage();
107 | }
108 |
109 | }
110 |
111 |
112 | private void FindPrevious_Click(object sender, EventArgs e)
113 | {
114 |
115 | if (DataGridView.Rows.Count == 0)
116 | {
117 | MessageBox.Show("No data found.", "Search Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
118 | return;
119 | }
120 |
121 | var selectedCell = DataGridView.SelectedCells.Count > 0 ? DataGridView.SelectedCells[0] : DataGridView.Rows[0].Cells[ColumnName];
122 |
123 | var cell = FindCell(selectedCell.RowIndex - 1, -1, ColumnName, InputSearch.Text, true);
124 |
125 | if (cell != null)
126 | {
127 |
128 | if (object.ReferenceEquals(cell, DataGridView.SelectedCells[0]))
129 | {
130 | MessageBox.Show("No more matches found.", "Search Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
131 | return;
132 | }
133 |
134 | SelectCell(cell.RowIndex, cell.ColumnIndex);
135 | }
136 | else
137 | {
138 | Failedmessage();
139 | }
140 | }
141 |
142 |
143 | private void Failedmessage()
144 | {
145 | MessageBox.Show(
146 | text: $"The searched value '{InputSearch.Text}' not found.",
147 | caption: "Search Result",
148 | buttons: MessageBoxButtons.OK,
149 | icon: MessageBoxIcon.Warning
150 | );
151 | }
152 |
153 | private void SelectCell(int rowIndex, int colIndex)
154 | {
155 | DataGridView.ClearSelection();
156 | DataGridView.FirstDisplayedScrollingRowIndex = rowIndex;
157 | DataGridView.Rows[rowIndex].Cells[colIndex].Selected = true;
158 |
159 | CurrentRowIndex = rowIndex;
160 | CurrentColumnIndex = colIndex;
161 | }
162 |
163 | private void InputSearch_KeyDown(object sender, KeyEventArgs e)
164 | {
165 | if (!InputSearch.Focused)
166 | {
167 | InputSearch.Focus();
168 | }
169 |
170 | if (e.KeyCode == Keys.Enter)
171 | {
172 | FindNext_Click(sender, e);
173 | }
174 | }
175 |
176 | public new void Show()
177 | {
178 | if (DataGridView.CurrentCell != null)
179 | {
180 | InputSearch.Text = DataGridView.CurrentCell.Value.ToString();
181 | }
182 | InputSearch.Focus();
183 |
184 | label2.Text = string.Empty;
185 | base.Show();
186 | }
187 |
188 | public void ShowReplacePanel()
189 | {
190 | Replacepanel.Visible = true;
191 | Show();
192 | txtReplace.Focus();
193 | }
194 |
195 | public int CountTotalMatches()
196 | {
197 | int totalMatches = 0;
198 |
199 | for (int rowIndex = 0; rowIndex < DataGridView.Rows.Count; rowIndex++)
200 | {
201 | for (int colIndex = 0; colIndex < DataGridView.Columns.Count; colIndex++)
202 | {
203 | if (rowIndex >= 0 && rowIndex < DataGridView.Rows.Count && colIndex >= 0 && colIndex < DataGridView.Columns.Count)
204 | {
205 | DataGridViewCell cell = DataGridView.Rows[rowIndex].Cells[colIndex];
206 | if (cell.Value != null && IsMatch(cell.Value.ToString()))
207 | {
208 | totalMatches++;
209 | }
210 | }
211 | }
212 | }
213 |
214 | return totalMatches;
215 | }
216 |
217 | string ButtonText;
218 | bool IsFindAll = false;
219 |
220 | private void FindAll_Click(object sender, EventArgs e)
221 | {
222 | Replacepanel.Visible = false;
223 |
224 | if (DataGridView.Rows.Count == 0)
225 | {
226 | MessageBox.Show("No data found.", "Search Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
227 | return;
228 | }
229 |
230 | listView1.Items.Clear();
231 |
232 | foreach (DataGridViewRow row in DataGridView.Rows)
233 | {
234 | if (DataGridView.Columns.Contains(ColumnName))
235 | {
236 | if (row.Cells[ColumnName].Value != null && IsMatch(row.Cells[ColumnName].Value.ToString()))
237 | {
238 | ListViewItem item = new ListViewItem();
239 | item.Text = (row.Index + 1).ToString();
240 | item.SubItems.Add(row.Cells[ColumnName].Value.ToString());
241 | item.Tag = row;
242 | listView1.Items.Add(item);
243 | }
244 | }
245 | }
246 | listView1.Visible = true;
247 | label2.Text = $"Total matches: {listView1.Items.Count}";
248 |
249 | }
250 |
251 |
252 | private void Replace_Click(object sender, EventArgs e)
253 | {
254 |
255 | void ReplaceCell(DataGridViewCell Cell)
256 | {
257 |
258 |
259 | DataGridView.SetValue(Cell, Regex.Replace(Cell.Value.ToString(), InputSearch.Text, txtReplace.Text, RegexOptions.IgnoreCase));
260 |
261 | }
262 |
263 | var selectedCell = DataGridView.SelectedCells.Count > 0 ? DataGridView.SelectedCells[0] : DataGridView.Rows[0].Cells[ColumnName];
264 |
265 |
266 |
267 | if (IsMatch(selectedCell.Value.ToString()))
268 | {
269 | ReplaceCell(selectedCell);
270 | return;
271 | }
272 |
273 | var cell = FindCell(selectedCell.RowIndex + 1, DataGridView.Rows.Count, ColumnName, InputSearch.Text);
274 |
275 | if (cell != null)
276 | {
277 | SelectCell(cell.RowIndex, cell.ColumnIndex);
278 | ReplaceCell(cell);
279 | }
280 | else
281 | {
282 | Failedmessage();
283 | }
284 | }
285 |
286 | private void label4_Click(object sender, EventArgs e)
287 | {
288 | Replacepanel.Visible = false;
289 | }
290 |
291 | private void listView1_SelectedIndexChanged(object sender, EventArgs e)
292 | {
293 | if (this.listView1.SelectedItems.Count == 0)
294 | return;
295 | var cell = (listView1.SelectedItems[0].Tag as DataGridViewRow).Cells[ColumnName];
296 |
297 | SelectCell(cell.RowIndex, cell.ColumnIndex);
298 | }
299 |
300 | private void ReplaceAll_Click(object sender, EventArgs e)
301 | {
302 | if (DataGridView.Rows.Count == 0)
303 | {
304 | MessageBox.Show("No data found.", "Search Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
305 | return;
306 | }
307 |
308 |
309 | int totalMatches = 0;
310 | foreach (DataGridViewRow row in DataGridView.Rows)
311 | {
312 | if (DataGridView.Columns.Contains(ColumnName))
313 | {
314 | if (row.Cells[ColumnName].Value != null && IsMatch(row.Cells[ColumnName].Value.ToString()))
315 | {
316 | DataGridView.SetValue(row.Cells[ColumnName], Regex.Replace(row.Cells[ColumnName].Value.ToString(), InputSearch.Text, txtReplace.Text, RegexOptions.IgnoreCase));
317 | totalMatches++;
318 | }
319 | }
320 | }
321 |
322 |
323 | MessageBox.Show($"Total matches replaced: {totalMatches}", "Search Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
324 | }
325 | }
326 | }
327 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Forms/FrmFilter.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace UE4localizationsTool
2 | {
3 | partial class FrmFilter
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmFilter));
32 | this.button1 = new System.Windows.Forms.Button();
33 | this.listBox1 = new System.Windows.Forms.ListBox();
34 | this.label1 = new System.Windows.Forms.Label();
35 | this.textBox1 = new System.Windows.Forms.TextBox();
36 | this.label3 = new System.Windows.Forms.Label();
37 | this.Add = new System.Windows.Forms.Button();
38 | this.RemoveSelected = new System.Windows.Forms.Button();
39 | this.ClearList = new System.Windows.Forms.Button();
40 | this.matchcase = new System.Windows.Forms.CheckBox();
41 | this.BtnClose = new System.Windows.Forms.Button();
42 | this.regularexpression = new System.Windows.Forms.CheckBox();
43 | this.reversemode = new System.Windows.Forms.CheckBox();
44 | this.Columns = new System.Windows.Forms.ComboBox();
45 | this.label2 = new System.Windows.Forms.Label();
46 | this.ColumnPanel = new System.Windows.Forms.Panel();
47 | this.ColumnPanel.SuspendLayout();
48 | this.SuspendLayout();
49 | //
50 | // button1
51 | //
52 | this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
53 | this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
54 | this.button1.Location = new System.Drawing.Point(261, 226);
55 | this.button1.Name = "button1";
56 | this.button1.Size = new System.Drawing.Size(80, 23);
57 | this.button1.TabIndex = 1;
58 | this.button1.Text = "Apply";
59 | this.button1.UseVisualStyleBackColor = true;
60 | this.button1.Click += new System.EventHandler(this.button1_Click);
61 | //
62 | // listBox1
63 | //
64 | this.listBox1.FormattingEnabled = true;
65 | this.listBox1.Location = new System.Drawing.Point(12, 25);
66 | this.listBox1.Name = "listBox1";
67 | this.listBox1.ScrollAlwaysVisible = true;
68 | this.listBox1.Size = new System.Drawing.Size(172, 199);
69 | this.listBox1.TabIndex = 2;
70 | //
71 | // label1
72 | //
73 | this.label1.AutoSize = true;
74 | this.label1.Location = new System.Drawing.Point(12, 9);
75 | this.label1.Name = "label1";
76 | this.label1.Size = new System.Drawing.Size(67, 13);
77 | this.label1.TabIndex = 3;
78 | this.label1.Text = "Filter Values:";
79 | //
80 | // textBox1
81 | //
82 | this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
83 | | System.Windows.Forms.AnchorStyles.Right)));
84 | this.textBox1.Location = new System.Drawing.Point(228, 25);
85 | this.textBox1.Name = "textBox1";
86 | this.textBox1.Size = new System.Drawing.Size(207, 20);
87 | this.textBox1.TabIndex = 4;
88 | //
89 | // label3
90 | //
91 | this.label3.AutoSize = true;
92 | this.label3.Location = new System.Drawing.Point(191, 28);
93 | this.label3.Name = "label3";
94 | this.label3.Size = new System.Drawing.Size(34, 13);
95 | this.label3.TabIndex = 5;
96 | this.label3.Text = "Input:";
97 | //
98 | // Add
99 | //
100 | this.Add.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
101 | this.Add.Location = new System.Drawing.Point(441, 23);
102 | this.Add.Name = "Add";
103 | this.Add.Size = new System.Drawing.Size(115, 23);
104 | this.Add.TabIndex = 6;
105 | this.Add.Text = "Add";
106 | this.Add.UseVisualStyleBackColor = true;
107 | this.Add.Click += new System.EventHandler(this.Add_Click);
108 | //
109 | // RemoveSelected
110 | //
111 | this.RemoveSelected.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
112 | this.RemoveSelected.Location = new System.Drawing.Point(441, 52);
113 | this.RemoveSelected.Name = "RemoveSelected";
114 | this.RemoveSelected.Size = new System.Drawing.Size(113, 23);
115 | this.RemoveSelected.TabIndex = 7;
116 | this.RemoveSelected.Text = "Remove Selected";
117 | this.RemoveSelected.UseVisualStyleBackColor = true;
118 | this.RemoveSelected.Click += new System.EventHandler(this.RemoveSelected_Click);
119 | //
120 | // ClearList
121 | //
122 | this.ClearList.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
123 | this.ClearList.Location = new System.Drawing.Point(441, 81);
124 | this.ClearList.Name = "ClearList";
125 | this.ClearList.Size = new System.Drawing.Size(113, 23);
126 | this.ClearList.TabIndex = 8;
127 | this.ClearList.Text = "Clear List";
128 | this.ClearList.UseVisualStyleBackColor = true;
129 | this.ClearList.Click += new System.EventHandler(this.ClearList_Click);
130 | //
131 | // matchcase
132 | //
133 | this.matchcase.AutoSize = true;
134 | this.matchcase.Location = new System.Drawing.Point(228, 58);
135 | this.matchcase.Name = "matchcase";
136 | this.matchcase.Size = new System.Drawing.Size(82, 17);
137 | this.matchcase.TabIndex = 9;
138 | this.matchcase.Text = "Match case";
139 | this.matchcase.UseVisualStyleBackColor = true;
140 | //
141 | // BtnClose
142 | //
143 | this.BtnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
144 | this.BtnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
145 | this.BtnClose.Location = new System.Drawing.Point(441, 110);
146 | this.BtnClose.Name = "BtnClose";
147 | this.BtnClose.Size = new System.Drawing.Size(113, 23);
148 | this.BtnClose.TabIndex = 10;
149 | this.BtnClose.Text = "Close";
150 | this.BtnClose.UseVisualStyleBackColor = true;
151 | this.BtnClose.Click += new System.EventHandler(this.Close_Click);
152 | //
153 | // regularexpression
154 | //
155 | this.regularexpression.AutoSize = true;
156 | this.regularexpression.Location = new System.Drawing.Point(228, 81);
157 | this.regularexpression.Name = "regularexpression";
158 | this.regularexpression.Size = new System.Drawing.Size(116, 17);
159 | this.regularexpression.TabIndex = 11;
160 | this.regularexpression.Text = "Regular expression";
161 | this.regularexpression.UseVisualStyleBackColor = true;
162 | this.regularexpression.CheckedChanged += new System.EventHandler(this.regularexpression_CheckedChanged);
163 | //
164 | // reversemode
165 | //
166 | this.reversemode.AutoSize = true;
167 | this.reversemode.Location = new System.Drawing.Point(228, 103);
168 | this.reversemode.Name = "reversemode";
169 | this.reversemode.Size = new System.Drawing.Size(95, 17);
170 | this.reversemode.TabIndex = 12;
171 | this.reversemode.Text = "Reverse mode";
172 | this.reversemode.UseVisualStyleBackColor = true;
173 | //
174 | // Columns
175 | //
176 | this.Columns.FormattingEnabled = true;
177 | this.Columns.Location = new System.Drawing.Point(58, 3);
178 | this.Columns.Name = "Columns";
179 | this.Columns.Size = new System.Drawing.Size(156, 21);
180 | this.Columns.TabIndex = 13;
181 | //
182 | // label2
183 | //
184 | this.label2.AutoSize = true;
185 | this.label2.Location = new System.Drawing.Point(10, 6);
186 | this.label2.Name = "label2";
187 | this.label2.Size = new System.Drawing.Size(45, 13);
188 | this.label2.TabIndex = 14;
189 | this.label2.Text = "Column:";
190 | //
191 | // ColumnPanel
192 | //
193 | this.ColumnPanel.Controls.Add(this.Columns);
194 | this.ColumnPanel.Controls.Add(this.label2);
195 | this.ColumnPanel.Location = new System.Drawing.Point(211, 126);
196 | this.ColumnPanel.Name = "ColumnPanel";
197 | this.ColumnPanel.Size = new System.Drawing.Size(224, 27);
198 | this.ColumnPanel.TabIndex = 15;
199 | this.ColumnPanel.Visible = false;
200 | //
201 | // FrmFilter
202 | //
203 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
204 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
205 | this.AutoSize = true;
206 | this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
207 | this.ClientSize = new System.Drawing.Size(584, 261);
208 | this.Controls.Add(this.ColumnPanel);
209 | this.Controls.Add(this.reversemode);
210 | this.Controls.Add(this.regularexpression);
211 | this.Controls.Add(this.BtnClose);
212 | this.Controls.Add(this.matchcase);
213 | this.Controls.Add(this.ClearList);
214 | this.Controls.Add(this.RemoveSelected);
215 | this.Controls.Add(this.Add);
216 | this.Controls.Add(this.label3);
217 | this.Controls.Add(this.textBox1);
218 | this.Controls.Add(this.label1);
219 | this.Controls.Add(this.listBox1);
220 | this.Controls.Add(this.button1);
221 | this.Cursor = System.Windows.Forms.Cursors.AppStarting;
222 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
223 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
224 | this.MaximizeBox = false;
225 | this.MaximumSize = new System.Drawing.Size(600, 300);
226 | this.MinimizeBox = false;
227 | this.MinimumSize = new System.Drawing.Size(600, 300);
228 | this.Name = "FrmFilter";
229 | this.ShowIcon = false;
230 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
231 | this.Text = "Filter";
232 | this.Load += new System.EventHandler(this.FrmFilter_Load);
233 | this.ColumnPanel.ResumeLayout(false);
234 | this.ColumnPanel.PerformLayout();
235 | this.ResumeLayout(false);
236 | this.PerformLayout();
237 |
238 | }
239 |
240 | #endregion
241 | private System.Windows.Forms.Button button1;
242 | private System.Windows.Forms.ListBox listBox1;
243 | private System.Windows.Forms.Label label1;
244 | private System.Windows.Forms.TextBox textBox1;
245 | private System.Windows.Forms.Label label3;
246 | private System.Windows.Forms.Button Add;
247 | private System.Windows.Forms.Button RemoveSelected;
248 | private System.Windows.Forms.Button ClearList;
249 | private System.Windows.Forms.CheckBox matchcase;
250 | private System.Windows.Forms.Button BtnClose;
251 | private System.Windows.Forms.CheckBox regularexpression;
252 | private System.Windows.Forms.CheckBox reversemode;
253 | private System.Windows.Forms.ComboBox Columns;
254 | private System.Windows.Forms.Label label2;
255 | private System.Windows.Forms.Panel ColumnPanel;
256 | }
257 | }
--------------------------------------------------------------------------------
/UE4localizationsTool/Controls/SearchBox.Designer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace UE4localizationsTool.Controls
5 | {
6 | partial class SearchBox
7 | {
8 | ///
9 | /// Required designer variable.
10 | ///
11 | private System.ComponentModel.IContainer components = null;
12 |
13 | ///
14 | /// Clean up any resources being used.
15 | ///
16 | /// true if managed resources should be disposed; otherwise, false.
17 | protected override void Dispose(bool disposing)
18 | {
19 | if (disposing && (components != null))
20 | {
21 | components.Dispose();
22 | }
23 | base.Dispose(disposing);
24 | }
25 |
26 | #region Component Designer generated code
27 |
28 | ///
29 | /// Required method for Designer support - do not modify
30 | /// the contents of this method with the code editor.
31 | ///
32 | private void InitializeComponent()
33 | {
34 | this.SearchHide = new System.Windows.Forms.Label();
35 | this.FindPrevious = new System.Windows.Forms.Button();
36 | this.FindNext = new System.Windows.Forms.Button();
37 | this.label1 = new System.Windows.Forms.Label();
38 | this.panel1 = new System.Windows.Forms.Panel();
39 | this.FindAll = new System.Windows.Forms.Button();
40 | this.Replacepanel = new System.Windows.Forms.Panel();
41 | this.label3 = new System.Windows.Forms.Label();
42 | this.label4 = new System.Windows.Forms.Label();
43 | this.Replace = new System.Windows.Forms.Button();
44 | this.colorDialog1 = new System.Windows.Forms.ColorDialog();
45 | this.listView1 = new System.Windows.Forms.ListView();
46 | this.RowIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
47 | this.CellValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
48 | this.txtReplace = new UE4localizationsTool.Controls.NTextBox();
49 | this.InputSearch = new UE4localizationsTool.Controls.NTextBox();
50 | this.label2 = new System.Windows.Forms.Label();
51 | this.ReplaceAll = new System.Windows.Forms.Button();
52 | this.panel1.SuspendLayout();
53 | this.Replacepanel.SuspendLayout();
54 | this.SuspendLayout();
55 | //
56 | // SearchHide
57 | //
58 | this.SearchHide.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
59 | this.SearchHide.AutoSize = true;
60 | this.SearchHide.Cursor = System.Windows.Forms.Cursors.Hand;
61 | this.SearchHide.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold);
62 | this.SearchHide.Location = new System.Drawing.Point(670, 9);
63 | this.SearchHide.Name = "SearchHide";
64 | this.SearchHide.Size = new System.Drawing.Size(18, 17);
65 | this.SearchHide.TabIndex = 5;
66 | this.SearchHide.Text = "X";
67 | this.SearchHide.Click += new System.EventHandler(this.SearchHide_Click);
68 | //
69 | // FindPrevious
70 | //
71 | this.FindPrevious.Location = new System.Drawing.Point(311, 5);
72 | this.FindPrevious.Name = "FindPrevious";
73 | this.FindPrevious.Size = new System.Drawing.Size(92, 23);
74 | this.FindPrevious.TabIndex = 4;
75 | this.FindPrevious.Text = "Find Previous";
76 | this.FindPrevious.UseVisualStyleBackColor = true;
77 | this.FindPrevious.Click += new System.EventHandler(this.FindPrevious_Click);
78 | //
79 | // FindNext
80 | //
81 | this.FindNext.Location = new System.Drawing.Point(231, 5);
82 | this.FindNext.Name = "FindNext";
83 | this.FindNext.Size = new System.Drawing.Size(76, 23);
84 | this.FindNext.TabIndex = 3;
85 | this.FindNext.Text = "Find Next";
86 | this.FindNext.UseVisualStyleBackColor = true;
87 | this.FindNext.Click += new System.EventHandler(this.FindNext_Click);
88 | //
89 | // label1
90 | //
91 | this.label1.AutoSize = true;
92 | this.label1.Location = new System.Drawing.Point(4, 11);
93 | this.label1.Name = "label1";
94 | this.label1.Size = new System.Drawing.Size(31, 13);
95 | this.label1.TabIndex = 1;
96 | this.label1.Text = "Find:";
97 | //
98 | // panel1
99 | //
100 | this.panel1.Controls.Add(this.label2);
101 | this.panel1.Controls.Add(this.FindAll);
102 | this.panel1.Controls.Add(this.InputSearch);
103 | this.panel1.Controls.Add(this.label1);
104 | this.panel1.Controls.Add(this.SearchHide);
105 | this.panel1.Controls.Add(this.FindNext);
106 | this.panel1.Controls.Add(this.FindPrevious);
107 | this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
108 | this.panel1.Location = new System.Drawing.Point(0, 0);
109 | this.panel1.Name = "panel1";
110 | this.panel1.Size = new System.Drawing.Size(695, 33);
111 | this.panel1.TabIndex = 0;
112 | //
113 | // FindAll
114 | //
115 | this.FindAll.Location = new System.Drawing.Point(407, 5);
116 | this.FindAll.Name = "FindAll";
117 | this.FindAll.Size = new System.Drawing.Size(64, 23);
118 | this.FindAll.TabIndex = 7;
119 | this.FindAll.Text = "All";
120 | this.FindAll.UseVisualStyleBackColor = true;
121 | this.FindAll.Click += new System.EventHandler(this.FindAll_Click);
122 | //
123 | // Replacepanel
124 | //
125 | this.Replacepanel.Controls.Add(this.ReplaceAll);
126 | this.Replacepanel.Controls.Add(this.txtReplace);
127 | this.Replacepanel.Controls.Add(this.label3);
128 | this.Replacepanel.Controls.Add(this.label4);
129 | this.Replacepanel.Controls.Add(this.Replace);
130 | this.Replacepanel.Dock = System.Windows.Forms.DockStyle.Top;
131 | this.Replacepanel.Location = new System.Drawing.Point(0, 33);
132 | this.Replacepanel.Name = "Replacepanel";
133 | this.Replacepanel.Size = new System.Drawing.Size(695, 34);
134 | this.Replacepanel.TabIndex = 1;
135 | this.Replacepanel.Visible = false;
136 | //
137 | // label3
138 | //
139 | this.label3.AutoSize = true;
140 | this.label3.Location = new System.Drawing.Point(4, 11);
141 | this.label3.Name = "label3";
142 | this.label3.Size = new System.Drawing.Size(49, 13);
143 | this.label3.TabIndex = 1;
144 | this.label3.Text = "Replace:";
145 | //
146 | // label4
147 | //
148 | this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
149 | this.label4.AutoSize = true;
150 | this.label4.Cursor = System.Windows.Forms.Cursors.Hand;
151 | this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold);
152 | this.label4.Location = new System.Drawing.Point(670, 9);
153 | this.label4.Name = "label4";
154 | this.label4.Size = new System.Drawing.Size(18, 17);
155 | this.label4.TabIndex = 5;
156 | this.label4.Text = "X";
157 | this.label4.Click += new System.EventHandler(this.label4_Click);
158 | //
159 | // Replace
160 | //
161 | this.Replace.Location = new System.Drawing.Point(231, 5);
162 | this.Replace.Name = "Replace";
163 | this.Replace.Size = new System.Drawing.Size(76, 23);
164 | this.Replace.TabIndex = 3;
165 | this.Replace.Text = "Replace";
166 | this.Replace.UseVisualStyleBackColor = true;
167 | this.Replace.Click += new System.EventHandler(this.Replace_Click);
168 | //
169 | // listView1
170 | //
171 | this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
172 | this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
173 | this.RowIndex,
174 | this.CellValue});
175 | this.listView1.Dock = System.Windows.Forms.DockStyle.Top;
176 | this.listView1.FullRowSelect = true;
177 | this.listView1.HideSelection = false;
178 | this.listView1.Location = new System.Drawing.Point(0, 67);
179 | this.listView1.MultiSelect = false;
180 | this.listView1.Name = "listView1";
181 | this.listView1.Size = new System.Drawing.Size(695, 124);
182 | this.listView1.TabIndex = 3;
183 | this.listView1.UseCompatibleStateImageBehavior = false;
184 | this.listView1.View = System.Windows.Forms.View.Details;
185 | this.listView1.Visible = false;
186 | this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
187 | //
188 | // RowIndex
189 | //
190 | this.RowIndex.Text = "Row Index";
191 | this.RowIndex.Width = 100;
192 | //
193 | // CellValue
194 | //
195 | this.CellValue.Text = "Value";
196 | this.CellValue.Width = 593;
197 | //
198 | // txtReplace
199 | //
200 | this.txtReplace.Location = new System.Drawing.Point(65, 7);
201 | this.txtReplace.Name = "txtReplace";
202 | this.txtReplace.PlaceholderText = "Type your replace value here...";
203 | this.txtReplace.Size = new System.Drawing.Size(162, 20);
204 | this.txtReplace.StopEnterKey = false;
205 | this.txtReplace.TabIndex = 0;
206 | //
207 | // InputSearch
208 | //
209 | this.InputSearch.Location = new System.Drawing.Point(65, 7);
210 | this.InputSearch.Name = "InputSearch";
211 | this.InputSearch.PlaceholderText = "Type your search here...";
212 | this.InputSearch.Size = new System.Drawing.Size(162, 20);
213 | this.InputSearch.StopEnterKey = false;
214 | this.InputSearch.TabIndex = 0;
215 | this.InputSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.InputSearch_KeyDown);
216 | //
217 | // label2
218 | //
219 | this.label2.AutoSize = true;
220 | this.label2.Location = new System.Drawing.Point(478, 11);
221 | this.label2.Name = "label2";
222 | this.label2.Size = new System.Drawing.Size(0, 13);
223 | this.label2.TabIndex = 8;
224 | //
225 | // ReplaceAll
226 | //
227 | this.ReplaceAll.Location = new System.Drawing.Point(311, 5);
228 | this.ReplaceAll.Name = "ReplaceAll";
229 | this.ReplaceAll.Size = new System.Drawing.Size(64, 23);
230 | this.ReplaceAll.TabIndex = 6;
231 | this.ReplaceAll.Text = "All";
232 | this.ReplaceAll.UseVisualStyleBackColor = true;
233 | this.ReplaceAll.Click += new System.EventHandler(this.ReplaceAll_Click);
234 | //
235 | // SearchBox
236 | //
237 | this.AutoSize = true;
238 | this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
239 | this.Controls.Add(this.listView1);
240 | this.Controls.Add(this.Replacepanel);
241 | this.Controls.Add(this.panel1);
242 | this.Location = new System.Drawing.Point(155, 23);
243 | this.Name = "SearchBox";
244 | this.Size = new System.Drawing.Size(695, 192);
245 | this.panel1.ResumeLayout(false);
246 | this.panel1.PerformLayout();
247 | this.Replacepanel.ResumeLayout(false);
248 | this.Replacepanel.PerformLayout();
249 | this.ResumeLayout(false);
250 |
251 | }
252 |
253 | #endregion
254 | private System.Windows.Forms.Label SearchHide;
255 | private System.Windows.Forms.Button FindPrevious;
256 | private System.Windows.Forms.Button FindNext;
257 |
258 | private System.Windows.Forms.Label label1;
259 | public NTextBox InputSearch;
260 | private Panel panel1;
261 | private Button FindAll;
262 | private Panel Replacepanel;
263 | public NTextBox txtReplace;
264 | private Label label3;
265 | private Label label4;
266 | private Button Replace;
267 | private ColorDialog colorDialog1;
268 | private ListView listView1;
269 | private ColumnHeader RowIndex;
270 | private ColumnHeader CellValue;
271 | private Label label2;
272 | private Button ReplaceAll;
273 | }
274 | }
275 |
--------------------------------------------------------------------------------
/UE4localizationsTool/Core/Uexp.cs:
--------------------------------------------------------------------------------
1 | using Helper.MemoryList;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Drawing;
5 | using System.IO;
6 | using System.Windows.Forms;
7 | using UE4localizationsTool.Core.Games;
8 |
9 | namespace AssetParser
10 | {
11 |
12 | public class StringNode
13 | {
14 | public string NameSpace { get; set; }
15 | public string Key { get; set; }
16 | public string Value { get; set; }
17 |
18 |
19 | public string GetName()
20 | {
21 | return string.IsNullOrEmpty(NameSpace)?Key: NameSpace+ "::" + Key;
22 | }
23 | }
24 |
25 | public class Uexp : IAsset
26 | {
27 |
28 | public IUasset UassetData;
29 |
30 | public List> Strings { get; set; } //[Text id,Text Value,...]
31 | private int _CurrentIndex;
32 | public bool IsGood { get; set; } = true;
33 | public int ExportIndex;
34 | public int CurrentIndex
35 | {
36 | get
37 | {
38 | // Console.WriteLine(Strings.Count+ " - "+ (_CurrentIndex+1));
39 | return _CurrentIndex;
40 | }
41 | set
42 | {
43 | _CurrentIndex = value;
44 | }
45 |
46 | }
47 |
48 |
49 | public List StringNodes { get; set; }
50 | public bool DumpNameSpaces { get; set; } = false;
51 |
52 | public Uexp(IUasset UassetObject,bool dumpnamespaces=false)
53 | {
54 | UassetData = UassetObject;
55 | Strings = new List>();
56 | CurrentIndex = 0;
57 |
58 | if (dumpnamespaces)
59 | {
60 | StringNodes = new List();
61 | this.DumpNameSpaces = dumpnamespaces;
62 | }
63 |
64 | ReadOrEdit();
65 | }
66 |
67 |
68 | public static IUasset GetUasset(string uassetpath)
69 | {
70 | var StreamFile = File.Open(uassetpath, FileMode.Open, FileAccess.Read);
71 | var array = new byte[4];
72 | StreamFile.Read(array, 0, array.Length);
73 | StreamFile.Close();
74 |
75 | //Todo
76 | if (array[0] == 0xC1 && array[1] == 0x83 && array[2] == 0x2A && array[3] == 0x9E)//pak -> uasset
77 | {
78 | return new Uasset(uassetpath);
79 | }
80 | else//utoc -> uasset
81 | {
82 | return new IoPackage(uassetpath);
83 | }
84 |
85 | }
86 |
87 | private void ReadOrEdit(bool Modify = false)
88 | {
89 |
90 | for (int n = 0; n < UassetData.Exports_Directory.Count; n++)
91 | {
92 | ExportIndex = n;
93 | MemoryList memoryList = new MemoryList(UassetData.Exports_Directory[n].ExportData);
94 | try
95 | {
96 | ConsoleMode.Print("Block Start offset: " + UassetData.Exports_Directory[n].ExportStart.ToString(), ConsoleColor.DarkRed);
97 | ConsoleMode.Print("Block Size: " + UassetData.Exports_Directory[n].ExportLength.ToString(), ConsoleColor.DarkRed);
98 |
99 | memoryList.Seek(0); //Seek to beginning of Block
100 |
101 | if (UassetData.UseMethod2)
102 | {
103 | new UDataTable(memoryList, this, Modify);
104 | continue;
105 | }
106 |
107 | ConsoleMode.Print(UassetData.GetExportPropertyName(UassetData.Exports_Directory[n].ExportClass), ConsoleColor.DarkRed);
108 |
109 |
110 | if (memoryList.GetByteValue(false) == 0 && UassetData.GetExportPropertyName(UassetData.Exports_Directory[n].ExportClass) != "MovieSceneCompiledData" && memoryList.GetIntValue(false) > UassetData.NAMES_DIRECTORY.Count)
111 | {
112 | memoryList.Skip(2);
113 | goto Start;
114 | }
115 |
116 |
117 | ConsoleMode.Print($"-----------{n}------------", ConsoleColor.Red);
118 | _ = new StructProperty(memoryList, this, UassetData.UseFromStruct, false, Modify);
119 | ConsoleMode.Print($"-----------End------------", ConsoleColor.Red);
120 |
121 | if (memoryList.EndofFile())
122 | {
123 | continue;
124 | }
125 | Start:
126 | ConsoleMode.Print($"-----------{n}------------", ConsoleColor.DarkRed);
127 | switch (UassetData.GetExportPropertyName(UassetData.Exports_Directory[n].ExportClass))
128 | {
129 | case "StringTable":
130 | new StringTable(memoryList, this, Modify);
131 | break;
132 | case "CompositeDataTable":
133 | case "DataTable":
134 | if (memoryList.GetIntValue(false) != -5)
135 | {
136 | new DataTable(memoryList, this, Modify);
137 | }
138 | else
139 | {
140 | //For not effect in original file structure
141 | if (memoryList.GetIntValue(false) != -5)
142 | {
143 | new DataTable(memoryList, this, Modify);
144 | }
145 | else
146 | {
147 | new UDataTable(memoryList, this, Modify);
148 | }
149 | }
150 | break;
151 | case "Spreadsheet":
152 |
153 | new Spreadsheet(memoryList, this, Modify);
154 | break;
155 | case "Function":
156 | new Function(memoryList, this, Modify);
157 | break;
158 | case "REDLocalizeTextData":
159 | new REDLocalizeTextData(memoryList, this, Modify);
160 | break;
161 | case "REDLibraryTextData":
162 | new REDLibraryTextData(memoryList, this, Modify);
163 | break;
164 | case "REDAdvTextData":
165 | new REDAdvTextData(memoryList, this, Modify);
166 | break;
167 | case "MuseStringTable":
168 | new MuseStringTable(memoryList, this, Modify);
169 | break;
170 | case "J5BinderAsset":
171 | new J5BinderAsset(memoryList, this, Modify);
172 | break;
173 | }
174 | ConsoleMode.Print($"-----------End------------", ConsoleColor.DarkRed);
175 | }
176 | catch (Exception ex)
177 | {
178 | ConsoleMode.Print("Skip this export:\n" + ex.ToString(), ConsoleColor.Red, ConsoleMode.ConsoleModeType.Error);
179 | // Skip this export
180 | }
181 | }
182 |
183 | }
184 |
185 |
186 | private void ModifyStrings()
187 | {
188 | CurrentIndex = 0;
189 | ReadOrEdit(true);
190 | }
191 |
192 | public void SaveFile(string FilPath)
193 | {
194 | ModifyStrings();
195 | UassetData.ExportReadOrEdit(true);
196 | UassetData.UpdateOffset();
197 | if (UassetData.IsNotUseUexp)
198 | {
199 | MakeBlocks();
200 | UassetData.UassetFile.WriteFile(System.IO.Path.ChangeExtension(FilPath, FilPath.ToLower().EndsWith(".umap") ? ".umap" : ".uasset"));
201 | }
202 | else
203 | {
204 | MemoryList UexpData = MakeBlocks();
205 | UassetData.UassetFile.WriteFile(System.IO.Path.ChangeExtension(FilPath, FilPath.ToLower().EndsWith(".umap") ? ".umap" : ".uasset"));
206 | UexpData.WriteFile(System.IO.Path.ChangeExtension(FilPath, ".uexp"));
207 | }
208 | }
209 |
210 | private MemoryList MakeBlocks()
211 | {
212 |
213 | if (UassetData.IsNotUseUexp)
214 | {
215 | UassetData.UassetFile.SetSize(UassetData.File_Directory_Offset);
216 | UassetData.Exports_Directory.ForEach(x =>
217 | {
218 | UassetData.UassetFile.MemoryListData.AddRange(x.ExportData);
219 | });
220 |
221 | if (!UassetData.IOFile)
222 | {
223 | UassetData.UassetFile.Add(2653586369);
224 | }
225 | return UassetData.UassetFile;
226 | }
227 | else
228 | {
229 |
230 | MemoryList memoryList = new MemoryList();
231 | UassetData.Exports_Directory.ForEach(x =>
232 | {
233 | memoryList.MemoryListData.AddRange(x.ExportData);
234 | });
235 | memoryList.Add(2653586369);
236 | return memoryList;
237 | }
238 | }
239 |
240 | public void AddItemsToDataGridView(DataGridView dataGrid)
241 | {
242 | dataGrid.DataSource = null;
243 | dataGrid.Rows.Clear();
244 | dataGrid.Columns.Clear();
245 |
246 | var dataTable = new System.Data.DataTable();
247 | dataTable.Columns.Add("Name");
248 | dataTable.Columns["Name"].ReadOnly = true;
249 | dataTable.Columns.Add("Text value");
250 | dataTable.Columns.Add("index",typeof(int));
251 |
252 | int i = 0;
253 | foreach (var item in Strings)
254 | {
255 | dataTable.Rows.Add(item[0], item[1], i++);
256 | }
257 |
258 | dataGrid.DataSource = dataTable;
259 |
260 | dataGrid.Columns["Text value"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
261 | dataGrid.Columns["index"].Visible = false;
262 |
263 |
264 | // You can remove these event handlers if not needed.
265 | dataGrid.CellFormatting += DataGrid_CellFormatting;
266 | dataGrid.CellToolTipTextNeeded += DataGrid_CellToolTipTextNeeded;
267 | }
268 |
269 | private void DataGrid_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e)
270 | {
271 | if (e.RowIndex >= 0)
272 | {
273 | var dataGridView = (DataGridView)sender;
274 |
275 | bool isFound = false;
276 | foreach (DataGridViewColumn column in dataGridView.Columns)
277 | {
278 | if (column.Name == "index")
279 | {
280 | isFound = true;
281 | }
282 | }
283 | if (!isFound) return;
284 |
285 |
286 | if (dataGridView.Columns[e.ColumnIndex].Name == "Name")
287 | {
288 | var rowIndexCell = dataGridView.Rows[e.RowIndex].Cells["index"];
289 |
290 | if (rowIndexCell != null && rowIndexCell.Value != null)
291 | {
292 | var rowIndex = Convert.ToInt32(rowIndexCell.Value);
293 |
294 | if (rowIndex >= 0 && rowIndex < Strings.Count)
295 | {
296 | var item = Strings[rowIndex];
297 |
298 | if (item.Count > 2)
299 | {
300 | e.ToolTipText = item[2];
301 | }
302 | }
303 | }
304 | }
305 | }
306 | }
307 |
308 | private void DataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
309 | {
310 | if (e.RowIndex >= 0)
311 | {
312 | var dataGridView = (DataGridView)sender;
313 |
314 | bool isFound = false;
315 | foreach (DataGridViewColumn column in dataGridView.Columns)
316 | {
317 | if (column.Name == "index")
318 | {
319 | isFound = true;
320 | }
321 | }
322 | if (!isFound) return;
323 |
324 | if (dataGridView.Columns[e.ColumnIndex].Name == "Name")
325 | {
326 | var rowIndexCell = dataGridView.Rows[e.RowIndex].Cells["index"];
327 | if (rowIndexCell != null && rowIndexCell.Value != null)
328 | {
329 | var rowIndex = Convert.ToInt32(rowIndexCell.Value);
330 |
331 | if (rowIndex >= 0 && rowIndex < Strings.Count)
332 | {
333 | var item = Strings[rowIndex];
334 |
335 | if (item.Count > 3)
336 | {
337 | e.CellStyle.BackColor = ColorTranslator.FromHtml(item[3]);
338 | }
339 | if (item.Count > 4)
340 | {
341 | e.CellStyle.ForeColor = ColorTranslator.FromHtml(item[4]);
342 | }
343 | }
344 | }
345 | }
346 | }
347 | }
348 |
349 |
350 | public void LoadFromDataGridView(DataGridView dataGrid)
351 | {
352 | foreach (DataGridViewRow row in dataGrid.Rows)
353 | {
354 | if (row.Cells["index"].Value is int itemIndex &&
355 | row.Cells["Text value"].Value != null)
356 | {
357 | Strings[itemIndex][1] = row.Cells["Text value"].Value.ToString();
358 | }
359 | }
360 | }
361 |
362 | public List> ExtractTexts()
363 | {
364 | return Strings;
365 | }
366 |
367 | public void ImportTexts(List> strings)
368 | {
369 | Strings = strings;
370 | }
371 | }
372 | }
373 |
--------------------------------------------------------------------------------