public void LoadData() { string fileName = FileSelectionHelper.SelectFile(new ExtensionFilter("Data Files", "csv")); if (fileName == null) { return; } DriveData driveData = ParseFileToJson(fileName); using (StreamWriter writer = new StreamWriter("output.json")) { writer.Write(JsonConvert.SerializeObject(driveData)); } if (driveData == null) { Debug.Log("Cannot read the file."); return; } EventBus.Instance.OnFileLoad.Invoke(fileName); EventBus.Instance.OnDataLoad.Invoke(driveData); }
public void LoadData() { string fileName = FileSelectionHelper.SelectFile(new ExtensionFilter("Data Files", "json")); if (fileName == null) { return; } DriveData driveData = ReadJsonFile(fileName); if (driveData == null) { Debug.Log("Cannot read the file."); return; } EventBus.Instance.OnFileLoad.Invoke(fileName); EventBus.Instance.OnDataLoad.Invoke(driveData); }