public int Find(IRawFile reader, int scan) { PairResult pr; if (!map.TryGetValue(reader, out pr) || !reader.FileName.Equals(pr.FileName)) { pr = new PairResult() { FileName = reader.FileName, ScanMap = builder.GetScanLevels(reader).ToDictionary(m => m.Scan) }; map[reader] = pr; } ScanLevel level; if (pr.ScanMap.TryGetValue(scan, out level)) { if (level.Parent != null) { return(level.Parent.Scan); } } return(0); }
public static List <ScanLevel> GetScanLevels(this IScanLevelBuilder builder, string fileName) { using (var reader = RawFileFactory.GetRawFileReader(fileName)) { return(builder.GetScanLevels(reader)); } }
public void BuildMap(IScanLevelBuilder builder, IRawFile file) { levels = builder.GetScanLevels(file).ToDictionary(m => m.Scan); }