Example #1
0
 /// <inheritdoc/>
 public FunctionTable ImportTable(ImportedTable Description)
 {
     if (Description.FieldName == "table")
     {
         return(new FunctionTable(new ResizableLimits(10, 20)));
     }
     else
     {
         return(null);
     }
 }
Example #2
0
 /// <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);
     }
 }
Example #4
0
    //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);
    }
Example #5
0
    // 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);
    }
Example #6
0
    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);
    }
Example #7
0
    //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);
    }
Example #8
0
 /// <inheritdoc/>
 public FunctionTable ImportTable(ImportedTable Description)
 {
     return(ImportOrDefault <FunctionTable>(Description, tableDefDict));
 }
Example #9
0
    //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;
    }
Example #10
0
    //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;
    }
Example #11
0
    // 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;
    }