long TryGetFileLength(IStatus status) { try { var location = TryGetObjectPath(status); if (string.IsNullOrWhiteSpace(location)) { return(0); } var partPath = PackFolder.GetChildFileWithName(location + ".part"); var fullPath = PackFolder.GetChildFileWithName(location); var partFileExists = partPath.Exists; if (!partFileExists && !fullPath.Exists) { return(0); } return(!partFileExists ? fullPath.FileInfo.Length : partPath.FileInfo.Length); } catch (Exception) { // File doesn't exist, don't bother. return(0); } }
IEnumerable <IAbsoluteFilePath> GetExistingPackFiles(IEnumerable <string> unchanged) => unchanged.Select(x => PackFolder.GetChildFileWithName(x)).Where(x => x.Exists);