Only print warning for non-contiguous files

This commit is contained in:
Deterous
2024-02-11 12:39:13 +09:00
parent cf19596ea7
commit b862057123
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -785,7 +785,7 @@ namespace IRDKit
try try
{ {
// Read key from .key file // Read key from .key file
byte[] discKey = File.ReadAllBytes(keyPath); byte[] discKey = File.ReadAllBytes(keyfilePath);
if (discKey == null || discKey.Length != 16) if (discKey == null || discKey.Length != 16)
Console.Error.WriteLine($"{hexKey} is not a valid key, detecting key automatically..."); Console.Error.WriteLine($"{hexKey} is not a valid key, detecting key automatically...");
else else
+4 -4
View File
@@ -715,7 +715,7 @@ namespace LibIRD
HashFiles(fs, reader, rootDir); HashFiles(fs, reader, rootDir);
if (FileCount != fileCount) if (FileCount != fileCount)
{ {
Console.WriteLine($"{isoPath} contains split files: detected {FileCount} out of {fileCount} expected files"); //Console.WriteLine($"{isoPath} contains split files: detected {FileCount} out of {fileCount} expected files");
long[] tempFileKeys = FileKeys; long[] tempFileKeys = FileKeys;
Array.Resize(ref tempFileKeys, (int)FileCount); Array.Resize(ref tempFileKeys, (int)FileCount);
FileKeys = tempFileKeys; FileKeys = tempFileKeys;
@@ -943,6 +943,9 @@ namespace LibIRD
if (fileClusters[i] == null) if (fileClusters[i] == null)
throw new InvalidFileSystemException($"Unexpected file extents for {filePath}"); throw new InvalidFileSystemException($"Unexpected file extents for {filePath}");
if (fileClusters[i].Offset * SectorSize != fileClusters[i - 1].Offset * SectorSize + fileClusters[i - 1].Count)
Console.WriteLine($"Non-contiguous file found: {filePath}");
if (fileClusters[i].Offset < smallestOffset) if (fileClusters[i].Offset < smallestOffset)
smallestOffset = fileClusters[i].Offset; smallestOffset = fileClusters[i].Offset;
} }
@@ -951,9 +954,6 @@ namespace LibIRD
if (Array.Exists(FileKeys, element => element == smallestOffset)) if (Array.Exists(FileKeys, element => element == smallestOffset))
continue; continue;
if (fileClusters.Length > 1)
Console.WriteLine($"Split file detected: {filePath}");
// Add file offset to keys // Add file offset to keys
FileKeys[FileCount] = smallestOffset; FileKeys[FileCount] = smallestOffset;