| 12345678910111213141516171819202122232425262728293031323334353637 |
- using LitJson;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using UnityEngine;
- public class FileTool
- {
- public static JsonData ReadJson(string path)
- {
- try
- {
- if (File.Exists(path))
- {
- FileStream fs = new FileStream(path, FileMode.Open);
- StreamReader sr = new StreamReader(fs);
- JsonData values = JsonMapper.ToObject(sr.ReadToEnd());
- if (fs != null)
- {
- fs.Close();
- }
- if (sr != null)
- {
- sr.Close();
- }
- return values;
- }
- }
- catch (Exception e)
- {
- Debug.LogException(e);
- }
- return null;
- }
- }
|