Add Pair Character Analysis for funsies

This commit is contained in:
Loporrit
2025-02-22 11:59:22 +00:00
parent def13858f4
commit eaaded1ed5
19 changed files with 701 additions and 32 deletions

View File

@@ -322,7 +322,7 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
var filePath = _fileDbManager.GetCacheFilePath(fileHash, fileExtension);
await _fileCompactor.WriteAllBytesAsync(filePath, decompressedFile.ToArray(), token).ConfigureAwait(false);
PersistFileToStorage(fileHash, filePath);
PersistFileToStorage(fileHash, filePath, fileLengthBytes);
}
catch (Exception e)
{
@@ -355,7 +355,7 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
return await response.Content.ReadFromJsonAsync<List<DownloadFileDto>>(cancellationToken: ct).ConfigureAwait(false) ?? [];
}
private void PersistFileToStorage(string fileHash, string filePath)
private void PersistFileToStorage(string fileHash, string filePath, long? compressedSize = null)
{
var fi = new FileInfo(filePath);
Func<DateTime> RandomDayInThePast()
@@ -378,6 +378,8 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
File.Delete(filePath);
_fileDbManager.RemoveHashedFile(entry.Hash, entry.PrefixedFilePath);
}
if (entry != null)
entry.CompressedSize = compressedSize;
}
catch (Exception ex)
{

View File

@@ -245,6 +245,8 @@ public sealed class FileUploadManager : DisposableMediatorSubscriberBase
var compressedSize = CurrentUploads.Sum(c => c.Total);
Logger.LogDebug("Upload complete, compressed {size} to {compressed}", UiSharedService.ByteToString(totalSize), UiSharedService.ByteToString(compressedSize));
_fileDbManager.WriteOutFullCsv();
}
foreach (var file in unverifiedUploadHashes.Where(c => !CurrentUploads.Exists(u => string.Equals(u.Hash, c, StringComparison.Ordinal))))