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

Commit

Permalink
Changes for v1.6 (bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrshaheen61 committed Jun 14, 2022
1 parent 52a9c3a commit 21e4395
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 33 deletions.
23 changes: 15 additions & 8 deletions UE4localizationsTool/Core/AssetHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public static void DeleteStringUE(this MemoryList memoryList)
public static void ReplaceStringUE(this MemoryList memoryList, string StringValue)
{

// memoryList.DeleteStringUE();

StringValue = StringValue.Replace("<cf>", "\r\n");
StringValue = StringValue.Replace("<cr>", "\r");
Expand All @@ -99,12 +98,20 @@ public static void ReplaceStringUE(this MemoryList memoryList, string StringValu
string TempString = memoryList.GetStringUE();
if (StringValue == TempString)
{
return;
return;
}

memoryList.Seek(ThisPosition);
memoryList.DeleteStringUE();


if (string.IsNullOrEmpty(StringValue))
{
memoryList.InsertIntValue(0);
return;
}


StringValue += '\0';

Encoding encoding = Encoding.Unicode;
Expand All @@ -113,17 +120,17 @@ public static void ReplaceStringUE(this MemoryList memoryList, string StringValu
encoding = Encoding.ASCII;
}

byte[] TextBytes= encoding.GetBytes(StringValue);

if (encoding == Encoding.ASCII)
{

memoryList.InsertIntValue(StringValue.Length);
memoryList.InsertStringValue(StringValue, true, -1, encoding);
memoryList.InsertIntValue(TextBytes.Length);
memoryList.InsertBytes(TextBytes);
}
else
{

memoryList.InsertIntValue(memoryList.GetStringLenght(StringValue, encoding) / -2);
memoryList.InsertStringValue(StringValue, true, -1, encoding);
memoryList.InsertIntValue(TextBytes.Length/-2);
memoryList.InsertBytes(TextBytes);
}
}

Expand Down
43 changes: 23 additions & 20 deletions UE4localizationsTool/Core/StructProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true,
catch
{
uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}

ConsoleMode.Print("EndMapProperty", ConsoleColor.Blue);
Expand Down Expand Up @@ -155,6 +156,7 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true,
catch
{
uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}
if (Modify)
{
Expand Down Expand Up @@ -271,6 +273,7 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true,
catch
{
uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}
}

Expand Down Expand Up @@ -314,6 +317,7 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true,
int TextDataPosition = memoryList.GetPosition();
if (ContainText == 0xff)
{

try
{
TextData = new MemoryList(memoryList.GetBytes(PropertyLength - 5));
Expand All @@ -326,7 +330,7 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true,
{
if (!Modify)
{
uexp.Strings.Add(new List<string>() { PropertyName, TextData.GetStringUE() });
uexp.Strings.Add(new List<string>() { PropertyName+"_"+i, TextData.GetStringUE() });

}
else
Expand All @@ -341,7 +345,8 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true,
}
catch
{

uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}
continue;
}
Expand Down Expand Up @@ -369,7 +374,8 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true,
}
catch
{

uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}
}
else if (Property == "ByteProperty")
Expand Down Expand Up @@ -437,7 +443,8 @@ public StructProperty(MemoryList memoryList, Uexp uexp, bool FromStruct = true,
}
catch
{

uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}
}

Expand Down Expand Up @@ -579,6 +586,7 @@ private void PropertyParser(string PropertyName, string Property, int PropertyLe
catch
{
uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}
ConsoleMode.Print("EndMap", ConsoleColor.DarkBlue);
}
Expand Down Expand Up @@ -645,7 +653,11 @@ private void PropertyParser(string PropertyName, string Property, int PropertyLe
PropertyParser(PropertyName, StructType, -1, StructData, uexp, Modify);
}
}
catch { uexp.IsGood = false; }
catch
{
uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}

if (Modify)
{
Expand Down Expand Up @@ -682,28 +694,17 @@ private void PropertyParser(string PropertyName, string Property, int PropertyLe
byte ContainText = memoryList.GetByteValue();
if (ContainText == 0xff)
{
int TextLinesCount = memoryList.GetIntValue();
for (int i = 0; i < TextLinesCount; i++)
{
if (!Modify)
{
uexp.Strings.Add(new List<string>() { PropertyName, memoryList.GetStringUE() });

}
else
{
memoryList.ReplaceStringUE(uexp.Strings[uexp.CurrentIndex][1]);
uexp.CurrentIndex++;
}
}
return;
return;
}

if (!Modify)
{
uexp.Strings.Add(new List<string>() { PropertyName + "_1", memoryList.GetStringUE() });
uexp.Strings.Add(new List<string>() { PropertyName + "_2", memoryList.GetStringUE() });
uexp.Strings.Add(new List<string>() { PropertyName + "_3", memoryList.GetStringUE() });
ConsoleMode.Print(uexp.Strings[uexp.Strings.Count - 3][1], ConsoleColor.Magenta);
ConsoleMode.Print(uexp.Strings[uexp.Strings.Count - 2][1], ConsoleColor.Magenta);
ConsoleMode.Print(uexp.Strings[uexp.Strings.Count - 1][1], ConsoleColor.Magenta);
}
else
{
Expand Down Expand Up @@ -757,6 +758,7 @@ private void PropertyParser(string PropertyName, string Property, int PropertyLe
catch
{
uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}
}
}
Expand All @@ -776,6 +778,7 @@ private void PropertyParser(string PropertyName, string Property, int PropertyLe
catch
{
uexp.IsGood = false;
ConsoleMode.Print("Bug here.", ConsoleColor.Red);
}
memoryList.Skip(4); //ImplementationPtr Index
ConsoleMode.Print("EndMovieSceneEvalTemplatePtr", ConsoleColor.Yellow);
Expand Down
3 changes: 3 additions & 0 deletions UE4localizationsTool/Core/Uexp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ private void ReadOrEdit(bool Modify = false)

_ = new Spreadsheet(memoryList, this, Modify);
break;
case "Function":
// _ = new Function(memoryList, this, Modify);
break;
}
}
catch
Expand Down
2 changes: 1 addition & 1 deletion UE4localizationsTool/Forms/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ private void FrmMain_Load(object sender, EventArgs e)
{
try
{
string UpdateScript = client.DownloadString("https://raw.githubusercontent.com/amrshaheen61/UE4LocalizationsTool/blob/master/UE4localizationsTool/UpdateInfo.txt");
string UpdateScript = client.DownloadString("https://raw.githubusercontent.com/amrshaheen61/UE4LocalizationsTool/master/UE4localizationsTool/UpdateInfo.txt");

if (UpdateScript.StartsWith("UpdateFile", false, CultureInfo.InvariantCulture))
{
Expand Down
2 changes: 1 addition & 1 deletion UE4localizationsTool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0")]
[assembly: AssemblyFileVersion("1.5")]
[assembly: AssemblyFileVersion("1.6")]
2 changes: 1 addition & 1 deletion UE4localizationsTool/UE4localizationsTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>5</ApplicationRevision>
<ApplicationRevision>7</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
Expand Down
4 changes: 2 additions & 2 deletions UE4localizationsTool/UpdateInfo.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
UpdateFile
Tool_UpdateVer = 1.5
Tool_UpdateSite = https://github.com/amrshaheen61/UE4LocalizationsTool/releases/tag/v1.5
Tool_UpdateVer = 1.6
Tool_UpdateSite = https://github.com/amrshaheen61/UE4LocalizationsTool/releases/tag/v1.6

0 comments on commit 21e4395

Please sign in to comment.