Skip to content

Personal/jack/2022 improvements #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Assets/UXF/Scripts/DataHandling/FileSaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.IO;
using System.Threading;
using System.Linq;

using System.Globalization;

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

/// <summary>
/// Enable to force the data to save with an english-US format (i.e. `,` to serapate values,
/// and `.` to separate decimal points).
/// </summary>
[Tooltip("Enable to force the data to save with an english-US format (i.e. `,` to serapate values, and `.` to separate decimal points).")]
public bool forceENUSLocale = true;

/// <summary>
/// Enable to print debug messages to the console.
/// </summary>
Expand All @@ -45,12 +52,21 @@ public class FileSaver : LocalFileDataHander
/// </summary>
public override void SetUp()
{
if (forceENUSLocale)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
}

quitting = false;
Directory.CreateDirectory(base.StoragePath);

if (!IsActive)
{
parallelThread = new Thread(Worker);
if (forceENUSLocale)
{
parallelThread.CurrentCulture = new CultureInfo("en-US");
}
parallelThread.Start();
}
else
Expand Down Expand Up @@ -150,7 +166,7 @@ public override string HandleDataTable(UXFDataTable table, string experiment, st
if (verboseDebug) Utilities.UXFDebugLogFormat("Queuing save of file: {0}", savePath);

ManageInWorker(() => { File.WriteAllLines(savePath, lines); });
return GetRelativePath(StoragePath, savePath);;
return GetRelativePath(StoragePath, savePath);
}

public override string HandleJSONSerializableObject(List<object> serializableObject, string experiment, string ppid, int sessionNum, string dataName, UXFDataType dataType, int optionalTrialNum = 0)
Expand Down
4 changes: 2 additions & 2 deletions Assets/UXF/Scripts/Etc/Editor/EasyEventEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ MethodInfo InvokeFindMethod(string functionName, object targetObject, UnityEvent
findMethod = eventObject.GetType().GetMethod("FindMethod", BindingFlags.NonPublic | BindingFlags.Instance, null,
new System.Type[] {
typeof(string),
#if UNITY_2021_1_OR_NEWER
#if UNITY_2020_1_OR_NEWER
typeof(System.Type),
#else
typeof(object),
Expand All @@ -947,7 +947,7 @@ MethodInfo InvokeFindMethod(string functionName, object targetObject, UnityEvent
return null;
}

#if UNITY_2021_1_OR_NEWER
#if UNITY_2020_1_OR_NEWER
return findMethod.Invoke(eventObject, new object[] {functionName, targetObject?.GetType(), listenerMode, argType }) as MethodInfo;
#else
return findMethod.Invoke(eventObject, new object[] {functionName, targetObject, listenerMode, argType }) as MethodInfo;
Expand Down
1 change: 1 addition & 0 deletions Assets/UXF/Tests/Editor/TestLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Tuple<Session, FileSaver> CreateSession(string ppidExtra)
sessionLogger.Initialise();

fileSaver.verboseDebug = false;
fileSaver.forceENUSLocale = false;

string experimentName = "unit_test";
string ppid = "test_locale_" + ppidExtra;
Expand Down
2 changes: 1 addition & 1 deletion Assets/UXF/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.5
2.3.6