//load local tables from persist storage as described in the curtable, which is loaded from the csvwrangler.csv // currently synchronous, in the future may become async public void LoadTables() { State = CSVWranglerState.Loading; //reset so we could reload tables = new Dictionary <string, DeadSimpleCSV>(); //grab the row and load each file of name into the tables dict string[] tableNames = indexTable.GetColumn("name"); foreach (string name in tableNames) { string tableFullLoc = Application.persistentDataPath + "/" + name + ".csv"; //TODO could change this logic so the file contents is returned by the util function so we don't double load? //make sure it exists UTIL.EnsureTextResourceIsHere(tableFullLoc, "csvs/" + name); //attempt to load string fileContents = UTIL.ReadAllText(tableFullLoc); //notify of failure if (string.IsNullOrEmpty(fileContents)) { Debug.LogWarning("Tried to load the " + name + " csv but something went wrong"); } else//success, maybe { DeadSimpleCSV table = new DeadSimpleCSV(fileContents, true); tables.Add(name, table); } } State = CSVWranglerState.Ready; }
private bool ForceCacheIndex() { return(UTIL.EnsureTextResourceIsHere(Application.persistentDataPath + "/csvWrangler.csv", "csvs/csvWrangler")); }