public override SymbolCollection parseFile(string filename, out List<CodeBlock> newCodeBlocks, out List<AxisHelper> newAxisHelpers)
{
newCodeBlocks = new List<CodeBlock>();
SymbolCollection newSymbols = new SymbolCollection();
newAxisHelpers = new List<AxisHelper>();
byte[] allBytes = File.ReadAllBytes(filename);
string boschnumber = ExtractBoschPartnumber(allBytes);
string softwareNumber = ExtractSoftwareNumber(allBytes);
string additionalInfo = ExtractInfo(allBytes);
string partnumber = ExtractPartnumber(allBytes);
partNumberConverter pnc = new partNumberConverter();
ECUInfo info = pnc.ConvertPartnumber(boschnumber, allBytes.Length);
// check if V6 2.5 TDI/R4 1.9 TDI/R3 1.4 TDi
int nrCylinders = pnc.GetNumberOfCylinders(info.EngineType, additionalInfo);
// we can detect maps depending on ECUType/EngineType/nrCylinders/Filesize etc
VerifyCodeBlocks(allBytes, newSymbols, newCodeBlocks);
for (int t = 0; t < allBytes.Length - 1; t += 2)
{
int len2skip = 0;
if (CheckMap(t, allBytes, newSymbols, newCodeBlocks, out len2skip))
{
if (len2skip > 2) len2skip -= 2; // make sure we don't miss maps
if ((len2skip % 2) > 0) len2skip -= 1;
if (len2skip < 0) len2skip = 0;
// t += len2skip;
// Console.WriteLine("map detected: " + t.ToString("X8"));
}
}
newSymbols.SortColumn = "Flash_start_address";
newSymbols.SortingOrder = GenericComparer.SortOrder.Ascending;
newSymbols.Sort();
NameKnownMaps(allBytes, newSymbols, newCodeBlocks);
BuildAxisIDList(newSymbols, newAxisHelpers);
MatchAxis(newSymbols, newAxisHelpers);
FindSVBL(allBytes, filename, newSymbols, newCodeBlocks);
SymbolTranslator strans = new SymbolTranslator();
foreach (SymbolHelper sh in newSymbols)
{
sh.Description = strans.TranslateSymbolToHelpText(sh.Varname);
}
// check for must have maps... if there are maps missing, report it
return newSymbols;
}