예제 #1
0
        private string GetHashForDirectory(string fullPath)
        {
            var    subPath          = _activeRackServices.GetSubpath(fullPath);
            string rackHash         = _activeRackServices.ActiveRackHash;
            string universalSubPath = CreateUniversalPath(subPath);
            string hash             = _hasher.ComputeStringHash($"{rackHash}.{universalSubPath}");

            return(hash);
        }
예제 #2
0
        public DirectoryInfoDto GetSubDirectoryInfo(string subDirectory)
        {
            var directoryInfo   = new DirectoryInfoDto();
            var activeDirectory = _activeRackService.ActiveDirectory;
            var fullPath        = Path.Combine(activeDirectory, subDirectory);

            var fileNames = _directoryMethods.GetFileNames(fullPath).Select(Path.GetFileName);
            var dirNames  = _directoryMethods.GetDirectories(fullPath).Select(path => _activeRackService.GetSubpath(path));

            var normSubDir = _activeRackService.GetSubpath(fullPath);

            if (normSubDir != ".")
            {
                dirNames = new[] { Path.Combine(normSubDir, @"..") }
            }
예제 #3
0
        public IEnumerable <Content> ParsePhysicalFiles(DirectoryContentThreadInfo info)
        {
            info.FileNames = _directoryMethods.GetFileNames(info.FullPath);
            foreach (var fn in info.FileNames)
            {
                info.FilesDone++;

                PhysicalFile physicalFile = new()
                {
                    Hash     = _hasher.ComputeFileContentHash(fn),
                    Type     = PhysicalFile.GetContentTypeByExtension(fn),
                    FullPath = fn,
                    SubPath  = _activeRackService.GetSubpath(fn)
                };

                yield return(ToContentEntity(physicalFile));
            }
        }