Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit d919497

Browse files
committed
Config: use en-us culture, fix recursive exception
1 parent 0c40b4f commit d919497

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/Core/Config/ExplorerConfig.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using IniParser;
55
using IniParser.Parser;
66
using UnityExplorer.UI;
7+
using System.Globalization;
78

89
namespace UnityExplorer.Core.Config
910
{
@@ -14,6 +15,8 @@ public class ExplorerConfig
1415
internal static readonly IniDataParser _parser = new IniDataParser();
1516
internal static readonly string INI_PATH = Path.Combine(ExplorerCore.Loader.ConfigFolder, "config.ini");
1617

18+
internal static CultureInfo _enCulture = new CultureInfo("en-US");
19+
1720
static ExplorerConfig()
1821
{
1922
_parser.Configuration.CommentString = "#";
@@ -30,7 +33,7 @@ static ExplorerConfig()
3033
public bool Hide_On_Startup = false;
3134
public string Window_Anchors = DEFAULT_WINDOW_ANCHORS;
3235

33-
private const string DEFAULT_WINDOW_ANCHORS = "0.25,0.1,0.78,0.95";
36+
private const string DEFAULT_WINDOW_ANCHORS = "0.25,0.10,0.78,0.95";
3437

3538
public static event Action OnConfigChanged;
3639

@@ -123,17 +126,22 @@ internal Vector4 GetWindowAnchorsVector()
123126
try
124127
{
125128
var split = Window_Anchors.Split(',');
129+
130+
if (split.Length != 4)
131+
throw new Exception();
132+
126133
Vector4 ret = Vector4.zero;
127-
ret.x = float.Parse(split[0]);
128-
ret.y = float.Parse(split[1]);
129-
ret.z = float.Parse(split[2]);
130-
ret.w = float.Parse(split[3]);
134+
ret.x = float.Parse(split[0], _enCulture);
135+
ret.y = float.Parse(split[1], _enCulture);
136+
ret.z = float.Parse(split[2], _enCulture);
137+
ret.w = float.Parse(split[3], _enCulture);
138+
131139
return ret;
132140
}
133141
catch
134142
{
135143
Window_Anchors = DEFAULT_WINDOW_ANCHORS;
136-
return GetWindowAnchorsVector();
144+
return new Vector4(0.25f, 0.1f, 0.78f, 0.95f);
137145
}
138146
}
139147

@@ -142,7 +150,13 @@ internal static string GetWindowAnchorsString()
142150
try
143151
{
144152
var rect = PanelDragger.Instance.Panel;
145-
return $"{rect.anchorMin.x},{rect.anchorMin.y},{rect.anchorMax.x},{rect.anchorMax.y}";
153+
return string.Format(_enCulture, "{0},{1},{2},{3}", new object[]
154+
{
155+
rect.anchorMin.x,
156+
rect.anchorMax.y,
157+
rect.anchorMax.x,
158+
rect.anchorMax.y
159+
});
146160
}
147161
catch
148162
{

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace UnityExplorer
1717
public class ExplorerCore
1818
{
1919
public const string NAME = "UnityExplorer";
20-
public const string VERSION = "3.2.5";
20+
public const string VERSION = "3.2.6";
2121
public const string AUTHOR = "Sinai";
2222
public const string GUID = "com.sinai.unityexplorer";
2323

0 commit comments

Comments
 (0)