multiple inconsistencies fixed (AI)
This commit is contained in:
@@ -103,6 +103,13 @@ export class NTFSFilesystem extends BaseFilesystem {
|
||||
|
||||
calculate(variantId) {
|
||||
const values = this.getInputValues(variantId);
|
||||
|
||||
// Validate input ranges
|
||||
const validation = this.validateFilesystemSpecific(variantId, values);
|
||||
if (!validation.valid) {
|
||||
console.warn('NTFS validation errors:', validation.errors);
|
||||
}
|
||||
|
||||
const results = {};
|
||||
|
||||
if (variantId === 'ntfs') {
|
||||
@@ -110,6 +117,32 @@ export class NTFSFilesystem extends BaseFilesystem {
|
||||
}
|
||||
}
|
||||
|
||||
validateFilesystemSpecific(variantId, values) {
|
||||
if (variantId !== 'ntfs') return { valid: true, errors: [] };
|
||||
|
||||
const errors = [];
|
||||
|
||||
// Validate cluster number is reasonable
|
||||
if (values.clusterNumberNTFS !== undefined && values.partitionSizeSectorsNTFS !== undefined && values.sectorSizeNTFS !== undefined && values.clusterSizeSectorsNTFS !== undefined) {
|
||||
const clusterSizeBytes = Math.pow(2, values.sectorSizeNTFS) * Math.pow(2, values.clusterSizeSectorsNTFS);
|
||||
const partitionSizeBytes = values.partitionSizeSectorsNTFS * Math.pow(2, values.sectorSizeNTFS);
|
||||
const maxClusters = partitionSizeBytes / clusterSizeBytes;
|
||||
if (values.clusterNumberNTFS > maxClusters) {
|
||||
errors.push(`clusterNumberNTFS: ${values.clusterNumberNTFS} > max ${Math.floor(maxClusters)}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate MFT entry number is reasonable
|
||||
if (values.mftEntryNumberNTFS !== undefined && values.mftEntryNumberNTFS < 0) {
|
||||
errors.push('mftEntryNumberNTFS: MFT-Eintrag muss >= 0 sein');
|
||||
}
|
||||
|
||||
return {
|
||||
valid: errors.length === 0,
|
||||
errors: errors
|
||||
};
|
||||
}
|
||||
|
||||
calculateMFTEntrySize(rawValue, clusterSizeBytes) {
|
||||
// Special encoding from offset 0x40 and 0x44
|
||||
// If positive (0x00-0x7F): size = value * cluster size
|
||||
|
||||
Reference in New Issue
Block a user