public static bool load(FileInfo f) { /* * This method is called either from within 'doPrepWork' - when no threads have * been spawned - or from within 'Manifest.load(string)' - which sets mutexes. * Hence, there is no need to set mutexes here. In fact, don't use mutexes here * because that could lead to a deadlock condition * * This method checks for duplicate QR codes before adding to the Manifest OM */ if (Root.ContainsKey(f.Name)) return false; // 'f' already parsed and loaded in DOM else Manifest.removeDuplicates(f); Root.Add(f.Name, new SortedList()); SortedList list = (SortedList)Root[f.Name]; string[] lines = File.ReadAllLines(f.FullName); if (lines.Length == 0) { f.Delete(); return false; } foreach (string line in lines) { string[] tokens = line.Split(':'); if (tokens.Length != 2) continue; // => malformed line in manifest string key = tokens[0], details = tokens[1]; ManifestEntry entry = new ManifestEntry(details, key); // entry.decompile() ; list.Add(key, entry); // there should be no exception because we have already removed // duplicates. But if there is, then that is a serious problem } return true; }
public static bool load(FileInfo f) { if (Root.ContainsKey(f.Name)) return false ; // 'f' already parsed and loaded in DOM Root.Add(f.Name, new SortedList()) ; SortedList list = (SortedList)Root[f.Name] ; string[] lines = File.ReadAllLines(f.FullName) ; foreach(string line in lines) { string[] tokens = line.Split(':') ; if (tokens.Length != 2) continue ; // => malformed line in manifest string key = tokens[0], details = tokens[1] ; ManifestEntry entry = new ManifestEntry(details, key) ; // entry.decompile() ; list.Add(key, entry) ; } return true ; }