4
4
using IniParser ;
5
5
using IniParser . Parser ;
6
6
using UnityExplorer . UI ;
7
+ using System . Globalization ;
7
8
8
9
namespace UnityExplorer . Core . Config
9
10
{
@@ -14,6 +15,8 @@ public class ExplorerConfig
14
15
internal static readonly IniDataParser _parser = new IniDataParser ( ) ;
15
16
internal static readonly string INI_PATH = Path . Combine ( ExplorerCore . Loader . ConfigFolder , "config.ini" ) ;
16
17
18
+ internal static CultureInfo _enCulture = new CultureInfo ( "en-US" ) ;
19
+
17
20
static ExplorerConfig ( )
18
21
{
19
22
_parser . Configuration . CommentString = "#" ;
@@ -30,7 +33,7 @@ static ExplorerConfig()
30
33
public bool Hide_On_Startup = false ;
31
34
public string Window_Anchors = DEFAULT_WINDOW_ANCHORS ;
32
35
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" ;
34
37
35
38
public static event Action OnConfigChanged ;
36
39
@@ -123,17 +126,22 @@ internal Vector4 GetWindowAnchorsVector()
123
126
try
124
127
{
125
128
var split = Window_Anchors . Split ( ',' ) ;
129
+
130
+ if ( split . Length != 4 )
131
+ throw new Exception ( ) ;
132
+
126
133
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
+
131
139
return ret ;
132
140
}
133
141
catch
134
142
{
135
143
Window_Anchors = DEFAULT_WINDOW_ANCHORS ;
136
- return GetWindowAnchorsVector ( ) ;
144
+ return new Vector4 ( 0.25f , 0.1f , 0.78f , 0.95f ) ;
137
145
}
138
146
}
139
147
@@ -142,7 +150,13 @@ internal static string GetWindowAnchorsString()
142
150
try
143
151
{
144
152
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
+ } ) ;
146
160
}
147
161
catch
148
162
{
0 commit comments