//static HashSet<BinaryInfo> binarySet = new HashSet<BinaryInfo>(); /// <summary> /// builds a file system map to its binaries. /// </summary> public static void addToFileSystemMap(BinaryInfo bi) { List<BinaryInfo> binaries; if (filesystemToBinaryInfo.TryGetValue(bi.keyValue, out binaries)) { binaries.Add(bi); } else { binaries = new List<BinaryInfo>() { bi }; filesystemToBinaryInfo.Add(bi.keyValue, binaries); } }
/// <summary> /// specialized add for binaryNameToBinaryInfo. /// </summary> public static void addToBinaryNameMap(BinaryInfo bi) { int lastIndexOfSlash = bi.filepath.LastIndexOf('/'); string binaryName = bi.filepath.Substring(lastIndexOfSlash +1); HashSet<BinaryInfo> binaries; if (binaryNameToBinaryInfo.TryGetValue(binaryName, out binaries)) { binaries.Add(bi); } else { binaries = new HashSet<BinaryInfo>() { bi }; binaryNameToBinaryInfo.Add(binaryName, binaries); } }
public static void streamReadHelper(StreamReader rStream) { string line = rStream.ReadLine(); if (String.IsNullOrEmpty(line)) { return; } if (line.StartsWith("filepath")) { return; } string[] lines = line.Split(';'); BinaryInfo bi = new BinaryInfo(lines); //binarySet.Add(bi); addToFileSystemMap(bi); addToBinaryNameMap(bi); }