public static IEnumerator LoadBinHeader(string filename, PatchDataLoadedCallback <GridData> callback) { #if UNITY_WEBGL callback(ParseBinHeader(PatchDataIO.brHeaders)); yield break; #else yield return(FileRequest.GetBinary(filename, (br) => callback(ParseBinHeader(br)))); #endif }
public static IEnumerator ParseAsync <T>(StreamReader sr, string filename, ParseTask task, PatchDataLoadedCallback <T> callback) where T : PatchData { if (parseThread == null) { taskData = new ParseTaskData(); parseThread = new Thread(ParseThread) { Name = "ParseThread", Priority = ThreadPriority.Highest, }; parseThread.Start(); } lock (_lock) { taskData.sr = sr; taskData.filename = filename; taskData.task = task; blockParser = false; Monitor.Pulse(_lock); } while (!blockParser) { yield return(IEnumeratorExtensions.AvoidRunThru); } callback(taskData.patch as T); // Clear task data taskData.Clear(); }
public static IEnumerator LoadBin(this GridData grid, string filename, PatchDataLoadedCallback <GridData> callback) { yield return(FileRequest.GetBinary(filename, (br) => callback(ParseBin(br, grid)))); }
public static IEnumerator LoadCsv(string filename, PatchDataLoadedCallback <GridData> callback) { yield return(FileRequest.GetText(filename, (sr) => callback(ParseCsv(sr, filename)))); }
public static IEnumerator LoadCsv(string filename, PatchDataLoadedCallback <MultiGridData> callback) { yield return(FileRequest.GetText(filename, (sr) => PatchDataIO.ParseAsync(sr, filename, ParseCsv, callback))); }
public static IEnumerator LoadBin(this PointData pointData, string filename, PatchDataLoadedCallback <PointData> callback) { yield return(FileRequest.GetBinary(filename, (br) => callback(ParseBin(br, filename, pointData)))); }