public string Convert() { _progress.Report(new ProgressPartialResult() { Current = 0, Total = 0, Text = "Read data base" }); _dbInfo = _db.GetAll().ToList(); _progressMaximum = _dbInfo.Count(); int duplicate = 0; int renamed = 0; int current = 0; foreach (var item in _dbInfo) { current++; _progress.Report(new ProgressPartialResult() { Current = current, Total = _progressMaximum, Text = item.Path }); var totalDupl = _dbInfo.Where(info => info.Path.ToLower() == item.Path.ToLower()).ToArray(); if (totalDupl.Length > 1) { duplicate += totalDupl.Length; for (int i = 0; i < totalDupl.Length; i++) { _db.Remove(totalDupl[i].Path); } totalDupl[0].Path = item.Path.ToLower(); _db.UpsertFaceInfo(totalDupl[0]); } else { if (item.Path != item.Path.ToLower()) //if (!item.Path.Equals(item.Path.ToLower(), StringComparison.CurrentCulture)) { _db.Remove(item.Path); renamed++; item.Path = item.Path.ToLower(); _db.UpsertFaceInfo(item); } } } return($"Renamed {renamed}, duplicate {duplicate}"); }
internal string Remove() { _progress.Report(new ProgressPartialResult() { Current = 0, Total = 0, Text = "Read data base" }); _dbInfo = _db.GetAll().ToList(); _progressMaximum = _dbInfo.Count(); int removed = 0; int current = 0; foreach (var item in _dbInfo) { current++; _progress.Report(new ProgressPartialResult() { Current = current, Total = _progressMaximum, Text = item.Path }); if (!System.IO.File.Exists(item.Path)) { removed++; _db.Remove(item.Path); } } long shrinked = _db.Shrink(); return($"Removed {removed}, shrinked {shrinked}"); }