multiple inconsistencies fixed (AI)

This commit is contained in:
2025-12-07 20:12:48 +01:00
parent 95367b4d14
commit d38b4c7813
8 changed files with 283 additions and 50 deletions

View File

@@ -10,10 +10,42 @@ export class FAT12_16Filesystem extends BaseFilesystem {
if (variantId !== 'fat1216') return;
const values = this.getInputValues(variantId);
// Validate input ranges
const validation = this.validateFilesystemSpecific(variantId, values);
if (!validation.valid) {
console.warn('FAT12/16 validation errors:', validation.errors);
}
const results = {};
this.calculateFAT1216(values, results);
}
validateFilesystemSpecific(variantId, values) {
if (variantId !== 'fat1216') return { valid: true, errors: [] };
const errors = [];
// Validate cluster number doesn't exceed total clusters
if (values.clusterNumber1216 !== undefined && values.clusterNumber1216 < 2) {
errors.push('clusterNumber1216: Cluster-Nummer muss >= 2 sein');
}
// Validate partition size is greater than reserved + FAT areas
if (values.partitionSizeInSectors1216 !== undefined && values.reservedSektoren1216 !== undefined && values.numFATs1216 !== undefined && values.fatSizeSectors1216 !== undefined) {
const minPartitionSize = values.reservedSektoren1216 + (values.numFATs1216 * values.fatSizeSectors1216) + 1;
if (values.partitionSizeInSectors1216 < minPartitionSize) {
errors.push(`partitionSizeInSectors1216: ${values.partitionSizeInSectors1216} < minimum ${minPartitionSize}`);
}
}
return {
valid: errors.length === 0,
errors: errors
};
}
constructor() {
super('FAT12/16', [
{
@@ -201,10 +233,42 @@ export class FAT32Filesystem extends BaseFilesystem {
if (variantId !== 'fat32') return;
const values = this.getInputValues(variantId);
// Validate input ranges
const validation = this.validateFilesystemSpecific(variantId, values);
if (!validation.valid) {
console.warn('FAT32 validation errors:', validation.errors);
}
const results = {};
this.calculateFAT32(values, results);
}
validateFilesystemSpecific(variantId, values) {
if (variantId !== 'fat32') return { valid: true, errors: [] };
const errors = [];
// Validate cluster number doesn't exceed total clusters
if (values.clusterNumber32 !== undefined && values.clusterNumber32 < 2) {
errors.push('clusterNumber32: Cluster-Nummer muss >= 2 sein');
}
// Validate partition size is greater than reserved + FAT areas
if (values.partitionSizeInSectors32 !== undefined && values.reservedSectors32 !== undefined && values.numFATs32 !== undefined && values.fatSizeSectors32 !== undefined) {
const minPartitionSize = values.reservedSectors32 + (values.numFATs32 * values.fatSizeSectors32) + 1;
if (values.partitionSizeInSectors32 < minPartitionSize) {
errors.push(`partitionSizeInSectors32: ${values.partitionSizeInSectors32} < minimum ${minPartitionSize}`);
}
}
return {
valid: errors.length === 0,
errors: errors
};
}
constructor() {
super('FAT32', [
{