static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage: TrainerDB.exe dbfile outfile"); return; } AtomDictionary atoms = null; StubAnnotatedSummaryDictionary candidates = null; using (var fs = new System.IO.FileStream(args[0], System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read)) { var serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); var obj = serializer.Deserialize(fs); atoms = obj as AtomDictionary; if (atoms != null) { atoms.Print(args[1]); } candidates = obj as StubAnnotatedSummaryDictionary; if (candidates != null) { candidates.Print(args[1]); } } }
public static AtomDictionary Merge(IEnumerable <AtomDictionary> atoms) { var ret = new HashSet <string>(); atoms.Iter(atom => ret.UnionWith(atom.table)); var merged = new AtomDictionary(); merged.table.AddRange(ret); return(merged); }