Ejemplo n.º 1
0
        public FileDataService(
            IDirectoryDataService directorySetupService,
            INotificationCenterService notificationCenterService,
            ISettingsService settingsService)
            : base(settingsService, notificationCenterService)
        {
            this._directorySetupService     = directorySetupService;
            this._notificationCenterService = notificationCenterService;
            this._settingsService           = settingsService;
            _getFullFileInfo = this._directorySetupService
                               .Get()
                               .Connect()
                               .LeftJoinMany(
                this.cache.Connect(),
                (dirSetup) => dirSetup.DirectorySetupId,
                (left, right) => right.Items.Select(item => new FileInfoEx(left, item))
                )
                               .TransformMany(x => x, x => x.FileInfo.Id)
                               .TakeUntil(destroy)
                               .AsObservableCache();

            _getFullFIleInfoByHash = this._getFullFileInfo
                                     .Connect()
                                     .Filter(file => FileInfoHashKey.CanBuild(file.FileInfo))
                                     .ChangeKey(file => file.FileInfo.HashKey.Value)
                                     .AsObservableCache();

            _fileHashCache = this.cache
                             .Connect()
                             .Filter(file => file.FileHash.HasValue && file.IsAccessible)
                             .ChangeKey(file => file.HashKey.Value)
                             .AsObservableCache();
        }
Ejemplo n.º 2
0
 public FileItemLink(
     ItemId itemId,
     FileInfoHashKey fileKey,
     FileInfoHashKey?thumbnailKey,
     Version version)
     : this(
         (FileItemLinkId)Guid.NewGuid(),
         itemId,
         fileKey,
         thumbnailKey,
         version,
         DateTime.Now)
 {
 }
Ejemplo n.º 3
0
 public FileItemLink(
     FileItemLink origin,
     ItemId itemId,
     FileInfoHashKey fileKey,
     FileInfoHashKey?thumbnailKey,
     Version version)
     : this(
         origin.Id,
         itemId == default ? origin.ItemId : itemId,
         fileKey == default ? origin.FileKey : fileKey,
         thumbnailKey == default ? origin.ThumbnailKey : thumbnailKey,
         version == default ? origin.Version : version,
         DateTime.Now)
 {
 }
Ejemplo n.º 4
0
 public FileItemLink(
     FileItemLinkId id,
     ItemId itemId,
     FileInfoHashKey fileKey,
     FileInfoHashKey?thumbnailKey,
     Version version,
     DateTime created,
     DateTime?lastChange = null)
 {
     this.Id           = id;
     this.ItemId       = itemId;
     this.FileKey      = fileKey;
     this.Version      = version;
     this.Created      = created;
     this.ThumbnailKey = thumbnailKey;
     this.LastChange   = lastChange ?? DateTime.Now;
 }
Ejemplo n.º 5
0
 public FileInfo(
     Uri path, DateTime creationTime, FileHash?fileHash, DateTime lastWriteTime, DirectorySetupId directorySetupId, long fileSize,
     bool isAccessible, FileInfoId id, DateTime created, DateTime?lastChange = null)
 {
     this.Path             = path;
     this.FileCreationTime = creationTime;
     this.FileHash         = fileHash;
     this.LastWriteTime    = lastWriteTime;
     this.DirectorySetupId = directorySetupId;
     this.FileSize         = fileSize;
     this.IsAccessible     = isAccessible;
     this.Id         = id;
     this.Created    = created;
     this.LastChange = lastChange ?? DateTime.Now;
     this.Identity   = Guid.NewGuid();
     this.HashKey    = null;
     if (FileInfoHashKey.CanBuild(this))
     {
         this.HashKey = new FileInfoHashKey(this);
     }
 }
Ejemplo n.º 6
0
 public IObservable <FileInfo> Get(FileInfoHashKey key)
 => _fileHashCache.WatchValue(key);
Ejemplo n.º 7
0
 public FileInfoHashKeyDTO(FileInfoHashKey origin)
 {
     this.Hash     = origin.FileHash.Data;
     this.FileSize = origin.FileSize;
 }