public PacketFileSequence(List <string> filenames, bool force = false) { filenames = filenames.Where(f => { var ext = Path.GetExtension(f); return(ext == null ? true : !".H".Equals(ext.ToUpperInvariant())); }).ToList(); filenames.Sort(PacketFile.Compare); Files = new List <T>(); foreach (var filename in filenames) { if (force) { Files.Add(new T { Path = filename }); continue; } var filetype = PacketFile.FileType(filename); if (typeof(T).IsAssignableFrom(filetype)) { Files.Add(new T { Path = filename }); } //else if (filetype == typeof (ITOSPacketFile) && typeof (T) == typeof (ActivePacketFile)) // Files.Add((new ActivePacketFile {Path = filename}) as T); else { Console.WriteLine(@"{0} is not a {1}. Ignoring.", filename, typeof(T)); } } }
public Dictionary <int, int> GetApidCounts() { if (_apidCountsCache != null) { return(_apidCountsCache); } _apidCountsCache = new Dictionary <int, int>(); foreach (var pf in Files) { PacketFile.MergeApidCounts(_apidCountsCache, pf.GetApidCounts()); } return(_apidCountsCache); }
public static int Compare(PacketFile a, PacketFile b) { return(Compare(a.Path, b.Path)); }