private void TryToLoadAdditionalCSVSymbols(string filename, SymbolCollection coll2load)
{
// convert to CSV file format
// ADDRESS;NAME;;;
try
{
SymbolTranslator st = new SymbolTranslator();
char[] sep = new char[1];
sep.SetValue(';', 0);
string[] fileContent = File.ReadAllLines(filename);
foreach (string line in fileContent)
{
string[] values = line.Split(sep);
try
{
string varname = (string)values.GetValue(1);
int flashaddress = Convert.ToInt32(values.GetValue(0));
foreach (SymbolHelper sh in coll2load)
{
if (sh.Flash_start_address == flashaddress)
{
sh.Userdescription = varname;
}
}
}
catch (Exception lineE)
{
Console.WriteLine("Failed to import a symbol from CSV file " + line + ": " + lineE.Message);
}
}
}
catch (Exception E)
{
Console.WriteLine("Failed to import additional CSV symbols: " + E.Message);
}
}