Skip to content
jackbrookes edited this page Aug 7, 2018 · 11 revisions

UXF.FileIOManager

Component which manages File I/O in a seperate thread to avoid hitches.


Fields

debug: Enable to print debug messages to the console.

onWriteFile: Event(s) to trigger when we write a file. Not performed in amin thread so cannot include most Unity actions.

executeOnMainThreadQueue: Queue of actions which gets emptied on each frame in the main thread.

doNothing: An action which does nothing. Useful if a method requires an Action

Properties

None

Methods

UXF.FileIOManager.Begin()

Starts the FileIOManager Worker thread.

Parameters

None

UXF.FileIOManager.ManageInWorker(System.Action)

Adds a new command to a queue which is executed in a separate worker thread when it is available. Warning: The Unity Engine API is not thread safe, so do not attempt to put any Unity commands here.

Parameters

  • action:

UXF.FileIOManager.CopyFile(string, string)

Copy file from one place to another.

Parameters

  • sourceFileName:

  • destFileName:

UXF.FileIOManager.ReadJSON(string, System.Action<System.Collections.Generic.Dictionary<string, object>>)

Reads a JSON file from a path then calls a given action with the deserialzed object as the first argument

Parameters

  • fpath:

  • callback:

UXF.FileIOManager.WriteJson(object, UXF.WriteFileInfo)

Serializes an object using MiniJSON and writes to a given path

Parameters

  • destFileName:

  • serializableObject:

UXF.FileIOManager.WriteTrials(System.Collections.Generic.List<OrderedResultDict>, string[], UXF.WriteFileInfo)

Writes trial data (List of OrderedResultsDict) to file at fpath

Parameters

  • dataDict:

  • headers:

  • fpath:

UXF.FileIOManager.WriteCSV(string[], System.Collections.Generic.IList<string[]>, UXF.WriteFileInfo)

Writes a list of string arrays with a given header to a file at given path.

Parameters

  • header: Row of headers

  • data:

  • fpath:

UXF.FileIOManager.ReadCSV(string, System.Action<System.Data.DataTable>)

Read a CSV file from path, then runs an action that takes a DataTable as an argument. This code assumes the file is on disk, and the first row of the file has the names of the columns on it. Returns null if not found

Parameters

  • fpath:

  • callback:

UXF.FileIOManager.WriteCSV(System.Data.DataTable, UXF.WriteFileInfo)

Writes a DataTable to file to a path.

Parameters

  • data:

  • fpath:

UXF.FileIOManager.ManageInMain()

Handles any actions which are enqueued to run on Unity's main thread.

Parameters

None

UXF.FileIOManager.End()

Aborts the FileIOManager's thread and joins the thread to the calling thread.

Parameters

None


Note: This file was automatically generated

๐Ÿง  Core topics

โ“ More help


๐Ÿ‘ฉโ€๐Ÿ’ป Programming reference

Unit tests

Clone this wiki locally