Skip to content

Commit

Permalink
added list test
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSimons committed Feb 5, 2024
1 parent 63fb837 commit 5343803
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Assets/Scripts/Layers/Adapters/CSVImportAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using CsvHelper;
using CsvHelper.Configuration;
using CsvHelper.Configuration.Attributes;
Expand Down Expand Up @@ -106,6 +107,8 @@ private IEnumerable<Dictionary<string, Color>> ReadCSVColors(string path, int ma
using (var csv = new CsvReader(reader, config))
{
var dictionary = new Dictionary<string, Color>();
var list = new List<IDColor>();

// var records = csv.GetRecords<IDColor>().GetEnumerator();
csv.Read();
csv.ReadHeader();
Expand All @@ -114,8 +117,16 @@ private IEnumerable<Dictionary<string, Color>> ReadCSVColors(string path, int ma
var id = csv.GetField<string>("Id");
var hexColor = csv.GetField<string>("HexColor");
dictionary[id] = ParseHexColor(hexColor);
var item = new IDColor
{
Id = id,
HexColor = hexColor
};

list.Add(item);
if (dictionary.Count <= maxParsesPerFrame)
{
Debug.Log("listcount: " + list.Count);
yield return dictionary;
dictionary.Clear();
}
Expand Down

0 comments on commit 5343803

Please sign in to comment.