Esempio n. 1
0
        public void RenameFilesInDirectory(string oldPath, string newPath, Watcher watcher)
        {
            var filesInOldPath = FilesInDirectory(oldPath, watcher);

            foreach (File file in filesInOldPath)
            {
                var      newFullName = newPath + Path.DirectorySeparatorChar + DBHelpers.GetRelativePathFromFile(file.FullName, oldPath);
                FileInfo newInfo     = new FileInfo(newFullName);
                file.FullName      = newInfo.FullName;
                file.Directory     = newInfo.DirectoryName;
                file.Directory_fts = DBHelpers.TokenizeDirectory(newInfo, watcher);
            }
            SaveChanges();
        }
Esempio n. 2
0
        private static File MakeFileModel(FileInfo fileInfo, Watcher watcher)
        {
            File newFile = new File
            {
                FullName           = fileInfo.FullName,
                Directory          = fileInfo.DirectoryName,
                Name               = fileInfo.Name,
                FileCreatedTime    = fileInfo.CreationTimeUtc,
                FileModifiedTime   = fileInfo.LastWriteTimeUtc,
                LastChangeTime     = Helpers.LastChangeTime(fileInfo),
                Extension          = fileInfo.Extension,
                Directory_fts      = DBHelpers.TokenizeDirectory(fileInfo, watcher),
                Name_fts           = fileInfo.Name,
                Name_tokenized_fts = DBHelpers.TokenizeName(fileInfo),
                Extension_fts      = fileInfo.Extension.Trim('.'),
                WatcherId          = watcher.Id
            };

            // Fix these when they actually get exceptions.
            newFile.Thumbnail = MaybeMakeThumbnail(fileInfo, watcher);
            updateXMPTagsFromFile(newFile);
            return(newFile);
        }