public void RefreshMetadata(FileInformation fileinfo, IFileInfo file) { var files = Funani.GetCollection <FileInformation>("fileinfo"); fileinfo.RefreshMetadata(file); // TODO: files.Save(fileinfo); }
public void Save(FileInformation fileinfo) { if (fileinfo != null) { var files = Funani.GetCollection <FileInformation>("fileinfo"); //TODO: files.Save(fileinfo); } }
public FileInformation Retrieve(IFileInfo file) { var files = Funani.GetCollection <FileInformation>("fileinfo"); string path = file.FullName; var result = files.AsQueryable <FileInformation>() .Where(x => (x.FileSize == file.Length) && x.Paths.Contains(path)); // TODO: Check why some have more than one! // return result.SingleOrDefault(); return(result.FirstOrDefault()); }
public void RemovePath(IFileInfo file) { var files = Funani.GetCollection <FileInformation>("fileinfo"); string path = file.FullName; var list = new[] { path }; var queryBuilder = new QueryBuilder <FileInformation>(); var query = queryBuilder.In(x => x.Paths, list); FileInformation info = null; //TODO: files.FindOneAs<FileInformation>(query); if (info != null) { info.Paths.Remove(file.FullName); //TODO: files.Save(info); } }
public FileInformation Retrieve(String hash, IFileInfo file) { var files = Funani.GetCollection <FileInformation>("fileinfo"); FileInformation info = null; //TODO: repair: files.FindAsync<FileInformation>(hash).Result; if (info == null) { info = new FileInformation(file); files.InsertOne(info); } else { info.AddPath(file); // TODO: files.Save(info); } return(info); }