public ItemPreviewModel RemoveOrUpdate(IFileSource source, string relativePath) { _sources[source.Id] = source; bool IsFile(ImportedFileInfo info) { return(info.FilePath == relativePath && info.SourceId == source.Id); } foreach (var model in _models) { var file = model.Sources.FirstOrDefault(IsFile); if (file == null) { continue; } model.Sources.Remove(file); if (model.Sources.Count == 0) { _models.Remove(model); _modelsByHash.Remove(model.FileHash); model.Selected.Value = false; } else if (source.Config is ImportFolderConfig config) { var tag = ImportFolderTagHelper.GetFolderTag(config); model.Tags.Remove(tag); } return(model); } return(null); }
public override IReadOnlyCollection <string> GetTags(string resourcePath) { return(ImportFolderTagHelper.GenerateTags(_config, resourcePath)); }