/// <inheritdoc/> public FunctionTable ImportTable(ImportedTable Description) { if (Description.FieldName == "table") { return(new FunctionTable(new ResizableLimits(10, 20))); } else { return(null); } }
/// <inheritdoc/> public FunctionTable ImportTable(ImportedTable description) { if (moduleImporters.TryGetValue(description.ModuleName, out IImporter importer)) { return(importer.ImportTable(description)); } else { return(null); } }
/// <inheritdoc/> public FunctionTable ImportTable(ImportedTable description) { if (Module.ExportedTables.TryGetValue(description.FieldName, out FunctionTable result) && result.Limits.Initial >= description.Table.Limits.Initial) { return(result); } else { return(null); } }
//Loads the Key Value Pair from the current pointer in the table static ImportedDataPoint GetDataPoint(ImportedTable _table) { ImportedDataPoint p = new ImportedDataPoint(); string[] pair = _table.GetKeyValuePair(); if (pair == null) { return(null); } p.key = pair[0]; p.value = pair[1]; return(p); }
// Creates containers from a table static List <ImportedDataContainer> getDataFromTable(ImportedTable _table) { //Sets pointer to cell 0,0 _table.ResetPointer(); //Add the first container [should be under 0,0] List <ImportedDataContainer> _containers = new List <ImportedDataContainer>(); _containers.Add(GetContainer(_table)); //Add containers, as long the script finds values in the first ROW of your csv while (_table.SetNextHeader()) { _containers.Add(GetContainer(_table)); } return(_containers); }
public ImportData() { instance = this; containers = new List <ImportedDataContainer>(); foreach (string file in importNames) { ImportedTable _table = ImportedTable.LoadFromFile(file); if (_table != null) { containers.AddRange(getDataFromTable(_table)); } else { Debug.LogWarning("Could not import data from " + file); } } Debug.Log("- DataContainers Configured:" + containers.Count); }
//returns the container from current table-pointer position static ImportedDataContainer GetContainer(ImportedTable _table) { string id = _table.GetStringFromPointer(); if (string.IsNullOrEmpty(id)) { return(null); } ImportedDataContainer container = new ImportedDataContainer(); container.ID = id; Debug.Log("-- new Container: " + id); //iterate through the rows (as long as they are not empty //and add DataPoints (Key-Value Pairs) to the current container while (_table.SetNextRow(false)) { container.AddDataPoint(GetDataPoint(_table)); } return(container); }
/// <inheritdoc/> public FunctionTable ImportTable(ImportedTable Description) { return(ImportOrDefault <FunctionTable>(Description, tableDefDict)); }
//returns the container from current table-pointer position static ImportedDataContainer GetContainer(ImportedTable _table) { string id = _table.GetStringFromPointer(); if( string.IsNullOrEmpty(id)){ return null; } ImportedDataContainer container = new ImportedDataContainer(); container.ID = id; Debug.Log("-- new Container: "+id); //iterate through the rows (as long as they are not empty //and add DataPoints (Key-Value Pairs) to the current container while(_table.SetNextRow(false)){ container.AddDataPoint( GetDataPoint(_table)); } return container; }
//Loads the Key Value Pair from the current pointer in the table static ImportedDataPoint GetDataPoint(ImportedTable _table) { ImportedDataPoint p = new ImportedDataPoint(); string[] pair = _table.GetKeyValuePair(); if(pair == null) return null; p.key = pair[0]; p.value = pair[1]; return p; }
// Creates containers from a table static List<ImportedDataContainer> getDataFromTable(ImportedTable _table) { //Sets pointer to cell 0,0 _table.ResetPointer(); //Add the first container [should be under 0,0] List<ImportedDataContainer> _containers = new List<ImportedDataContainer>(); _containers.Add( GetContainer(_table)); //Add containers, as long the script finds values in the first ROW of your csv while(_table.SetNextHeader()){ _containers.Add (GetContainer(_table)); } return _containers; }