From 500331b5ea4234d16d0434b76daeb5f87aac5f9c Mon Sep 17 00:00:00 2001 From: Amr Shaheen Date: Thu, 16 Mar 2023 17:42:14 +0200 Subject: [PATCH] Changes for v2.1 --- README.md | 69 ++++- UE4localizationsTool/App.config | 12 + UE4localizationsTool/Commands.cs | 22 +- UE4localizationsTool/Controls/NForm.cs | 290 ++++++++++++++++++ UE4localizationsTool/Core/AssetHelper.cs | 82 +++-- UE4localizationsTool/Core/DataTable.cs | 25 ++ UE4localizationsTool/Core/Function.cs | 12 +- .../Core/Games/RED Game/REDAdvTextData.cs | 6 +- .../Core/Games/RED Game/REDLibraryTextData.cs | 6 +- .../Games/RED Game/REDLocalizeTextData.cs | 2 +- .../Core/Games/TheLastOricru.cs | 69 +++++ UE4localizationsTool/Core/Games/UDataTable.cs | 22 +- UE4localizationsTool/Core/IAsset.cs | 11 + UE4localizationsTool/Core/StructProperty.cs | 28 +- UE4localizationsTool/Core/Uasset.cs | 43 ++- UE4localizationsTool/Core/Uexp.cs | 61 ++-- UE4localizationsTool/Core/locres.cs | 27 +- .../Forms/FrmAbout.Designer.cs | 12 +- UE4localizationsTool/Forms/FrmAbout.cs | 3 +- .../Forms/FrmFilter.Designer.cs | 24 +- UE4localizationsTool/Forms/FrmFilter.cs | 3 +- .../Forms/FrmMain.Designer.cs | 98 ++++-- UE4localizationsTool/Forms/FrmMain.cs | 252 +++++++++------ .../Forms/FrmState.Designer.cs | 2 +- UE4localizationsTool/Forms/FrmState.cs | 5 +- UE4localizationsTool/Helper/MemoryList.cs | 13 +- UE4localizationsTool/Program.cs | 25 +- .../Properties/AssemblyInfo.cs | 4 +- .../Properties/Resources.Designer.cs | 2 +- .../Properties/Settings.Designer.cs | 14 +- .../Properties/Settings.settings | 14 +- UE4localizationsTool/Properties/app.manifest | 73 +++++ UE4localizationsTool/Settings.cs | 33 ++ .../UE4localizationsTool.csproj | 18 +- UE4localizationsTool/UpdateInfo.txt | 4 +- 35 files changed, 1070 insertions(+), 316 deletions(-) create mode 100644 UE4localizationsTool/Controls/NForm.cs create mode 100644 UE4localizationsTool/Core/Games/TheLastOricru.cs create mode 100644 UE4localizationsTool/Core/IAsset.cs create mode 100644 UE4localizationsTool/Properties/app.manifest create mode 100644 UE4localizationsTool/Settings.cs diff --git a/README.md b/README.md index eda9489..3031579 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,67 @@ -# UE4 Localizations Tool -is a simple tool to edit unreal engine 4 text files. +# UE4LocalizationsTool +simple tool to edit unreal engine 4 text files. -Author: amr shaheeen +By: Amr Shaheen +
+ +## Command Lines +### for export single file use: +``` +UE4localizationsTool.exe export <(Locres/Uasset/Umap) FilePath> +Example: +UE4localizationsTool.exe export Actions.uasset +``` +### for import single file use: +``` +UE4localizationsTool.exe import <(txt) FilePath> +Example: +UE4localizationsTool.exe import Actions.uasset.txt +``` +### for import single file without rename it use: +``` +UE4localizationsTool.exe -import <(txt) FilePath> +Example: +UE4localizationsTool.exe -import Actions.uasset.txt +``` + +### for export many files from folder use: +``` +UE4localizationsTool.exe exportall +Example: +UE4localizationsTool.exe exportall Actions text.txt +``` +### for import many files in folder use: +``` +UE4localizationsTool.exe importall +Example: +UE4localizationsTool.exe importall Actions text.txt +``` +### for import many files in folder without rename files use: +``` +UE4localizationsTool.exe -importall +Example: +UE4localizationsTool.exe -importall Actions text.txt +``` + +### Options: (Remember to apply the same OPTIONS when importing) + +#### To use last filter you applied before in GUI use: (apply only in name table) +``` +-f or -filter +Example: +UE4localizationsTool.exe export Actions.uasset -filter +``` + +#### To export file without including name table use: +``` +-nn or -NoName +Example: +UE4localizationsTool.exe export Actions.uasset -NoName +``` +#### To use method 2 use:(trying to catch text without using ue4 asset structure (for uasset and umap only)) +``` +-m2 or -method2 +Examplemethod2 +UE4localizationsTool.exe export Actions.uasset -method2 +UE4localizationsTool.exe export Actions.uasset -method2 -NoName -filter +``` \ No newline at end of file diff --git a/UE4localizationsTool/App.config b/UE4localizationsTool/App.config index ecdcf8a..ff7543c 100644 --- a/UE4localizationsTool/App.config +++ b/UE4localizationsTool/App.config @@ -1,6 +1,18 @@ + + +
+ + + + + + False + + + diff --git a/UE4localizationsTool/Commands.cs b/UE4localizationsTool/Commands.cs index 6fdb6c3..ecac589 100644 --- a/UE4localizationsTool/Commands.cs +++ b/UE4localizationsTool/Commands.cs @@ -1,5 +1,4 @@ using AssetParser; -using Microsoft.SqlServer.Server; using System; using System.Collections.Generic; using System.IO; @@ -28,8 +27,9 @@ public class Commands private bool RegularExpression = false; private bool ReverseMode = false; private List ArrayValues; - public Commands(string Options, string SourcePath) + public Commands(string Options, string SourcePath, Args args) { + Flags = args; if (Flags.HasFlag(Args.filter)) { GetFilterValues(); @@ -161,10 +161,10 @@ private List> Export(string FilePath) return locres.Strings; // SizeOfRecord = locres.Strings.Count; } - else if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase)|| FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase)) + else if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase) || FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase)) { Uasset Uasset = new Uasset(FilePath); - + if (Flags.HasFlag(Args.method2)) { Uasset.UseMethod2 = true; @@ -192,7 +192,7 @@ private void ExportFolder(string FolderPath) Console.WriteLine(ConsoleText); Console.ForegroundColor = ConsoleColor.White; - string[] LanguageFiles = Directory.GetFiles(FolderPath, "*.*", SearchOption.AllDirectories).Where(x => x.EndsWith(".locres", StringComparison.OrdinalIgnoreCase) || x.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase)|| x.EndsWith(".umap", StringComparison.OrdinalIgnoreCase)).ToArray(); + string[] LanguageFiles = Directory.GetFiles(FolderPath, "*.*", SearchOption.AllDirectories).Where(x => x.EndsWith(".locres", StringComparison.OrdinalIgnoreCase) || x.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase) || x.EndsWith(".umap", StringComparison.OrdinalIgnoreCase)).ToArray(); Console.ForegroundColor = ConsoleColor.Green; Console.SetCursorPosition(ConsoleText.Length, Console.CursorTop - 1); Console.WriteLine("Done"); @@ -206,7 +206,7 @@ private void ExportFolder(string FolderPath) for (int i = 0; i < LanguageFiles.Count(); i++) { Console.ForegroundColor = ConsoleColor.Blue; - ConsoleText = $"[{ i + 1}:{LanguageFiles.Count()}] Exporting... '{Path.GetFileName(LanguageFiles[i])}' "; + ConsoleText = $"[{i + 1}:{LanguageFiles.Count()}] Exporting... '{Path.GetFileName(LanguageFiles[i])}' "; Console.WriteLine(ConsoleText); Console.ForegroundColor = ConsoleColor.White; @@ -302,14 +302,14 @@ private void Import(string FilePath, string[] Values, string Option) FilePath = Path.ChangeExtension(FilePath, null) + "_NEW.locres"; locres.SaveFile(FilePath); } - else if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase)|| FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase)) + else if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase) || FilePath.EndsWith(".umap", StringComparison.OrdinalIgnoreCase)) { Uasset Uasset = new Uasset(FilePath); if (Flags.HasFlag(Args.method2)) { Uasset.UseMethod2 = true; } - + Uexp Uexp = new Uexp(Uasset); EditList(Uexp.Strings, Values); @@ -318,8 +318,8 @@ private void Import(string FilePath, string[] Values, string Option) Uexp.SaveFile(FilePath); return; } - - if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase)) + + if (FilePath.EndsWith(".uasset", StringComparison.OrdinalIgnoreCase)) { FilePath = Path.ChangeExtension(FilePath, null) + "_NEW.uasset"; } @@ -327,7 +327,7 @@ private void Import(string FilePath, string[] Values, string Option) { FilePath = Path.ChangeExtension(FilePath, null) + "_NEW.umap"; } - + Uexp.SaveFile(FilePath); } else diff --git a/UE4localizationsTool/Controls/NForm.cs b/UE4localizationsTool/Controls/NForm.cs new file mode 100644 index 0000000..06ff351 --- /dev/null +++ b/UE4localizationsTool/Controls/NForm.cs @@ -0,0 +1,290 @@ +using System.Drawing; +using System.Windows.Forms; + +namespace UE4localizationsTool.Controls +{ + public class NForm : Form + { + protected override void CreateHandle() + { + base.CreateHandle(); + if (Properties.Settings.Default.DarkMode) + DarkMode(); + } + + + public void DarkMode() + { + + this.BackColor = Color.FromArgb(30, 30, 30); + this.ForeColor = Color.White; + + foreach (Control control in this.Controls) + { + DarkMode(control); + } + } + + private void DarkMode(Control control) + { + + if (!(control.BackColor.R == control.BackColor.G && control.BackColor.G == control.BackColor.B)) + { + return; + } + + control.BackColor = Color.FromArgb(30, 30, 30); + control.ForeColor = Color.White; + + if (control is GroupBox) + { + ((GroupBox)control).ForeColor = Color.White; + } + if (control is ListView) + { + ((ListView)control).BackColor = Color.FromArgb(30, 30, 30); + ((ListView)control).ForeColor = Color.White; + ((ListView)control).OwnerDraw = true; + ((ListView)control).DrawItem += (c, e) => + { + e.DrawDefault = true; + }; + + ((ListView)control).DrawSubItem += (c, e) => + { + e.DrawDefault = true; + }; + + ((ListView)control).DrawColumnHeader += (c, e) => + { + e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(50, 50, 50)), e.Bounds); + e.Graphics.DrawString(e.Header.Text, e.Font, new SolidBrush(Color.White), e.Bounds); + }; + + } + + if (control is TreeView) + { + ((TreeView)control).BackColor = Color.FromArgb(30, 30, 30); + ((TreeView)control).ForeColor = Color.White; + ((TreeView)control).LineColor = Color.White; + + + } + + if (control is DataGridView) + { + ((DataGridView)control).BackgroundColor = Color.FromArgb(30, 30, 30); + ((DataGridView)control).DefaultCellStyle.BackColor = Color.FromArgb(40, 40, 40); + ((DataGridView)control).DefaultCellStyle.ForeColor = Color.White; + ((DataGridView)control).ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(50, 50, 50); + ((DataGridView)control).ColumnHeadersDefaultCellStyle.ForeColor = Color.White; + ((DataGridView)control).EnableHeadersVisualStyles = false; + + ((DataGridView)control).ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; + ((DataGridView)control).RowsDefaultCellStyle.SelectionBackColor = Color.FromArgb(70, 70, 70); + ((DataGridView)control).RowsDefaultCellStyle.SelectionForeColor = Color.White; + } + if (control is Panel) + { + ((Panel)control).BackColor = Color.FromArgb(30, 30, 30); + + foreach (Control controls in ((Panel)control).Controls) + { + DarkMode(controls); + } + } + if (control is TextBox) + { + ((TextBox)control).BackColor = Color.FromArgb(40, 40, 40); + ((TextBox)control).ForeColor = Color.White; + ((TextBox)control).BorderStyle = BorderStyle.FixedSingle; + } + if (control is ComboBox) + { + ((ComboBox)control).BackColor = Color.FromArgb(40, 40, 40); + ((ComboBox)control).ForeColor = Color.White; + } + if (control is CheckBox) + { + ((CheckBox)control).ForeColor = Color.White; + } + if (control is RadioButton) + { + ((RadioButton)control).ForeColor = Color.White; + } + if (control is Button) + { + ((Button)control).BackColor = Color.FromArgb(40, 40, 40); + ((Button)control).ForeColor = Color.White; + ((Button)control).FlatStyle = FlatStyle.Flat; + ((Button)control).FlatAppearance.BorderSize = 1; + ((Button)control).FlatAppearance.BorderColor = Color.FromArgb(60, 60, 60); + ((Button)control).FlatAppearance.MouseOverBackColor = Color.FromArgb(60, 60, 60); + + } + + if (control is MenuStrip) + { + ((MenuStrip)control).BackColor = Color.FromArgb(30, 30, 30); + ((MenuStrip)control).ForeColor = Color.White; + + ((MenuStrip)control).RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + ((MenuStrip)control).Renderer = new DarkModeMenuStripRenderer(new CustomColorTable()); + } + + if (control is SplitContainer) + { + ((SplitContainer)control).BackColor = Color.FromArgb(30, 30, 30); + ((SplitContainer)control).ForeColor = Color.White; + + + DarkMode(((SplitContainer)control).Panel1); + DarkMode(((SplitContainer)control).Panel2); + } + + if (control is PictureBox) + { + ((PictureBox)control).BackColor = Color.FromArgb(30, 30, 30); + ((PictureBox)control).ForeColor = Color.White; + } + + + if (control is Label) + { + ((Label)control).BackColor = Color.FromArgb(30, 30, 30); + ((Label)control).ForeColor = Color.White; + } + + + + foreach (Control c in control.Controls) + { + DarkMode(c); + } + + + } + + + public class DarkModeMenuStripRenderer : ToolStripProfessionalRenderer + { + + public DarkModeMenuStripRenderer(ProfessionalColorTable colorTable) + : base(colorTable) + { + } + + + protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) + { + e.TextColor = Color.White; + base.OnRenderItemText(e); + } + } + + + public class CustomColorTable : ProfessionalColorTable + { + public override Color MenuStripGradientBegin + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color MenuStripGradientEnd + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color MenuItemSelected + { + get { return Color.FromArgb(63, 63, 70); } + } + + public override Color MenuItemBorder + { + get { return Color.FromArgb(63, 63, 70); } + } + + public override Color MenuItemSelectedGradientBegin + { + get { return Color.FromArgb(63, 63, 70); } + } + + public override Color MenuItemSelectedGradientEnd + { + get { return Color.FromArgb(63, 63, 70); } + } + + public override Color MenuItemPressedGradientBegin + { + get { return Color.FromArgb(63, 63, 70); } + } + + public override Color MenuItemPressedGradientEnd + { + get { return Color.FromArgb(63, 63, 70); } + } + + public override Color MenuBorder + { + get { return Color.FromArgb(63, 63, 70); } + } + + public override Color ToolStripDropDownBackground + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color ImageMarginGradientBegin + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color ImageMarginGradientMiddle + { + get { return Color.FromArgb(30, 30, 30); } + } + + + public override Color ImageMarginGradientEnd + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color ToolStripBorder + { + get { return Color.FromArgb(63, 63, 70); } + } + + public override Color ToolStripContentPanelGradientBegin + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color ToolStripContentPanelGradientEnd + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color ToolStripGradientBegin + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color ToolStripGradientMiddle + { + get { return Color.FromArgb(30, 30, 30); } + } + + public override Color ToolStripGradientEnd + { + get { return Color.FromArgb(30, 30, 30); } + } + + + } + + + } +} diff --git a/UE4localizationsTool/Core/AssetHelper.cs b/UE4localizationsTool/Core/AssetHelper.cs index 8a8c9b9..b2bb02c 100644 --- a/UE4localizationsTool/Core/AssetHelper.cs +++ b/UE4localizationsTool/Core/AssetHelper.cs @@ -1,7 +1,6 @@ using Helper.MemoryList; using System; using System.Collections.Generic; -using System.IO; using System.Text; namespace AssetParser @@ -11,7 +10,7 @@ public static class AssetHelper public static string GetPropertyName(this Uasset SourceFile, int Index) { - if (SourceFile.NAMES_DIRECTORY.Count > Index && Index>0) + if (SourceFile.NAMES_DIRECTORY.Count > Index && Index > 0) { return SourceFile.NAMES_DIRECTORY[Index]; } @@ -22,7 +21,7 @@ public static string GetExportPropertyName(this Uasset SourceFile, int Index) { if (SourceFile.IOFile) { - return GetPropertyName(SourceFile,Index); + return GetPropertyName(SourceFile, Index); } @@ -61,11 +60,9 @@ public static string GetStringUE(this MemoryList memoryList) Stringvalue = memoryList.GetStringValue(StringLength); } } - Stringvalue = Stringvalue.Replace("\r\n", ""); - Stringvalue = Stringvalue.Replace("\r", ""); - Stringvalue = Stringvalue.Replace("\n", ""); - return Stringvalue.TrimEnd('\0'); + + return ReplaceBreaklines(Stringvalue).TrimEnd('\0'); } private static int GetRequiredUtf16Padding(uint NameData) @@ -83,59 +80,44 @@ public static string GetStringUES(this MemoryList memoryList) Data[0] = memoryList.GetByteValue(); Data[1] = memoryList.GetByteValue(); - int len= (int)((Data[0] & 0x7Fu) << 8) + Data[1]; + int len = (int)((Data[0] & 0x7Fu) << 8) + Data[1]; if (IsUtf16(Data[0])) { - if (memoryList.GetByteValue(false)==0) //because "GetRequiredUtf16Padding" not work right :/ + if (memoryList.GetByteValue(false) == 0) //because "GetRequiredUtf16Padding" not work right :/ { memoryList.Skip(1); } - Stringvalue = memoryList.GetStringValue(len*2,true,-1,Encoding.Unicode); + Stringvalue = memoryList.GetStringValue(len * 2, true, -1, Encoding.Unicode); } else { - Stringvalue= memoryList.GetStringValue(len); + Stringvalue = memoryList.GetStringValue(len); } - Stringvalue = Stringvalue.Replace("\r\n", ""); - Stringvalue = Stringvalue.Replace("\r", ""); - Stringvalue = Stringvalue.Replace("\n", ""); - return Stringvalue.TrimEnd('\0'); + + return ReplaceBreaklines(Stringvalue).TrimEnd('\0'); } - public static string GetStringUE(this MemoryList memoryList,Encoding encoding) + public static string GetStringUE(this MemoryList memoryList, Encoding encoding) { - string Stringvalue = memoryList.GetStringValueN(true,-1, encoding); - Stringvalue = Stringvalue.Replace("\r\n", ""); - Stringvalue = Stringvalue.Replace("\r", ""); - Stringvalue = Stringvalue.Replace("\n", ""); + string Stringvalue = ReplaceBreaklines(memoryList.GetStringValueN(true, -1, encoding)); return Stringvalue.TrimEnd('\0'); } - public static string GetStringUE(this MemoryList memoryList,int Lenght, bool SavePosition = true, int SeekAndRead = -1, Encoding encoding = null) + public static string GetStringUE(this MemoryList memoryList, int Lenght, bool SavePosition = true, int SeekAndRead = -1, Encoding encoding = null) { - string Stringvalue = memoryList.GetStringValue(Lenght, SavePosition, SeekAndRead, encoding); - Stringvalue = Stringvalue.Replace("\r\n", ""); - Stringvalue = Stringvalue.Replace("\r", ""); - Stringvalue = Stringvalue.Replace("\n", ""); + string Stringvalue = ReplaceBreaklines(memoryList.GetStringValue(Lenght, SavePosition, SeekAndRead, encoding)); return Stringvalue.TrimEnd('\0'); } - public static string ReplaceString(string Str) - { - Str = Str.Replace("", "\r\n"); - Str = Str.Replace("", "\r"); - return Str.Replace("", "\n"); - } + public static void ReplaceStringUE_Func(this MemoryList memoryList, string StringValue) { - StringValue = StringValue.Replace("", "\r\n"); - StringValue = StringValue.Replace("", "\r"); - StringValue = StringValue.Replace("", "\n"); + ReplaceBreaklines(StringValue, true); memoryList.Skip(-1); ExprToken eExpr = (ExprToken)memoryList.GetByteValue(); @@ -159,7 +141,7 @@ public static void ReplaceStringUE_Func(this MemoryList memoryList, string Strin if (encoding == Encoding.ASCII) { memoryList.SetByteValue((byte)ExprToken.EX_StringConst); - memoryList.InsertStringValueN(StringValue,true,-1, encoding); + memoryList.InsertStringValueN(StringValue, true, -1, encoding); } else { @@ -170,7 +152,7 @@ public static void ReplaceStringUE_Func(this MemoryList memoryList, string Strin - public static bool IsASCII(string StringValue) + public static bool IsASCII(string StringValue) { for (int n = 0; n < StringValue.Length; n++) { @@ -196,20 +178,36 @@ public static void DeleteStringUE(this MemoryList memoryList) memoryList.DeleteBytes(4 + StringLength); } + public static string ReplaceBreaklines(string StringValue, bool Back = false) + { + if (!Back) + { + StringValue = StringValue.Replace("\r\n", ""); + StringValue = StringValue.Replace("\r", ""); + StringValue = StringValue.Replace("\n", ""); + } + else + { + StringValue = StringValue.Replace("", "\r\n"); + StringValue = StringValue.Replace("", "\r"); + StringValue = StringValue.Replace("", "\n"); + } + + return StringValue; + } + public static void ReplaceStringUE(this MemoryList memoryList, string StringValue) { - StringValue = StringValue.Replace("", "\r\n"); - StringValue = StringValue.Replace("", "\r"); - StringValue = StringValue.Replace("", "\n"); + ReplaceBreaklines(StringValue, true); //To save time int ThisPosition = memoryList.GetPosition(); string TempString = memoryList.GetStringUE(); if (StringValue == TempString) { - return; + return; } memoryList.Seek(ThisPosition); @@ -231,7 +229,7 @@ public static void ReplaceStringUE(this MemoryList memoryList, string StringValu encoding = Encoding.ASCII; } - byte[] TextBytes= encoding.GetBytes(StringValue); + byte[] TextBytes = encoding.GetBytes(StringValue); if (encoding == Encoding.ASCII) { @@ -240,7 +238,7 @@ public static void ReplaceStringUE(this MemoryList memoryList, string StringValu } else { - memoryList.InsertIntValue(TextBytes.Length/-2); + memoryList.InsertIntValue(TextBytes.Length / -2); memoryList.InsertBytes(TextBytes); } } diff --git a/UE4localizationsTool/Core/DataTable.cs b/UE4localizationsTool/Core/DataTable.cs index aac1ef3..3cd250c 100644 --- a/UE4localizationsTool/Core/DataTable.cs +++ b/UE4localizationsTool/Core/DataTable.cs @@ -11,8 +11,33 @@ public DataTable(MemoryList memoryList, Uexp uexp, bool Modify = false) for (int TableIndex = 0; TableIndex < TableCount; TableIndex++) { + + //for DRAGON.QUEST.XI.S.Echoes.of.an.Elusive.Age.Definitive.Edition + +#if false + string Name = uexp.UassetData.GetPropertyName(memoryList.GetIntValue()); + memoryList.Skip(4);//null or something + int ThisPosition = memoryList.GetPosition(); + memoryList.Skip(4);//Block size + new ReadStringProperty(memoryList, uexp, Name, Modify); + int ThisPositionAfterEdit = memoryList.GetPosition(); + memoryList.Skip(13);//Block size + + + + if (Modify) + { + memoryList.SetIntValue((ThisPositionAfterEdit - ThisPosition - 4) + 13, false, ThisPosition); + } + +#else + + memoryList.Skip(8); //no neeed _ = new StructProperty(memoryList, uexp, uexp.UassetData.UseFromStruct, false, Modify); +#endif + + } } } diff --git a/UE4localizationsTool/Core/Function.cs b/UE4localizationsTool/Core/Function.cs index 43a0961..fb42806 100644 --- a/UE4localizationsTool/Core/Function.cs +++ b/UE4localizationsTool/Core/Function.cs @@ -64,7 +64,7 @@ public Function(MemoryList memoryList, Uexp Uexp, bool modify = false) ConsoleMode.Print("-\n" + ScriptBytecodeSize + "\n" + scriptStorageSize + "\n-", ConsoleColor.Gray); FuncBlock = new MemoryList(memoryList.GetBytes(scriptStorageSize)); - int index = 0; + int index = 0; while (FuncBlock.GetPosition() < FuncBlock.GetSize()) { ConsoleMode.Print("Start: "+(index++), ConsoleColor.Yellow); @@ -114,7 +114,7 @@ public Function(MemoryList memoryList, Uexp Uexp, bool modify = false) list[x] += ExtraSize; FuncBlock.SetIntValue(list[x], false, offsetList[x]); - ConsoleMode.Print("NewVal: " + list[x], ConsoleColor.DarkYellow); + ConsoleMode.Print("NewVal: " + list[x], ConsoleColor.DarkYellow); ConsoleMode.Print("TotalSize: " + ExtraSize, ConsoleColor.DarkYellow); ConsoleMode.Print("- - - - - - - - ", ConsoleColor.Green); } @@ -229,12 +229,12 @@ void ReadPPOINTER() FuncBlock.Skip(4);//name FuncBlock.Skip(4); } - // offsetList.Add(FuncBlock.GetPosition()); + // offsetList.Add(FuncBlock.GetPosition()); FuncBlock.Skip(4); } else { - // offsetList.Add(FuncBlock.GetPosition()); + // offsetList.Add(FuncBlock.GetPosition()); FuncBlock.Skip(4); } } @@ -336,7 +336,7 @@ ExprToken ReadExpression() case ExprToken.EX_Context: ReadExpression(); - // offsetList.Add(FuncBlock.GetPosition()); + // offsetList.Add(FuncBlock.GetPosition()); offset = FuncBlock.GetIntValue(); ReadPPOINTER(); ReadExpression(); @@ -344,7 +344,7 @@ ExprToken ReadExpression() case ExprToken.EX_Context_FailSilent: ReadExpression(); // Object expression. - // offsetList.Add(FuncBlock.GetPosition()); + // offsetList.Add(FuncBlock.GetPosition()); offset = FuncBlock.GetIntValue();// Code offset for NULL expressions. ReadPPOINTER();// Property corresponding to the r-value data, in case the l-value needs to be mem-zero'd ReadExpression();// Context expression. diff --git a/UE4localizationsTool/Core/Games/RED Game/REDAdvTextData.cs b/UE4localizationsTool/Core/Games/RED Game/REDAdvTextData.cs index e8c4d66..2124886 100644 --- a/UE4localizationsTool/Core/Games/RED Game/REDAdvTextData.cs +++ b/UE4localizationsTool/Core/Games/RED Game/REDAdvTextData.cs @@ -37,7 +37,7 @@ public REDAdvTextData(MemoryList memoryList, Uexp uexp, bool Modify = false) MemoryList ATFBlock = new MemoryList(memoryList.GetBytes(UncompressedSize)); - MagicId = ATFBlock.GetStringValueN(); + MagicId = ATFBlock.GetStringValueN(); if (MagicId != "ATF") { @@ -90,7 +90,7 @@ public REDAdvTextData(MemoryList memoryList, Uexp uexp, bool Modify = false) // Console.WriteLine(n+": " + tagsOffsets +" - "+ tagsLength + " - "+ stringOffsets + " - "+ stringLength); uexp.Strings.Add(new List() { StringsTags.GetStringUE(tagsLength, false, tagsOffsets), StringsBlock.GetStringUE(stringLength * 2, false, stringOffsets * 2, System.Text.Encoding.Unicode) }); - + } } else @@ -99,7 +99,7 @@ public REDAdvTextData(MemoryList memoryList, Uexp uexp, bool Modify = false) for (int n = 0; n < StringCount; n++) { - byte[] StrBytes = Encoding.Unicode.GetBytes(AssetHelper.ReplaceString(uexp.Strings[uexp.CurrentIndex][1] + '\0')); + byte[] StrBytes = Encoding.Unicode.GetBytes(AssetHelper.ReplaceBreaklines(uexp.Strings[uexp.CurrentIndex][1] + '\0', true)); uexp.CurrentIndex++; StringsInfo.GetIntValue(); //tagsOffsets diff --git a/UE4localizationsTool/Core/Games/RED Game/REDLibraryTextData.cs b/UE4localizationsTool/Core/Games/RED Game/REDLibraryTextData.cs index a00e11d..f2b7d17 100644 --- a/UE4localizationsTool/Core/Games/RED Game/REDLibraryTextData.cs +++ b/UE4localizationsTool/Core/Games/RED Game/REDLibraryTextData.cs @@ -55,10 +55,10 @@ public REDLibraryTextData(MemoryList memoryList, Uexp uexp, bool Modify = false) { for (int i = 0; i < StringCount; i++) { - uexp.Strings.Add(new List() { IdValues[i], Block.GetStringUE(Encoding.Unicode)}); + uexp.Strings.Add(new List() { IdValues[i], Block.GetStringUE(Encoding.Unicode) }); } } - else + else { Block.SetSize(Block.GetPosition()); @@ -73,7 +73,7 @@ public REDLibraryTextData(MemoryList memoryList, Uexp uexp, bool Modify = false) memoryList.SetIntValue(Block.GetSize()); memoryList.SetSize(StartOffset); - + memoryList.Seek(StartOffset); memoryList.Add(Block.ToArray()); } diff --git a/UE4localizationsTool/Core/Games/RED Game/REDLocalizeTextData.cs b/UE4localizationsTool/Core/Games/RED Game/REDLocalizeTextData.cs index be36853..705b667 100644 --- a/UE4localizationsTool/Core/Games/RED Game/REDLocalizeTextData.cs +++ b/UE4localizationsTool/Core/Games/RED Game/REDLocalizeTextData.cs @@ -30,7 +30,7 @@ public REDLocalizeTextData(MemoryList memoryList, Uexp uexp, bool Modify = false { if (!Modify) { - uexp.Strings.Add(new List() { String[n], String[n + 1] }); + uexp.Strings.Add(new List() { String[n], String[n + 1] }); } else { diff --git a/UE4localizationsTool/Core/Games/TheLastOricru.cs b/UE4localizationsTool/Core/Games/TheLastOricru.cs new file mode 100644 index 0000000..a630dc1 --- /dev/null +++ b/UE4localizationsTool/Core/Games/TheLastOricru.cs @@ -0,0 +1,69 @@ +using AssetParser; +using Helper.MemoryList; +using System; +using System.Collections.Generic; +using System.Text; + +namespace UE4localizationsTool.Core.Games +{ + public class TheLastOricru + { + public TheLastOricru(MemoryList memoryList, string PropertyName, Uexp uexp, bool Modify = false) + { + + + try + { + + while (true) + { + + + RemoveBytes: + while (memoryList.GetByteValue(false) != 1) + { + memoryList.Skip(1); + } + + memoryList.Skip(1); + + if (memoryList.GetByteValue(false) == 1) + { + goto RemoveBytes; + } + + var Position = memoryList.GetPosition(); + if (!UDataTable.IsGoodText(memoryList.GetStringValue(memoryList.GetByteValue(), true, -1, Encoding.UTF8))) + { + memoryList.SetPosition(Position); + goto RemoveBytes; + } + memoryList.SetPosition(Position); + + if (!Modify) + { + uexp.Strings.Add(new List() { PropertyName, AssetHelper.ReplaceBreaklines(memoryList.GetStringValue(memoryList.GetByteValue(), true, -1, Encoding.UTF8)) }); + ConsoleMode.Print(uexp.Strings[uexp.Strings.Count - 1][1], ConsoleColor.Magenta); + } + else + { + + memoryList.DeleteBytes(memoryList.GetByteValue(false) + 1); + var StrBytes = Encoding.UTF8.GetBytes(AssetHelper.ReplaceBreaklines(uexp.Strings[uexp.CurrentIndex][1], true)); + memoryList.InsertByteValue((byte)StrBytes.Length); + memoryList.InsertBytes(StrBytes); + uexp.CurrentIndex++; + } + } + } + catch + { + //nothing + } + + + + + } + } +} \ No newline at end of file diff --git a/UE4localizationsTool/Core/Games/UDataTable.cs b/UE4localizationsTool/Core/Games/UDataTable.cs index cd79f53..30195b6 100644 --- a/UE4localizationsTool/Core/Games/UDataTable.cs +++ b/UE4localizationsTool/Core/Games/UDataTable.cs @@ -1,7 +1,6 @@ using Helper.MemoryList; using System; using System.Text; -using System.Text.RegularExpressions; namespace AssetParser { @@ -24,6 +23,11 @@ public UDataTable(MemoryList memoryList, Uexp uexp, bool Modify = false) int StringSize = memoryList.GetIntValue(); BlockSize = StringSize; string Text; + if (StringSize > 2000) + { + memoryList.Seek(pos + 1); + continue; + } if (StringSize < 0) { StringSize = (StringSize * -1); @@ -37,7 +41,7 @@ public UDataTable(MemoryList memoryList, Uexp uexp, bool Modify = false) if ((uexp.UassetData.NAMES_DIRECTORY.Count > ID1 && ID1 >= uexp.UassetData.PathCount) && (uexp.UassetData.NAMES_DIRECTORY.Count > ID2 && ID2 >= 0)) { - if (uexp.UassetData.GetPropertyName((int)ID1)!= "None") + if (uexp.UassetData.GetPropertyName(ID1) != "None") { Name = ID1; } @@ -70,7 +74,7 @@ public UDataTable(MemoryList memoryList, Uexp uexp, bool Modify = false) } memoryList.Seek(pos); - new ReadStringProperty(memoryList, uexp, uexp.UassetData.GetPropertyName((int)Name), Modify); + new ReadStringProperty(memoryList, uexp, uexp.UassetData.GetPropertyName(Name), Modify); } else { @@ -85,11 +89,11 @@ public UDataTable(MemoryList memoryList, Uexp uexp, bool Modify = false) } - public bool IsGoodText(string text) + public static bool IsGoodText(string text) { if (String.IsNullOrEmpty(text)) { - return false; + return false; } //if (Regex.IsMatch(text, @"[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F]")) @@ -97,19 +101,19 @@ public bool IsGoodText(string text) // return false; //} - foreach(char c in text) + foreach (char c in text) { - if ((c >= 0x00 && c <= 0x1F || c == 0x7f) && c != 0x09 && c != 0x0A && c != 0x0D ) + if ((c >= 0x00 && c <= 0x1F || c == 0x7f) && c != 0x09 && c != 0x0A && c != 0x0D) { - return false; + return false; } } return true; } - + } } diff --git a/UE4localizationsTool/Core/IAsset.cs b/UE4localizationsTool/Core/IAsset.cs new file mode 100644 index 0000000..f1704af --- /dev/null +++ b/UE4localizationsTool/Core/IAsset.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace AssetParser +{ + public interface IAsset + { + bool IsGood { get; } + List> Strings { get; } + void SaveFile(string FilPath); + } +} diff --git a/UE4localizationsTool/Core/StructProperty.cs b/UE4localizationsTool/Core/StructProperty.cs index 2715e0f..4872ba3 100644 --- a/UE4localizationsTool/Core/StructProperty.cs +++ b/UE4localizationsTool/Core/StructProperty.cs @@ -1,6 +1,7 @@ using Helper.MemoryList; using System; using System.Collections.Generic; +using UE4localizationsTool.Core.Games; namespace AssetParser { @@ -148,9 +149,19 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true, } else { - for (int Arrayindex = 0; Arrayindex < ArrayCount; Arrayindex++) + + if (ArrayType == "ByteProperty" && PropertyName == "bytes") { - PropertyParser(ref PropertyName, ArrayType, -1, ArrayData, uexp, Modify); + new TheLastOricru(ArrayData, PropertyName, uexp, Modify); + } + else + { + + + for (int Arrayindex = 0; Arrayindex < ArrayCount; Arrayindex++) + { + PropertyParser(ref PropertyName, ArrayType, -1, ArrayData, uexp, Modify); + } } } } @@ -524,7 +535,7 @@ private void PropertyParser(ref string PropertyName, string Property, int Proper memoryList.Skip(4); if (!Modify) { - uexp.Strings.Add(new List() { PropertyName, uexp.UassetData.GetPropertyName(NameIndex),!uexp.UassetData.IOFile?"be careful with this value." : "Can't edit this value.", !uexp.UassetData.IOFile ? "#FFBFB2": "#FF0000" }); + uexp.Strings.Add(new List() { PropertyName, uexp.UassetData.GetPropertyName(NameIndex), !uexp.UassetData.IOFile ? "be careful with this value." : "Can't edit this value.", !uexp.UassetData.IOFile ? "#FFBFB2" : "#FF0000", "#000000" }); } else { @@ -650,9 +661,16 @@ private void PropertyParser(ref string PropertyName, string Property, int Proper MemoryList StructData = new MemoryList(memoryList.GetBytes(StructLength)); try { - for (int Arrayindex = 0; Arrayindex < ArrayCount; Arrayindex++) + if (ArrayType == "ByteProperty" && PropertyName == "bytes") { - PropertyParser(ref PropertyName, StructType, -1, StructData, uexp, Modify); + new TheLastOricru(StructData, PropertyName, uexp, Modify); + } + else + { + for (int Arrayindex = 0; Arrayindex < ArrayCount; Arrayindex++) + { + PropertyParser(ref PropertyName, ArrayType, -1, StructData, uexp, Modify); + } } } catch diff --git a/UE4localizationsTool/Core/Uasset.cs b/UE4localizationsTool/Core/Uasset.cs index b0315c8..aebd447 100644 --- a/UE4localizationsTool/Core/Uasset.cs +++ b/UE4localizationsTool/Core/Uasset.cs @@ -78,7 +78,7 @@ public struct ExportsDirectory public MemoryList UexpFile; public bool IsNotUseUexp; public bool UseFromStruct = true; - public bool AutoVersion=false; + public bool AutoVersion = false; public int Header_Size; @@ -98,11 +98,6 @@ public struct ExportsDirectory public Uasset(string FilePath) { - - if (!File.Exists(FilePath)) - { - throw new Exception("Uasset file is not exists!"); - } UassetFile = new MemoryList(FilePath); @@ -111,15 +106,15 @@ public Uasset(string FilePath) //Todo EngineVersion = UE4Version.VER_UE4_16; //?! - IsNotUseUexp =true; + IsNotUseUexp = true; IOFile = true; - UassetFile.Skip(16+4); - Header_Size = UassetFile.GetIntValue(); + UassetFile.Skip(16 + 4); + Header_Size = UassetFile.GetIntValue(); Name_Directory_Offset = UassetFile.GetIntValue(); - Name_Directory_Size = UassetFile.GetIntValue(); + Name_Directory_Size = UassetFile.GetIntValue(); Hash_Directory_offset = UassetFile.GetIntValue(); Hash_Directory_Size = UassetFile.GetIntValue(); - Imports_Directory_Offset=UassetFile.GetIntValue(); + Imports_Directory_Offset = UassetFile.GetIntValue(); Exports_Directory_Offset = UassetFile.GetIntValue(); Bundles_Offset = UassetFile.GetIntValue(); GraphData_Offset = UassetFile.GetIntValue(); @@ -139,7 +134,7 @@ public Uasset(string FilePath) for (int n = 0; n < Number_of_Names; n++) { NAMES_DIRECTORY.Add(UassetFile.GetStringUES()); - if (NAMES_DIRECTORY[n].Contains(@"/")&& PathModify) + if (NAMES_DIRECTORY[n].Contains(@"/") && PathModify) { PathCount++; } @@ -151,8 +146,8 @@ public Uasset(string FilePath) //UassetFile.Seek(Hash_Directory_offset, SeekOrigin.Begin); - - + + //seek to position UassetFile.Seek(Exports_Directory_Offset, SeekOrigin.Begin); @@ -160,7 +155,7 @@ public Uasset(string FilePath) Exports_Directory = new List(); ExportReadOrEditIO(); - return; + return; } @@ -636,7 +631,7 @@ public void ExportReadOrEdit(bool Modify = false) } - public void ExportReadOrEditIO(bool Modify=false) + public void ExportReadOrEditIO(bool Modify = false) { //seek to position UassetFile.Seek(Exports_Directory_Offset, SeekOrigin.Begin); @@ -654,8 +649,8 @@ public void ExportReadOrEditIO(bool Modify=false) } else { - UassetFile.SetInt64Value((long)(Header_Size+(NextExportPosition-File_Directory_Offset))); - UassetFile.SetInt64Value((long)Exports_Directory[n].ExportData.Count); + UassetFile.SetInt64Value(Header_Size + (NextExportPosition - File_Directory_Offset)); + UassetFile.SetInt64Value(Exports_Directory[n].ExportData.Count); } ExportsDirectory.ExportName = UassetFile.GetIntValue(); UassetFile.Skip(4); @@ -682,7 +677,7 @@ public void ExportReadOrEditIO(bool Modify=false) ExportsDirectory.ExportClass = NAMES_DIRECTORY.IndexOf("StructProperty"); } - + if (!Modify) { @@ -690,7 +685,7 @@ public void ExportReadOrEditIO(bool Modify=false) ExportsDirectory.ExportData.AddRange(UassetFile.GetBytes(ExportsDirectory.ExportLength, false, NextExportPosition)); Exports_Directory.Add(ExportsDirectory); } - + NextExportPosition += ExportsDirectory.ExportLength; UassetFile.Seek(Start + 72); } @@ -701,18 +696,18 @@ int ExportSize() int Totalsize = 0; foreach (ExportsDirectory Size in Exports_Directory) { - Totalsize+= Size.ExportData.Count; + Totalsize += Size.ExportData.Count; } return Totalsize; } - public void UpdateOffset() + public void UpdateOffset() { //for textures 🤔 - if (FBulkDataStartOffset>0&& BulkDataStartOffset>0) + if (FBulkDataStartOffset > 0 && BulkDataStartOffset > 0) { UassetFile.SetIntValue(IsNotUseUexp ? UassetFile.GetSize() : UassetFile.GetSize() + ExportSize(), false, FBulkDataStartOffset); } - } + } } } diff --git a/UE4localizationsTool/Core/Uexp.cs b/UE4localizationsTool/Core/Uexp.cs index 682e7ee..6482460 100644 --- a/UE4localizationsTool/Core/Uexp.cs +++ b/UE4localizationsTool/Core/Uexp.cs @@ -1,16 +1,23 @@ using Helper.MemoryList; using System; using System.Collections.Generic; - namespace AssetParser -{ - - public class Uexp +{ + + public class Uexp : IAsset { public Uasset UassetData; + List> IAsset.Strings + { + get { return Strings; } + } + + + public List> Strings; //[Text id,Text Value,...] private int _CurrentIndex; + bool IAsset.IsGood { get { return IsGood; } } public bool IsGood = true; public int ExportIndex; public int CurrentIndex @@ -26,6 +33,9 @@ public int CurrentIndex } } + + + public Uexp(Uasset assets) { UassetData = assets; @@ -42,13 +52,14 @@ private void ReadOrEdit(bool Modify = false) for (int n = 0; n < UassetData.Exports_Directory.Count; n++) { - ExportIndex = n; - using (MemoryList memoryList = new MemoryList(UassetData.Exports_Directory[n].ExportData)) { try { + ConsoleMode.Print("Block Start offset: " + UassetData.Exports_Directory[n].ExportStart.ToString(), ConsoleColor.DarkRed); + ConsoleMode.Print("Block Size: " + UassetData.Exports_Directory[n].ExportLength.ToString(), ConsoleColor.DarkRed); + memoryList.Seek(0); //Seek to beginning of Block if (UassetData.UseMethod2) @@ -56,32 +67,35 @@ private void ReadOrEdit(bool Modify = false) new UDataTable(memoryList, this, Modify); continue; } - + ConsoleMode.Print(UassetData.GetExportPropertyName(UassetData.Exports_Directory[n].ExportClass), ConsoleColor.DarkRed); - if (memoryList.GetByteValue(false)==0) + + + if (memoryList.GetByteValue(false) == 0 && UassetData.GetExportPropertyName(UassetData.Exports_Directory[n].ExportClass) != "MovieSceneCompiledData" && memoryList.GetIntValue(false) > UassetData.NAMES_DIRECTORY.Count) { memoryList.Skip(2); goto Start; } - ConsoleMode.Print($"-----------{n}------------", ConsoleColor.Red); - _ = new StructProperty(memoryList, this, UassetData.UseFromStruct, false, Modify); - ConsoleMode.Print($"-----------End------------", ConsoleColor.Red); - + ConsoleMode.Print($"-----------{n}------------", ConsoleColor.Red); + _ = new StructProperty(memoryList, this, UassetData.UseFromStruct, false, Modify); + ConsoleMode.Print($"-----------End------------", ConsoleColor.Red); + if (memoryList.EndofFile()) { continue; } - Start: + Start: ConsoleMode.Print($"-----------{n}------------", ConsoleColor.DarkRed); switch (UassetData.GetExportPropertyName(UassetData.Exports_Directory[n].ExportClass)) { case "StringTable": new StringTable(memoryList, this, Modify); break; + case "CompositeDataTable": case "DataTable": - if (memoryList.GetIntValue(false)!=-5) + if (memoryList.GetIntValue(false) != -5) { new DataTable(memoryList, this, Modify); } @@ -91,8 +105,8 @@ private void ReadOrEdit(bool Modify = false) if (memoryList.GetIntValue(false) != -5) { new DataTable(memoryList, this, Modify); - } - else + } + else { new UDataTable(memoryList, this, Modify); } @@ -108,6 +122,9 @@ private void ReadOrEdit(bool Modify = false) case "REDLocalizeTextData": new REDLocalizeTextData(memoryList, this, Modify); break; + case "REDLibraryTextData": + new REDLibraryTextData(memoryList, this, Modify); + break; case "REDAdvTextData": new REDAdvTextData(memoryList, this, Modify); break; @@ -117,10 +134,10 @@ private void ReadOrEdit(bool Modify = false) } ConsoleMode.Print($"-----------End------------", ConsoleColor.DarkRed); } - catch(Exception ex) + catch (Exception ex) { - ConsoleMode.Print("Skip this export:\n"+ ex.ToString(),ConsoleColor.Red); - //Console.ReadLine(); + ConsoleMode.Print("Skip this export:\n" + ex.ToString(), ConsoleColor.Red); + // Console.ReadLine(); // Skip this export } } @@ -145,7 +162,7 @@ public void SaveFile(string FilPath) if (UassetData.IsNotUseUexp) { MakeBlocks(); - UassetData.UassetFile.WriteFile(System.IO.Path.ChangeExtension(FilPath, FilPath.ToLower().EndsWith(".umap")? ".umap" : ".uasset")); + UassetData.UassetFile.WriteFile(System.IO.Path.ChangeExtension(FilPath, FilPath.ToLower().EndsWith(".umap") ? ".umap" : ".uasset")); } else { @@ -168,7 +185,7 @@ private MemoryList MakeBlocks() if (!UassetData.IOFile) { - UassetData.UassetFile.Add((uint)2653586369); + UassetData.UassetFile.Add(2653586369); } return UassetData.UassetFile; } @@ -180,7 +197,7 @@ private MemoryList MakeBlocks() { memoryList.MemoryListData.AddRange(x.ExportData); }); - memoryList.Add((uint)2653586369); + memoryList.Add(2653586369); return memoryList; } } diff --git a/UE4localizationsTool/Core/locres.cs b/UE4localizationsTool/Core/locres.cs index 1b5d91a..5da01b1 100644 --- a/UE4localizationsTool/Core/locres.cs +++ b/UE4localizationsTool/Core/locres.cs @@ -5,7 +5,7 @@ namespace AssetParser { - public class locres + public class locres : IAsset { public enum LocresVersion : byte { @@ -16,14 +16,30 @@ public enum LocresVersion : byte } //{7574140E-4A67-FC03-4A15-909DC3377F1B} - private readonly byte[] MagicGUID = { (byte)0x0E, (byte)0x14, (byte)0x74, (byte)0x75, (byte)0x67, (byte)0x4A, (byte)0x03, (byte)0xFC, (byte)0x4A, (byte)0x15, (byte)0x90, (byte)0x9D, (byte)0xC3, (byte)0x37, (byte)0x7F, (byte)0x1B }; + private readonly byte[] MagicGUID = { 0x0E, 0x14, 0x74, 0x75, 0x67, 0x4A, 0x03, 0xFC, 0x4A, 0x15, 0x90, 0x9D, 0xC3, 0x37, 0x7F, 0x1B }; + + bool IAsset.IsGood + { + get + { + return true; + } + } + + List> IAsset.Strings + { + get + { + return Strings; + } + } public List> Strings; public int CurrentIndex; MemoryList locresData; public locres(string FilePath) { - Strings = new List>();//[Text id,Text Value,...] -> Text id = TextIndex + Strings = new List>();//[Text id,Text Value,...] locresData = new MemoryList(FilePath); ReadOrEdit(); @@ -49,11 +65,9 @@ private void ReadOrEdit(bool Modify = false) throw new Exception("Unsupported locres version"); } - // Console.WriteLine(Version); if (Version >= LocresVersion.Compact) { - // Console.WriteLine("Compact"); int localizedStringOffset = (int)locresData.GetInt64Value(); int currentFileOffset = locresData.GetPosition(); @@ -165,9 +179,8 @@ private void ReadOrEdit(bool Modify = false) int localizedStringIndex = locresData.GetIntValue(); if (Strings.Count > localizedStringIndex) { - Strings[localizedStringIndex][0] = KeyStr; + Strings[localizedStringIndex][0] = nameSpaceStr + "::" + KeyStr; } - } } diff --git a/UE4localizationsTool/Forms/FrmAbout.Designer.cs b/UE4localizationsTool/Forms/FrmAbout.Designer.cs index 22a0289..3588f0c 100644 --- a/UE4localizationsTool/Forms/FrmAbout.Designer.cs +++ b/UE4localizationsTool/Forms/FrmAbout.Designer.cs @@ -56,12 +56,12 @@ private void InitializeComponent() this.textBox1.BackColor = System.Drawing.SystemColors.Control; this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBox1.Location = new System.Drawing.Point(3, 37); + this.textBox1.Location = new System.Drawing.Point(5, 37); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; this.textBox1.ReadOnly = true; this.textBox1.ShortcutsEnabled = false; - this.textBox1.Size = new System.Drawing.Size(383, 73); + this.textBox1.Size = new System.Drawing.Size(387, 73); this.textBox1.TabIndex = 2; this.textBox1.Text = "UE4 localizations Tool is a simple tool to edit unreal engine 4 text files.\r\n\r\nAu" + "thor: amr shaheeen(@amrshaheen61)\r\n"; @@ -73,17 +73,15 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.ClientSize = new System.Drawing.Size(384, 167); + this.ClientSize = new System.Drawing.Size(396, 167); this.Controls.Add(this.textBox1); this.Controls.Add(this.button1); this.Controls.Add(this.label2); this.Cursor = System.Windows.Forms.Cursors.AppStarting; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(400, 206); - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(400, 206); + this.MaximumSize = new System.Drawing.Size(412, 206); + this.MinimumSize = new System.Drawing.Size(412, 206); this.Name = "FrmAbout"; this.ShowIcon = false; this.ShowInTaskbar = false; diff --git a/UE4localizationsTool/Forms/FrmAbout.cs b/UE4localizationsTool/Forms/FrmAbout.cs index fa5fd54..2206d67 100644 --- a/UE4localizationsTool/Forms/FrmAbout.cs +++ b/UE4localizationsTool/Forms/FrmAbout.cs @@ -1,10 +1,11 @@ using System; using System.Drawing; using System.Windows.Forms; +using UE4localizationsTool.Controls; namespace UE4localizationsTool { - public partial class FrmAbout : Form + public partial class FrmAbout : NForm { public FrmAbout(Form form) { diff --git a/UE4localizationsTool/Forms/FrmFilter.Designer.cs b/UE4localizationsTool/Forms/FrmFilter.Designer.cs index e29b699..32d3fb3 100644 --- a/UE4localizationsTool/Forms/FrmFilter.Designer.cs +++ b/UE4localizationsTool/Forms/FrmFilter.Designer.cs @@ -38,7 +38,7 @@ private void InitializeComponent() this.RemoveSelected = new System.Windows.Forms.Button(); this.ClearList = new System.Windows.Forms.Button(); this.matchcase = new System.Windows.Forms.CheckBox(); - this.Close = new System.Windows.Forms.Button(); + this.BtnClose = new System.Windows.Forms.Button(); this.regularexpression = new System.Windows.Forms.CheckBox(); this.reversemode = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); @@ -136,15 +136,15 @@ private void InitializeComponent() // // Close // - this.Close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.Close.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Close.Location = new System.Drawing.Point(441, 110); - this.Close.Name = "Close"; - this.Close.Size = new System.Drawing.Size(113, 23); - this.Close.TabIndex = 10; - this.Close.Text = "Close"; - this.Close.UseVisualStyleBackColor = true; - this.Close.Click += new System.EventHandler(this.Close_Click); + this.BtnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.BtnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.BtnClose.Location = new System.Drawing.Point(441, 110); + this.BtnClose.Name = "Close"; + this.BtnClose.Size = new System.Drawing.Size(113, 23); + this.BtnClose.TabIndex = 10; + this.BtnClose.Text = "Close"; + this.BtnClose.UseVisualStyleBackColor = true; + this.BtnClose.Click += new System.EventHandler(this.Close_Click); // // regularexpression // @@ -176,7 +176,7 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(584, 261); this.Controls.Add(this.reversemode); this.Controls.Add(this.regularexpression); - this.Controls.Add(this.Close); + this.Controls.Add(this.BtnClose); this.Controls.Add(this.matchcase); this.Controls.Add(this.ClearList); this.Controls.Add(this.RemoveSelected); @@ -214,7 +214,7 @@ private void InitializeComponent() private System.Windows.Forms.Button RemoveSelected; private System.Windows.Forms.Button ClearList; private System.Windows.Forms.CheckBox matchcase; - private System.Windows.Forms.Button Close; + private System.Windows.Forms.Button BtnClose; private System.Windows.Forms.CheckBox regularexpression; private System.Windows.Forms.CheckBox reversemode; } diff --git a/UE4localizationsTool/Forms/FrmFilter.cs b/UE4localizationsTool/Forms/FrmFilter.cs index ba3eb6b..61be3fe 100644 --- a/UE4localizationsTool/Forms/FrmFilter.cs +++ b/UE4localizationsTool/Forms/FrmFilter.cs @@ -3,10 +3,11 @@ using System.Drawing; using System.IO; using System.Windows.Forms; +using UE4localizationsTool.Controls; namespace UE4localizationsTool { - public partial class FrmFilter : Form + public partial class FrmFilter : NForm { public bool UseMatching; public bool RegularExpression; diff --git a/UE4localizationsTool/Forms/FrmMain.Designer.cs b/UE4localizationsTool/Forms/FrmMain.Designer.cs index e540609..41def34 100644 --- a/UE4localizationsTool/Forms/FrmMain.Designer.cs +++ b/UE4localizationsTool/Forms/FrmMain.Designer.cs @@ -63,8 +63,10 @@ private void InitializeComponent() this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.rightToLeftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.darkModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.Method2 = new System.Windows.Forms.ToolStripMenuItem(); + this.UseFixedSize = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.commandLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.donateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -90,11 +92,13 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SearchPanal.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // menuStrip1 // this.menuStrip1.AllowDrop = true; + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.editToolStripMenuItem, @@ -120,7 +124,7 @@ private void InitializeComponent() // this.OpenFile.Name = "OpenFile"; this.OpenFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.OpenFile.Size = new System.Drawing.Size(180, 22); + this.OpenFile.Size = new System.Drawing.Size(146, 22); this.OpenFile.Text = "Open"; this.OpenFile.Click += new System.EventHandler(this.OpenFile_Click); // @@ -129,7 +133,7 @@ private void InitializeComponent() this.saveToolStripMenuItem.Enabled = false; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.saveToolStripMenuItem.Text = "Save"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveFile); // @@ -137,7 +141,7 @@ private void InitializeComponent() // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(146, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -158,8 +162,10 @@ private void InitializeComponent() this.toolStripSeparator3, this.fontToolStripMenuItem, this.rightToLeftToolStripMenuItem, + this.darkModeToolStripMenuItem, this.toolStripSeparator4, - this.Method2}); + this.Method2, + this.UseFixedSize}); this.editToolStripMenuItem.Name = "editToolStripMenuItem"; this.editToolStripMenuItem.Size = new System.Drawing.Size(41, 24); this.editToolStripMenuItem.Text = "Tool"; @@ -171,7 +177,7 @@ private void InitializeComponent() this.withNamesToolStripMenuItem}); this.exportAllTextToolStripMenuItem.Enabled = false; this.exportAllTextToolStripMenuItem.Name = "exportAllTextToolStripMenuItem"; - this.exportAllTextToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.exportAllTextToolStripMenuItem.Size = new System.Drawing.Size(229, 22); this.exportAllTextToolStripMenuItem.Text = "Export all text"; // // noNamesToolStripMenuItem @@ -197,20 +203,20 @@ private void InitializeComponent() this.importAllTextToolStripMenuItem.Enabled = false; this.importAllTextToolStripMenuItem.Name = "importAllTextToolStripMenuItem"; this.importAllTextToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); - this.importAllTextToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.importAllTextToolStripMenuItem.Size = new System.Drawing.Size(229, 22); this.importAllTextToolStripMenuItem.Text = "Import all text"; this.importAllTextToolStripMenuItem.Click += new System.EventHandler(this.importAllTextToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(210, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(226, 6); // // find // this.find.Name = "find"; this.find.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); - this.find.Size = new System.Drawing.Size(213, 22); + this.find.Size = new System.Drawing.Size(229, 22); this.find.Text = "Find"; this.find.Click += new System.EventHandler(this.search_Click); // @@ -222,7 +228,7 @@ private void InitializeComponent() this.clearFilterToolStripMenuItem}); this.filterToolStripMenuItem.Enabled = false; this.filterToolStripMenuItem.Name = "filterToolStripMenuItem"; - this.filterToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.filterToolStripMenuItem.Size = new System.Drawing.Size(229, 22); this.filterToolStripMenuItem.Text = "Filter"; // // byNameToolStripMenuItem @@ -256,7 +262,7 @@ private void InitializeComponent() this.nameToolStripMenuItem, this.valueToolStripMenuItem}); this.sortToolStripMenuItem.Name = "sortToolStripMenuItem"; - this.sortToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.sortToolStripMenuItem.Size = new System.Drawing.Size(229, 22); this.sortToolStripMenuItem.Text = "Sort"; // // nameToolStripMenuItem @@ -309,14 +315,14 @@ private void InitializeComponent() // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(210, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(226, 6); // // undoToolStripMenuItem // this.undoToolStripMenuItem.Enabled = false; this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; this.undoToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Z"; - this.undoToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.undoToolStripMenuItem.Size = new System.Drawing.Size(229, 22); this.undoToolStripMenuItem.Text = "Undo"; this.undoToolStripMenuItem.Click += new System.EventHandler(this.undoToolStripMenuItem_Click); // @@ -327,7 +333,7 @@ private void InitializeComponent() this.redoToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Shift+Z/Ctrl+Y"; this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.Z))); - this.redoToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.redoToolStripMenuItem.Size = new System.Drawing.Size(229, 22); this.redoToolStripMenuItem.Text = "Redo"; this.redoToolStripMenuItem.Click += new System.EventHandler(this.redoToolStripMenuItem_Click); // @@ -335,7 +341,7 @@ private void InitializeComponent() // this.copyToolStripMenuItem1.Name = "copyToolStripMenuItem1"; this.copyToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+C"; - this.copyToolStripMenuItem1.Size = new System.Drawing.Size(213, 22); + this.copyToolStripMenuItem1.Size = new System.Drawing.Size(229, 22); this.copyToolStripMenuItem1.Text = "Copy"; this.copyToolStripMenuItem1.Click += new System.EventHandler(this.copyToolStripMenuItem_Click); // @@ -343,19 +349,19 @@ private void InitializeComponent() // this.pasteToolStripMenuItem1.Name = "pasteToolStripMenuItem1"; this.pasteToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+V"; - this.pasteToolStripMenuItem1.Size = new System.Drawing.Size(213, 22); + this.pasteToolStripMenuItem1.Size = new System.Drawing.Size(229, 22); this.pasteToolStripMenuItem1.Text = "Paste"; this.pasteToolStripMenuItem1.Click += new System.EventHandler(this.pasteToolStripMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(210, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(226, 6); // // fontToolStripMenuItem // this.fontToolStripMenuItem.Name = "fontToolStripMenuItem"; - this.fontToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.fontToolStripMenuItem.Size = new System.Drawing.Size(229, 22); this.fontToolStripMenuItem.Text = "Font"; this.fontToolStripMenuItem.Click += new System.EventHandler(this.fontToolStripMenuItem_Click); // @@ -363,14 +369,26 @@ private void InitializeComponent() // this.rightToLeftToolStripMenuItem.Name = "rightToLeftToolStripMenuItem"; this.rightToLeftToolStripMenuItem.ShortcutKeyDisplayString = ""; - this.rightToLeftToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.rightToLeftToolStripMenuItem.Size = new System.Drawing.Size(229, 22); this.rightToLeftToolStripMenuItem.Text = "Right to left (on/off)"; this.rightToLeftToolStripMenuItem.Click += new System.EventHandler(this.rightToLeftToolStripMenuItem_Click); // + // darkModeToolStripMenuItem + // + this.darkModeToolStripMenuItem.CheckOnClick = true; + this.darkModeToolStripMenuItem.Name = "darkModeToolStripMenuItem"; + this.darkModeToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) + | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.D))); + this.darkModeToolStripMenuItem.Size = new System.Drawing.Size(229, 22); + this.darkModeToolStripMenuItem.Text = "Dark mode"; + this.darkModeToolStripMenuItem.Visible = false; + this.darkModeToolStripMenuItem.CheckedChanged += new System.EventHandler(this.darkModeToolStripMenuItem_CheckedChanged); + // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(265, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(226, 6); // // Method2 // @@ -378,10 +396,20 @@ private void InitializeComponent() this.Method2.Name = "Method2"; this.Method2.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) | System.Windows.Forms.Keys.M))); - this.Method2.Size = new System.Drawing.Size(268, 26); + this.Method2.Size = new System.Drawing.Size(229, 22); this.Method2.Text = "Use method 2"; + this.Method2.ToolTipText = "trying to catch text without using ue4 asset structure (for uasset and umap only)" + + ""; this.Method2.CheckedChanged += new System.EventHandler(this.Method2_CheckedChanged); // + // UseFixedSize + // + this.UseFixedSize.CheckOnClick = true; + this.UseFixedSize.Name = "UseFixedSize"; + this.UseFixedSize.Size = new System.Drawing.Size(229, 22); + this.UseFixedSize.Text = "Fixed Size"; + this.UseFixedSize.Visible = false; + // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -395,21 +423,21 @@ private void InitializeComponent() // commandLinesToolStripMenuItem // this.commandLinesToolStripMenuItem.Name = "commandLinesToolStripMenuItem"; - this.commandLinesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.commandLinesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); this.commandLinesToolStripMenuItem.Text = "Command Lines"; this.commandLinesToolStripMenuItem.Click += new System.EventHandler(this.commandLinesToolStripMenuItem_Click); // // donateToolStripMenuItem // this.donateToolStripMenuItem.Name = "donateToolStripMenuItem"; - this.donateToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.donateToolStripMenuItem.Size = new System.Drawing.Size(161, 22); this.donateToolStripMenuItem.Text = "Donate"; this.donateToolStripMenuItem.Click += new System.EventHandler(this.donateToolStripMenuItem_Click); // // aboutToolStripMenuItem1 // this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1"; - this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); + this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(161, 22); this.aboutToolStripMenuItem1.Text = "About"; this.aboutToolStripMenuItem1.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click); // @@ -434,11 +462,14 @@ private void InitializeComponent() this.dataGridView1.MultiSelect = false; this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.RowHeadersVisible = false; + this.dataGridView1.RowHeadersWidth = 51; this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView1.Size = new System.Drawing.Size(689, 427); this.dataGridView1.TabIndex = 1; this.dataGridView1.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dataGridView1_CellBeginEdit); this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit); + this.dataGridView1.CellValidated += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValidated); + this.dataGridView1.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView1_CellValidating); this.dataGridView1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValueChanged); this.dataGridView1.Sorted += new System.EventHandler(this.dataGridView1_Sorted); this.dataGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown); @@ -448,21 +479,26 @@ private void InitializeComponent() // this.TextName.HeaderText = "Name"; this.TextName.MaxInputLength = 2147483647; + this.TextName.MinimumWidth = 6; this.TextName.Name = "TextName"; this.TextName.ReadOnly = true; + this.TextName.Width = 125; // // TextValue // this.TextValue.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.TextValue.HeaderText = "Text Value"; this.TextValue.MaxInputLength = 2147483647; + this.TextValue.MinimumWidth = 6; this.TextValue.Name = "TextValue"; // // Index // this.Index.HeaderText = "Index"; + this.Index.MinimumWidth = 6; this.Index.Name = "Index"; this.Index.Visible = false; + this.Index.Width = 125; // // SearchPanal // @@ -495,7 +531,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.SearchHide.AutoSize = true; this.SearchHide.Cursor = System.Windows.Forms.Cursors.Hand; - this.SearchHide.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.SearchHide.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold); this.SearchHide.Location = new System.Drawing.Point(664, 6); this.SearchHide.Name = "SearchHide"; this.SearchHide.Size = new System.Drawing.Size(18, 17); @@ -542,6 +578,7 @@ private void InitializeComponent() // // contextMenuStrip1 // + this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.copyToolStripMenuItem, this.pasteToolStripMenuItem}); @@ -611,7 +648,7 @@ private void InitializeComponent() this.Controls.Add(this.menuStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; - this.MinimumSize = new System.Drawing.Size(705, 489); + this.MinimumSize = new System.Drawing.Size(704, 487); this.Name = "FrmMain"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "UE4 localizations Tool"; @@ -624,6 +661,7 @@ private void InitializeComponent() this.SearchPanal.ResumeLayout(false); this.SearchPanal.PerformLayout(); this.contextMenuStrip1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -670,9 +708,6 @@ private void InitializeComponent() private System.Windows.Forms.Label searchcount; private System.Windows.Forms.ToolStripMenuItem noNamesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem withNamesToolStripMenuItem; - private System.Windows.Forms.DataGridViewTextBoxColumn TextName; - private System.Windows.Forms.DataGridViewTextBoxColumn TextValue; - private System.Windows.Forms.DataGridViewTextBoxColumn Index; private System.Windows.Forms.ToolStripMenuItem sortToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem nameToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem valueToolStripMenuItem; @@ -682,8 +717,13 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem descendingToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem donateToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; - private System.Windows.Forms.ToolStripMenuItem Method2; + private System.Windows.Forms.ToolStripMenuItem UseFixedSize; private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.ToolStripMenuItem Method2; + private System.Windows.Forms.ToolStripMenuItem darkModeToolStripMenuItem; + private System.Windows.Forms.DataGridViewTextBoxColumn TextName; + private System.Windows.Forms.DataGridViewTextBoxColumn TextValue; + private System.Windows.Forms.DataGridViewTextBoxColumn Index; } } diff --git a/UE4localizationsTool/Forms/FrmMain.cs b/UE4localizationsTool/Forms/FrmMain.cs index 5a3afc5..9bca061 100644 --- a/UE4localizationsTool/Forms/FrmMain.cs +++ b/UE4localizationsTool/Forms/FrmMain.cs @@ -1,22 +1,22 @@ using AssetParser; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Diagnostics; using System.Drawing; using System.Globalization; using System.IO; using System.Linq; using System.Net; +using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; - +using UE4localizationsTool.Controls; namespace UE4localizationsTool { - public partial class FrmMain : Form + public partial class FrmMain : NForm { struct DataRow { @@ -24,16 +24,14 @@ struct DataRow public string StringValue; } - - Uexp Uexp; - locres locres; + IAsset Asset; String ToolName = Application.ProductName + " v" + Application.ProductVersion; string FilePath = ""; FrmState state; Stack BackupDataUndo; Stack BackupDataRedo; List> ListrefValues; - ReadOnlyCollection> ListBackupValues; + List> ListBackupValues; bool Filter = false; bool SortApply = false; bool ClearTemp = true; @@ -47,6 +45,7 @@ public FrmMain() dataGridView1.RowsRemoved += (x, y) => this.UpdateCounter(); ResetControls(); pictureBox1.Height = menuStrip1.Height; + darkModeToolStripMenuItem.Checked = Properties.Settings.Default.DarkMode; } @@ -56,30 +55,34 @@ private void AddToDataView() if (ListrefValues == null) return; int Index = 0; - + List rows = new List(); foreach (var item in ListrefValues) { - dataGridView1.Rows.Add(item[0], item[1], Index); - //dataGridView1.Rows[Index].Cells[1].Style.WrapMode = DataGridViewTriState.True; - //dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + var newRow = new DataGridViewRow(); + newRow.CreateCells(dataGridView1); + newRow.Cells[0].Value = item[0]; + newRow.Cells[1].Value = item[1]; + newRow.Cells[2].Value = Index; - if (item.Count >2) + if (item.Count > 2) { - dataGridView1.Rows[Index].Cells[1].ToolTipText = item[2]; - - if (item.Count>3) + newRow.Cells[1].ToolTipText = item[2]; + if (item.Count > 3) { - dataGridView1.Rows[Index].Cells[0].Style.BackColor = System.Drawing.ColorTranslator.FromHtml(item[3]); + newRow.Cells[0].Style.BackColor = System.Drawing.ColorTranslator.FromHtml(item[3]); } if (item.Count > 4) { - dataGridView1.Rows[Index].Cells[0].Style.ForeColor = System.Drawing.ColorTranslator.FromHtml(item[4]); + newRow.Cells[0].Style.ForeColor = System.Drawing.ColorTranslator.FromHtml(item[4]); } } - + rows.Add(newRow); Index++; } + + dataGridView1.Rows.AddRange(rows.ToArray()); + dataGridView1.AutoResizeRows(); } private void OpenFile_Click(object sender, EventArgs e) @@ -97,12 +100,11 @@ private void OpenFile_Click(object sender, EventArgs e) } - - - private async void LoadFile(string filePath) + public async void LoadFile(string filePath) { ResetControls(); ControlsMode(false); + try { state = new FrmState(this, "loading File", "loading File please wait..."); @@ -111,24 +113,19 @@ private async void LoadFile(string filePath) if (filePath.ToLower().EndsWith(".locres")) { - locres = await Task.Run(() => new locres(filePath)); - ListrefValues = locres.Strings; - ListBackupValues = ListrefValues.AsReadOnly(); - AddToDataView(); + Asset = await Task.Run(() => new locres(filePath)); + CreateBackupList(); } - else if (filePath.ToLower().EndsWith(".uasset")|| filePath.ToLower().EndsWith(".umap")) + else if (filePath.ToLower().EndsWith(".uasset") || filePath.ToLower().EndsWith(".umap")) { Uasset Uasset = await Task.Run(() => new Uasset(filePath)); Uasset.UseMethod2 = Method2.Checked; - Uexp = await Task.Run(() => new Uexp(Uasset)); - ListrefValues = Uexp.Strings; - ListBackupValues = ListrefValues.AsReadOnly(); - AddToDataView(); - if (!Uexp.IsGood) + Asset = await Task.Run(() => new Uexp(Uasset)); + CreateBackupList(); + if (!Asset.IsGood) { StateLabel.Text = "Warning: This file is't fully parsed and may not contain some text."; } - } this.FilePath = filePath; @@ -144,6 +141,14 @@ private async void LoadFile(string filePath) } + private void CreateBackupList() + { + ListBackupValues = new List>(); + ListrefValues = Asset.Strings; + ListrefValues.ForEach(x => ListBackupValues.Add(new List(x))); + AddToDataView(); + } + private void ResetControls() { dataGridView1.Rows.Clear(); @@ -159,9 +164,9 @@ private void ResetControls() ClearTemp = true; FindIndex = 0; OldFind = ""; - searchcount.Text=""; + searchcount.Text = ""; } - + private void ControlsMode(bool Enabled) { saveToolStripMenuItem.Enabled = Enabled; @@ -313,16 +318,7 @@ private async void SaveFile(object sender, EventArgs e) { state = new FrmState(this, "Saving File", "Saving File please wait..."); this.BeginInvoke(new Action(() => state.ShowDialog())); - if (FilePath.ToLower().EndsWith(".locres")) - { - await Task.Run(() => locres.SaveFile(sfd.FileName)); - - } - else if (FilePath.ToLower().EndsWith(".uasset") || FilePath.ToLower().EndsWith(".umap")) - { - - await Task.Run(() => Uexp.SaveFile(sfd.FileName)); - } + await Task.Run(() => Asset.SaveFile(sfd.FileName)); } catch (Exception ex) { @@ -348,7 +344,7 @@ private void search_Click(object sender, EventArgs e) dataGridView1.Height -= SearchPanal.Height; if (dataGridView1.SelectedCells.Count > 0) { - InputSearch.Text=ObjectToString( dataGridView1.SelectedCells[0].Value); + InputSearch.Text = ObjectToString(dataGridView1.SelectedCells[0].Value); } InputSearch.Focus(); InputSearch.SelectAll(); @@ -565,7 +561,14 @@ private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEvent if (dataGridView1.Created) { ListrefValues[int.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString())][1] = ObjectToString(dataGridView1.Rows[e.RowIndex].Cells[1].Value); - dataGridView1.Rows[e.RowIndex].Cells[1].Style.BackColor = System.Drawing.Color.FromArgb(255, 204, 153); + if (ListrefValues[int.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString())][1] != ListBackupValues[int.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString())][1]) + { + dataGridView1.Rows[e.RowIndex].Cells[1].Style.BackColor = System.Drawing.Color.FromArgb(255, 204, 153); + } + else + { + dataGridView1.Rows[e.RowIndex].Cells[1].Style.BackColor = System.Drawing.Color.FromArgb(255, 255, 255); + } this.Text = ToolName + " - " + Path.GetFileName(FilePath) + "*"; if (ClearTemp) { @@ -595,7 +598,7 @@ private void undoToolStripMenuItem_Click(object sender, EventArgs e) } dataGridView1.ClearSelection(); dataGridView1.Rows[dataRow.Index].Selected = true; - if (BackupDataUndo.Count==0) + if (BackupDataUndo.Count == 0) { this.Text = ToolName + " - " + Path.GetFileName(FilePath); } @@ -611,13 +614,13 @@ private void redoToolStripMenuItem_Click(object sender, EventArgs e) //MessageBox.Show(BackupDataRedo.Peek().StringValue); DataRow dataRow = BackupDataRedo.Pop(); - + BackupDataUndo.Push(new DataRow() { Index = dataRow.Index, StringValue = ObjectToString(dataGridView1.Rows[dataRow.Index].Cells[1].Value) }); ClearTemp = false; dataGridView1.Rows[dataRow.Index].Cells[1].Value = dataRow.StringValue; ClearTemp = true; dataGridView1.Rows[dataRow.Index].Cells[1].Style.BackColor = System.Drawing.Color.FromArgb(255, 204, 153); - + dataGridView1.ClearSelection(); dataGridView1.Rows[dataRow.Index].Selected = true; @@ -760,6 +763,7 @@ private void clearFilterToolStripMenuItem_Click(object sender, EventArgs e) private void UpdateCounter() { DataCount.Text = "Text count: " + dataGridView1.Rows.Count; + DataCount_TextChanged(null, null); } private void label2_Click(object sender, EventArgs e) @@ -776,57 +780,60 @@ private string ObjectToString(object Value) return ""; } - private async void FrmMain_Load(object sender, EventArgs e) + private void FrmMain_Load(object sender, EventArgs e) { + this.Invoke(new Action(() => + { + float ToolVer = 0; + string ToolSite = ""; - float ToolVer = 0; - string ToolSite = ""; + using (WebClient client = new WebClient()) + { + try + { + string UpdateScript = client.DownloadString("https://raw.githubusercontent.com/amrshaheen61/UE4LocalizationsTool/master/UE4localizationsTool/UpdateInfo.txt"); - using (WebClient client = new WebClient()) - { - try - { - string UpdateScript = await Task.Run(()=> client.DownloadString("https://raw.githubusercontent.com/amrshaheen61/UE4LocalizationsTool/master/UE4localizationsTool/UpdateInfo.txt")); - - if (UpdateScript.StartsWith("UpdateFile", false, CultureInfo.InvariantCulture)) - { - var lines = Regex.Split(UpdateScript, "\r\n|\r|\n"); - foreach (string Line in lines) - { + if (UpdateScript.StartsWith("UpdateFile", false, CultureInfo.InvariantCulture)) + { + var lines = Regex.Split(UpdateScript, "\r\n|\r|\n"); + foreach (string Line in lines) + { - if (Line.StartsWith("Tool_UpdateVer", false, CultureInfo.InvariantCulture)) - { - ToolVer = float.Parse(Line.Split(new char[] { '=' }, 2)[1].Trim()); - } - if (Line.StartsWith("Tool_UpdateSite", false, CultureInfo.InvariantCulture)) - { - ToolSite = Line.Split(new char[] { '=' }, 2)[1].Trim(); - } - } + if (Line.StartsWith("Tool_UpdateVer", false, CultureInfo.InvariantCulture)) + { + ToolVer = float.Parse(Line.Split(new char[] { '=' }, 2)[1].Trim()); + } + if (Line.StartsWith("Tool_UpdateSite", false, CultureInfo.InvariantCulture)) + { + ToolSite = Line.Split(new char[] { '=' }, 2)[1].Trim(); + } + } - if (ToolVer > float.Parse(Application.ProductVersion)) - { + if (ToolVer > float.Parse(Application.ProductVersion)) + { - DialogResult message = MessageBox.Show("There is an update available\nDo you want to download it?", "Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + DialogResult message = MessageBox.Show("There is an update available\nDo you want to download it?", "Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Question); - if (message == DialogResult.Yes) - { - Process.Start(new ProcessStartInfo { FileName = ToolSite, UseShellExecute = true }); - Application.Exit(); - } + if (message == DialogResult.Yes) + { + Process.Start(new ProcessStartInfo { FileName = ToolSite, UseShellExecute = true }); + Application.Exit(); + } - } - } + } + } - } - catch - { - //n - } + } + catch + { + //n + } + } + }) + ); - } } private void noNamesToolStripMenuItem_Click(object sender, EventArgs e) @@ -894,8 +901,10 @@ private void FrmMain_DragEnter(object sender, DragEventArgs e) private void FrmMain_DragDrop(object sender, DragEventArgs e) { string[] array = (string[])e.Data.GetData(DataFormats.FileDrop); - LoadFile(array[0]); - + if (array[0].Length >= 1 && (array[0].EndsWith(".uasset") || array[0].EndsWith(".umap") || array[0].EndsWith(".locres"))) + { + LoadFile(array[0]); + } } private void DataCount_TextChanged(object sender, EventArgs e) @@ -910,10 +919,10 @@ private void donateToolStripMenuItem_Click(object sender, EventArgs e) private void Method2_CheckedChanged(object sender, EventArgs e) { - + if (Method2.Checked) { - pictureBox1.Visible=true; + pictureBox1.Visible = true; fileToolStripMenuItem.Margin = new Padding(5, 0, 0, 0); } else @@ -921,8 +930,63 @@ private void Method2_CheckedChanged(object sender, EventArgs e) pictureBox1.Visible = false; fileToolStripMenuItem.Margin = new Padding(0, 0, 0, 0); } - - + + + } + + private void dataGridView1_CellValidated(object sender, DataGridViewCellEventArgs e) + { + + } + + private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) + { + + if (e.ColumnIndex != 1) + { + + return; + } + + DataGridView dataGridView = sender as DataGridView; + if (!UseFixedSize.Checked) + { + dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].ErrorText = null; + return; + } + + Encoding encoding = Encoding.ASCII; + if (!AssetHelper.IsASCII(ListBackupValues[int.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString())][1])) + { + encoding = Encoding.Unicode; + } + Encoding encoding1 = Encoding.ASCII; + if (!AssetHelper.IsASCII(e.FormattedValue.ToString())) + { + encoding1 = Encoding.Unicode; + } + + + if (encoding.GetBytes(ListBackupValues[int.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString())][1]).Length < encoding1.GetBytes(e.FormattedValue.ToString()).Length) + { + dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].ErrorText = "The value is too long"; + } + else + { + dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].ErrorText = null; + } + } + + private void darkModeToolStripMenuItem_CheckedChanged(object sender, EventArgs e) + { + bool IsDark = Properties.Settings.Default.DarkMode; + Properties.Settings.Default.DarkMode = darkModeToolStripMenuItem.Checked; + Properties.Settings.Default.Save(); + + if (IsDark != darkModeToolStripMenuItem.Checked) + Application.Restart(); + } + } } diff --git a/UE4localizationsTool/Forms/FrmState.Designer.cs b/UE4localizationsTool/Forms/FrmState.Designer.cs index 9672e6b..fbe68af 100644 --- a/UE4localizationsTool/Forms/FrmState.Designer.cs +++ b/UE4localizationsTool/Forms/FrmState.Designer.cs @@ -69,7 +69,7 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.ClientSize = new System.Drawing.Size(196, 72); + this.ClientSize = new System.Drawing.Size(185, 61); this.ControlBox = false; this.Controls.Add(this.label2); this.Controls.Add(this.label1); diff --git a/UE4localizationsTool/Forms/FrmState.cs b/UE4localizationsTool/Forms/FrmState.cs index 2c97fe2..1e0a861 100644 --- a/UE4localizationsTool/Forms/FrmState.cs +++ b/UE4localizationsTool/Forms/FrmState.cs @@ -1,10 +1,11 @@ using System; using System.Drawing; using System.Windows.Forms; +using UE4localizationsTool.Controls; namespace UE4localizationsTool { - public partial class FrmState : Form + public partial class FrmState : NForm { DateTime dateTime; @@ -30,7 +31,7 @@ public FrmState(string Title, string state) label1.Text = state; this.Text = Title; timer1.Start(); - timer1_Tick(null,null); + timer1_Tick(null, null); } diff --git a/UE4localizationsTool/Helper/MemoryList.cs b/UE4localizationsTool/Helper/MemoryList.cs index a67ed84..4fdbf49 100644 --- a/UE4localizationsTool/Helper/MemoryList.cs +++ b/UE4localizationsTool/Helper/MemoryList.cs @@ -91,11 +91,6 @@ public MemoryList() public MemoryList(string FilePath) { - if (!File.Exists(FilePath)) - { - throw new Exception("File not found"); - } - if (new FileInfo(FilePath).Length > int.MaxValue) { throw new Exception("Can't read this file: " + FilePath); @@ -359,7 +354,7 @@ public byte GetByteValue(bool SavePosition = true, int SeekAndRead = -1) { byte value = MemoryListData[MemoryListPosition]; MemoryListPosition++; - return (byte)value; + return value; } return MemoryListData[MemoryListPosition]; @@ -750,7 +745,7 @@ public int GetIntValue(bool SavePosition = true, int SeekAndRead = -1, Endian _E { Array.Reverse(array); } - return (int)(array[0] | (array[1] << 8) | (array[2] << 16) | (array[3] << 24)); + return array[0] | (array[1] << 8) | (array[2] << 16) | (array[3] << 24); } public uint GetUIntValue(bool SavePosition = true, int SeekAndRead = -1, Endian _Endian = Endian.Little) @@ -990,7 +985,7 @@ public long GetInt64Value(bool SavePosition = true, int SeekAndRead = -1, Endian { Array.Reverse(array); } - return BitConverter.ToInt64(array,0); + return BitConverter.ToInt64(array, 0); } public ulong GetUInt64Value(bool SavePosition = true, int SeekAndRead = -1, Endian _Endian = Endian.Little) @@ -1383,7 +1378,7 @@ public int GetStringLenghtN(string String, Encoding encoding = null) public T GetStructureValues(bool SavePosition = true, int SeekAndRead = -1) { var structureSize = Marshal.SizeOf(typeof(T)); - var buffer = GetBytes((int)structureSize, SavePosition, SeekAndRead); + var buffer = GetBytes(structureSize, SavePosition, SeekAndRead); if (buffer.Length != structureSize) { diff --git a/UE4localizationsTool/Program.cs b/UE4localizationsTool/Program.cs index fdfa44d..34bdc2b 100644 --- a/UE4localizationsTool/Program.cs +++ b/UE4localizationsTool/Program.cs @@ -94,8 +94,21 @@ static void Main(string[] args) if (args.Length > 0) { + if (args.Length == 1 && (args[0].EndsWith(".uasset") || args[0].EndsWith(".umap") || args[0].EndsWith(".locres"))) + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + var FrmMain = new FrmMain(); + FrmMain.Show(); + FrmMain.LoadFile(args[0]); + Application.Run(FrmMain); + return; + } + + AttachConsole(ATTACH_PARENT_PROCESS); - // Console.SetCursorPosition(0, Console.CursorTop + 1); + Console.WriteLine(""); + // Console.SetCursorPosition(0, Console.CursorTop + 1); if (args.Length < 2) { @@ -115,18 +128,12 @@ static void Main(string[] args) } CheckArges(3, args); - new Commands(args[0], args[1] + "*" + args[2]) - { - Flags = GetArgs(3, args) - }; + new Commands(args[0], args[1] + "*" + args[2], GetArgs(3, args)); } else { CheckArges(2, args); - new Commands(args[0], args[1]) - { - Flags = GetArgs(3, args) - }; + new Commands(args[0], args[1], GetArgs(2, args)); } } diff --git a/UE4localizationsTool/Properties/AssemblyInfo.cs b/UE4localizationsTool/Properties/AssemblyInfo.cs index 6c890d2..02299f1 100644 --- a/UE4localizationsTool/Properties/AssemblyInfo.cs +++ b/UE4localizationsTool/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ using System.Reflection; +using System.Resources; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -32,4 +33,5 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0")] -[assembly: AssemblyFileVersion("2.0")] +[assembly: AssemblyFileVersion("2.1")] +[assembly: NeutralResourcesLanguage("ar")] diff --git a/UE4localizationsTool/Properties/Resources.Designer.cs b/UE4localizationsTool/Properties/Resources.Designer.cs index cbbc29f..4a8150b 100644 --- a/UE4localizationsTool/Properties/Resources.Designer.cs +++ b/UE4localizationsTool/Properties/Resources.Designer.cs @@ -28,7 +28,7 @@ internal class Resources { private static global::System.Globalization.CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { } diff --git a/UE4localizationsTool/Properties/Settings.Designer.cs b/UE4localizationsTool/Properties/Settings.Designer.cs index 59e5355..9b6d9cb 100644 --- a/UE4localizationsTool/Properties/Settings.Designer.cs +++ b/UE4localizationsTool/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace UE4localizationsTool.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -22,5 +22,17 @@ public static Settings Default { return defaultInstance; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool DarkMode { + get { + return ((bool)(this["DarkMode"])); + } + set { + this["DarkMode"] = value; + } + } } } diff --git a/UE4localizationsTool/Properties/Settings.settings b/UE4localizationsTool/Properties/Settings.settings index 3964565..02261b4 100644 --- a/UE4localizationsTool/Properties/Settings.settings +++ b/UE4localizationsTool/Properties/Settings.settings @@ -1,7 +1,9 @@  - - - - - - + + + + + False + + + \ No newline at end of file diff --git a/UE4localizationsTool/Properties/app.manifest b/UE4localizationsTool/Properties/app.manifest new file mode 100644 index 0000000..ef6918c --- /dev/null +++ b/UE4localizationsTool/Properties/app.manifest @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UE4localizationsTool/Settings.cs b/UE4localizationsTool/Settings.cs new file mode 100644 index 0000000..490ec8f --- /dev/null +++ b/UE4localizationsTool/Settings.cs @@ -0,0 +1,33 @@ +namespace UE4localizationsTool.Properties +{ + + + // This class allows you to handle specific events on the settings class: + // The SettingChanging event is raised before a setting's value is changed. + // The PropertyChanged event is raised after a setting's value is changed. + // The SettingsLoaded event is raised after the setting values are loaded. + // The SettingsSaving event is raised before the setting values are saved. + internal sealed partial class Settings + { + + public Settings() + { + // // To add event handlers for saving and changing settings, uncomment the lines below: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) + { + // Add code to handle the SettingChangingEvent event here. + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) + { + // Add code to handle the SettingsSaving event here. + } + } +} diff --git a/UE4localizationsTool/UE4localizationsTool.csproj b/UE4localizationsTool/UE4localizationsTool.csproj index 5199b6b..b66cfdb 100644 --- a/UE4localizationsTool/UE4localizationsTool.csproj +++ b/UE4localizationsTool/UE4localizationsTool.csproj @@ -39,7 +39,7 @@ DEBUG;TRACE prompt 4 - true + false false AllRules.ruleset true @@ -70,11 +70,15 @@ true - true + false + + + LocalIntranet + - true + Properties\app.manifest @@ -91,15 +95,20 @@ + + Form + + + @@ -134,6 +143,7 @@ + FrmAbout.cs @@ -157,6 +167,7 @@ Resources.resx True + SettingsSingleFileGenerator Settings.Designer.cs @@ -166,7 +177,6 @@ Settings.settings True - diff --git a/UE4localizationsTool/UpdateInfo.txt b/UE4localizationsTool/UpdateInfo.txt index 259f389..34800c7 100644 --- a/UE4localizationsTool/UpdateInfo.txt +++ b/UE4localizationsTool/UpdateInfo.txt @@ -1,3 +1,3 @@ UpdateFile -Tool_UpdateVer = 2.0 -Tool_UpdateSite = https://github.com/amrshaheen61/UE4LocalizationsTool/releases/tag/v2.0 \ No newline at end of file +Tool_UpdateVer = 2.1 +Tool_UpdateSite = https://github.com/amrshaheen61/UE4LocalizationsTool/releases/tag/v2.1 \ No newline at end of file