feat: file metadata
This commit is contained in:
@@ -178,22 +178,7 @@ namespace CarManagerV3
|
||||
try
|
||||
{
|
||||
string[] parts = csv.Split(';');
|
||||
// is part 7 a valid int? if not set it to 0 and log a warning.
|
||||
if (parts.Length == 7)
|
||||
{
|
||||
Console.Error.WriteLine($"Warning: CSV string has only 7 fields, expected 8. Setting Order to 0. CSV: {csv}");
|
||||
if (!StateManager.askForMigration())
|
||||
{
|
||||
throw new Exception("User declined migration. Cannot parse CSV string with missing Order field.");
|
||||
}
|
||||
Array.Resize(ref parts, 8);
|
||||
parts[7] = "0";
|
||||
}
|
||||
else if (parts.Length != 8)
|
||||
{
|
||||
throw new FormatException($"CSV string has {parts.Length} fields, expected 8. CSV: {csv}");
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.WriteLine(csv);
|
||||
Car temp = new Car(parts[0], parts[1], parts[2], int.Parse(parts[3]), parts[4], int.Parse(parts[5]), decimal.Parse(parts[6]), int.Parse(parts[7]));
|
||||
return temp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user