public void Scan() { using (var unitsync = new UnitSync(Paths, Engine)) { unitsync.ReInit(); var archiveCache = unitsync.GetArchiveCache(); using (var db = new ZkDataContext()) { var registered = db.Resources.Select(x => x.InternalName).ToDictionary(x => x, x => true); foreach (var archive in archiveCache.Archives) { if (!registered.ContainsKey(archive.Name) && !UnitSync.DependencyExceptions.Contains(archive.Name)) { Register(unitsync, archive); } } } } }
public List <ScanResult> Scan() { var results = new List <ScanResult>(); using (var unitsync = new UnitSync(Paths, Engine)) { unitsync.ReInit(); var archiveCache = unitsync.GetArchiveCache(); using (var db = new ZkDataContext()) { var registered = db.Resources.Select(x => x.InternalName).ToDictionary(x => x, x => true); foreach (var archive in archiveCache.Archives) { if (!UnitSync.DependencyExceptions.Contains(archive.Name)) { if (registered.ContainsKey(archive.Name)) { results.Add(new ScanResult() { ResourceInfo = archive, Status = ResourceFileStatus.AlreadyExists, }); } else { var fullInfo = Register(unitsync, archive); results.Add(new ScanResult() { ResourceInfo = fullInfo ?? archive, Status = fullInfo != null ? ResourceFileStatus.Registered : ResourceFileStatus.RegistrationError }); } } } unitsync.Reset(); } return(results); } }