Skip to content

Commit e174479

Browse files
authored
Merge pull request #104 from immersivecognition/personal/jack/2022-improvements
Personal/jack/2022 improvements
2 parents 373982d + 5a0054e commit e174479

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

Assets/UXF/Scripts/DataHandling/FileSaver.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using System.IO;
77
using System.Threading;
88
using System.Linq;
9-
9+
using System.Globalization;
1010

1111
namespace UXF
1212
{
@@ -19,6 +19,13 @@ public class FileSaver : LocalFileDataHander
1919
[Tooltip("Enable to sort session files into folders. The trial_results CSV is never put into a folder.")]
2020
public bool sortDataIntoFolders = true;
2121

22+
/// <summary>
23+
/// Enable to force the data to save with an english-US format (i.e. `,` to serapate values,
24+
/// and `.` to separate decimal points).
25+
/// </summary>
26+
[Tooltip("Enable to force the data to save with an english-US format (i.e. `,` to serapate values, and `.` to separate decimal points).")]
27+
public bool forceENUSLocale = true;
28+
2229
/// <summary>
2330
/// Enable to print debug messages to the console.
2431
/// </summary>
@@ -45,12 +52,21 @@ public class FileSaver : LocalFileDataHander
4552
/// </summary>
4653
public override void SetUp()
4754
{
55+
if (forceENUSLocale)
56+
{
57+
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
58+
}
59+
4860
quitting = false;
4961
Directory.CreateDirectory(base.StoragePath);
5062

5163
if (!IsActive)
5264
{
5365
parallelThread = new Thread(Worker);
66+
if (forceENUSLocale)
67+
{
68+
parallelThread.CurrentCulture = new CultureInfo("en-US");
69+
}
5470
parallelThread.Start();
5571
}
5672
else
@@ -150,7 +166,7 @@ public override string HandleDataTable(UXFDataTable table, string experiment, st
150166
if (verboseDebug) Utilities.UXFDebugLogFormat("Queuing save of file: {0}", savePath);
151167

152168
ManageInWorker(() => { File.WriteAllLines(savePath, lines); });
153-
return GetRelativePath(StoragePath, savePath);;
169+
return GetRelativePath(StoragePath, savePath);
154170
}
155171

156172
public override string HandleJSONSerializableObject(List<object> serializableObject, string experiment, string ppid, int sessionNum, string dataName, UXFDataType dataType, int optionalTrialNum = 0)

Assets/UXF/Scripts/Etc/Editor/EasyEventEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ MethodInfo InvokeFindMethod(string functionName, object targetObject, UnityEvent
928928
findMethod = eventObject.GetType().GetMethod("FindMethod", BindingFlags.NonPublic | BindingFlags.Instance, null,
929929
new System.Type[] {
930930
typeof(string),
931-
#if UNITY_2021_1_OR_NEWER
931+
#if UNITY_2020_1_OR_NEWER
932932
typeof(System.Type),
933933
#else
934934
typeof(object),
@@ -947,7 +947,7 @@ MethodInfo InvokeFindMethod(string functionName, object targetObject, UnityEvent
947947
return null;
948948
}
949949

950-
#if UNITY_2021_1_OR_NEWER
950+
#if UNITY_2020_1_OR_NEWER
951951
return findMethod.Invoke(eventObject, new object[] {functionName, targetObject?.GetType(), listenerMode, argType }) as MethodInfo;
952952
#else
953953
return findMethod.Invoke(eventObject, new object[] {functionName, targetObject, listenerMode, argType }) as MethodInfo;

Assets/UXF/Tests/Editor/TestLocale.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Tuple<Session, FileSaver> CreateSession(string ppidExtra)
7070
sessionLogger.Initialise();
7171

7272
fileSaver.verboseDebug = false;
73+
fileSaver.forceENUSLocale = false;
7374

7475
string experimentName = "unit_test";
7576
string ppid = "test_locale_" + ppidExtra;

Assets/UXF/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.5
1+
2.3.6

0 commit comments

Comments
 (0)