-
-
Notifications
You must be signed in to change notification settings - Fork 2
CSV Utility
eisclimber edited this page Apr 20, 2024
·
3 revisions
class in ExPresSXR.Experimentation.DataGathering / Extends MonoBehavior
Utility functions any values for CSV serialization, internally used by the DataGatherer.
-
string JoinAsCsv<T>(IEnumerable<T> values, char sep = DEFAULT_COLUMN_SEPARATOR, bool safe = true)
: Joins the values into a CSV line using the given separator and csv-escaping (all) values if desired. -
string JoinAsCsv<T>(IEnumerable<T> values, IEnumerable<bool> safeIndividual, char sep = DEFAULT_COLUMN_SEPARATOR)
: 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. -
string GetValueSafe<T>(T value, char sep = DEFAULT_COLUMN_SEPARATOR)
: 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. -
bool IsEscaped(string value)
: Returns true if the given string is properly CSV-escaped (starts and ends with a '"'). -
bool NeedsEscaping(string value, char sep = DEFAULT_COLUMN_SEPARATOR)
: Returns true if the given string contains characters that interfere with the csv format. These are: The separator character and the escape character itself. -
string ArrayToString<T>(T[] values, char sep = DEFAULT_ARRAY_SEPARATOR)
: Joins the values into a string representing an array using the given separator. -
string EmptyCSVColumns(int numCols, char sepChar = DEFAULT_COLUMN_SEPARATOR)
: Returns an CSV having 'num' empty columns using 'sepChar' as separator, i.e. 'num'-1 contains 'sepChar's. -
public string GetVideoName(VideoClip video, string streamedVideo = "")
: 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. -
string GetInputActionAsSafeString(InputActionReference actionRef)
: Returns the value of the input actions type as string.
If the input action is unavailable itsexpectedControlType
(surrounded by pointed backet) will be returned, that usually reflects the expected type but can also 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.
-
char COMMA_COLUMN_SEPARATOR = ','
: The comma character. -
char SEMICOLON_COLUMN_SEPARATOR = ';'
: The semicolon character. -
char DEFAULT_COLUMN_SEPARATOR = SEMICOLON_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_ARRAY_SEPARATOR = ','
: The character that is used to separate values in an array. TBe careful as this might cause issues of csv files that use ',' as column separator. -
char DEFAULT_ESCAPE_CHAR = '"'
: The character that is used to escape fields that may contain the separator and would break the format. -
string INPUT_ACTION_ERROR_STRING = "ERROR"
: 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.
Autor: Luca 'eisclimber' Dreiling; License: MIT
- Getting Started
- Development and Contribution
- Misc
- Experimentation
- Data Gatherering
- Eye Tracking
- ExPresS XR Rig
- Interaction
- Base Button
- Button Quiz
- Collision Hand Rumbler
- Collision Sound Emitter
- Exit Game Interactable (Script Deprecated)
- Interactables
- Haptic Impulse Trigger
- Socket Interactors
- Inverse Kinematics
- Localization
- Minigames
- Coin Scale
- Coin Throw
- Sword Cleaning
- Misc
- Movement
- Presentation
- UI