public static void DeleteJsonFile(string path, JSONSTATE state) { if (state == JSONSTATE.RESOURCE) { path = Application.dataPath + "/" + "Resources/" + path; } else if (state == JSONSTATE.PERSISTENT_DATA_PATH) { path = Application.persistentDataPath + "/" + path; } else if (state == JSONSTATE.GAME_DATA_PATH) { path = Application.dataPath + "/" + path; } if (File.Exists(path)) { File.Delete(path); Debug.Log(string.Format("Deleted: {0}", path)); } else { Debug.Log(string.Format("{0} does not exist!", path)); } }
public static void WriteJsonToFile(string path, string content, JSONSTATE state) { switch (state) { case JSONSTATE.RESOURCE: WriteJsonToResource(path, content); break; case JSONSTATE.PERSISTENT_DATA_PATH: WriteJsonToPersistentData(path, content); break; case JSONSTATE.GAME_DATA_PATH: WriteJsonToGameDataPath(path, content); break; default: break; } }
public static string LoadJsonFromFile(string path, JSONSTATE state) { string loadJsonString = ""; switch (state) { case JSONSTATE.RESOURCE: loadJsonString = LoadJsonFromResource(path); break; case JSONSTATE.PERSISTENT_DATA_PATH: loadJsonString = LoadJsonFromPersistentData(path); break; case JSONSTATE.GAME_DATA_PATH: loadJsonString = LoadJsonFromGameDataPath(path); break; } return(loadJsonString); }