예제 #1
0
        public void RefreshMetadata(FileInformation fileinfo, IFileInfo file)
        {
            var files = Funani.GetCollection <FileInformation>("fileinfo");

            fileinfo.RefreshMetadata(file);
            // TODO: files.Save(fileinfo);
        }
예제 #2
0
 public void Save(FileInformation fileinfo)
 {
     if (fileinfo != null)
     {
         var files = Funani.GetCollection <FileInformation>("fileinfo");
         //TODO: files.Save(fileinfo);
     }
 }
예제 #3
0
        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());
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
        }