csvutility - eisclimber/ExPresS-XR GitHub Wiki

CsvUtility

Class in ExPresSXR.Experimentation.DataGathering

Inherits from UnityEngine.MonoBehaviour

Summary

Utility functions any values for CSV serialization, internally used by the DataGatherer.

public class CsvUtility : MonoBehaviour

Fields

Name Description
COMMA_COLUMN_SEPARATOR The comma character.
DEFAULT_ARRAY_SEPARATOR The character that is used to separate values in an array.
Be careful as this might cause issues of csv files that use ',' as column separator.
DEFAULT_COLUMN_SEPARATOR The character that is used as default for separating csv columns.
The default is not ',' as it interferes with string representations of vectors and floats.
DEFAULT_ESCAPE_CHAR The character that is used to escape fields that may contain the separator and would break the format.
INPUT_ACTION_ERROR_STRING String used when an Input action is tried to be exported but is invalid.
This happens most likely when the input action is not set up correctly.
SEMICOLON_COLUMN_SEPARATOR The semicolon character.

Methods

Name Description
ArrayToString(T[],char) Joins the values into a string representing an array using the given separator.
EmptyCSVColumns(int,char) Returns an CSV having 'num' empty columns using 'sepChar' as separator, i.e. 'num'-1 contains 'sepChar's.
GetInputActionAsSafeString(InputActionReference) Returns the value of the input actions type as string.
If the input action is unavailable its expectedControlType (surrounded by pointed backet) will be returned,
that usually reflects the expected type but can be null. That can happen outside the editor and if no device is available.
If the action ref is invalid, INPUT_ACTION_ERROR_STRING wil be returned instead.
GetValueSafe(T,char) Converts any arbitrary value to a safe CSV column entry with the provided separator.
This is done by using the DEFAULT_ESCAPE_CHAR to surround the value.
GetVideoName(VideoClip,string) Returns the name of a video with an optional support for videos-paths from the StreamingAssets-Folder.
Video clips override the streamed path. In case video is null the full path of 'streamedVideo' is returned or and empty string if omitted.
IsEscaped(string) Returns true if the given string is properly CSV-escaped (starts and ends with a '"').
JoinAsCsv(IEnumerable,char,bool) Joins the values into a CSV line using the given separator and csv-escaping (all) values if desired.
JoinAsCsv(IEnumerable,IEnumerable,char) Joins the values into a CSV line using the given separator. Allows csv-escaping value individually.
If the lists do not match in lengths, iteration will stop at the shorter one.
NeedsEscaping(string,char) Returns true if the given string contains characters that interfere with the csv format.
These are: The separator character and the escape character itself.
⚠️ **GitHub.com Fallback** ⚠️