summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Decompile/I2.Loc/RTLFixer.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-05-19 16:05:58 +0800
committerchai <215380520@qq.com>2024-05-19 16:05:58 +0800
commit8e13e7e2874adc8982e16d1d2ed2e28d7480b45f (patch)
tree63ef85c460288891f5a593d69afeca16cba050b3 /Thronefall_1_57/Decompile/I2.Loc/RTLFixer.cs
parentc5f145786f4c6d2fe4bea831dfc16e52228920a5 (diff)
+1.57
Diffstat (limited to 'Thronefall_1_57/Decompile/I2.Loc/RTLFixer.cs')
-rw-r--r--Thronefall_1_57/Decompile/I2.Loc/RTLFixer.cs79
1 files changed, 79 insertions, 0 deletions
diff --git a/Thronefall_1_57/Decompile/I2.Loc/RTLFixer.cs b/Thronefall_1_57/Decompile/I2.Loc/RTLFixer.cs
new file mode 100644
index 0000000..56ccb8b
--- /dev/null
+++ b/Thronefall_1_57/Decompile/I2.Loc/RTLFixer.cs
@@ -0,0 +1,79 @@
+using System;
+
+namespace I2.Loc;
+
+public class RTLFixer
+{
+ public static string Fix(string str)
+ {
+ return Fix(str, showTashkeel: false, useHinduNumbers: true);
+ }
+
+ public static string Fix(string str, bool rtl)
+ {
+ if (rtl)
+ {
+ return Fix(str);
+ }
+ string[] array = str.Split(' ');
+ string text = "";
+ string text2 = "";
+ string[] array2 = array;
+ foreach (string text3 in array2)
+ {
+ if (char.IsLower(text3.ToLower()[text3.Length / 2]))
+ {
+ text = text + Fix(text2) + text3 + " ";
+ text2 = "";
+ }
+ else
+ {
+ text2 = text2 + text3 + " ";
+ }
+ }
+ if (text2 != "")
+ {
+ text += Fix(text2);
+ }
+ return text;
+ }
+
+ public static string Fix(string str, bool showTashkeel, bool useHinduNumbers)
+ {
+ string text = HindiFixer.Fix(str);
+ if (text != str)
+ {
+ return text;
+ }
+ RTLFixerTool.showTashkeel = showTashkeel;
+ RTLFixerTool.useHinduNumbers = useHinduNumbers;
+ if (str.Contains("\n"))
+ {
+ str = str.Replace("\n", Environment.NewLine);
+ }
+ if (str.Contains(Environment.NewLine))
+ {
+ string[] separator = new string[1] { Environment.NewLine };
+ string[] array = str.Split(separator, StringSplitOptions.None);
+ if (array.Length == 0)
+ {
+ return RTLFixerTool.FixLine(str);
+ }
+ if (array.Length == 1)
+ {
+ return RTLFixerTool.FixLine(str);
+ }
+ string text2 = RTLFixerTool.FixLine(array[0]);
+ int i = 1;
+ if (array.Length > 1)
+ {
+ for (; i < array.Length; i++)
+ {
+ text2 = text2 + Environment.NewLine + RTLFixerTool.FixLine(array[i]);
+ }
+ }
+ return text2;
+ }
+ return RTLFixerTool.FixLine(str);
+ }
+}