feat: reordering

This commit is contained in:
2026-03-02 15:33:56 +01:00
parent 48be020dc4
commit 272ed999d8
10 changed files with 119 additions and 34 deletions

View File

@@ -104,8 +104,9 @@ namespace CarManagerV3
}
MessageBox.Show($"Warning: {failedLines.Count} lines in the file could not be parsed and were skipped. Check the console for details.", "Parsing Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
cars = StateManager.normalizeOrders(cars);
cars = cars.OrderBy(c => c.Order).ToList();
if(isLegacy)
if (isLegacy)
{
SafeManager.SaveCars(path, cars);
}
@@ -213,6 +214,25 @@ namespace CarManagerV3
return paths;
}
/// <summary>
/// Gets the folder of the most recently opened file, or the users documents folder if no recent files.
/// </summary>
/// <returns></returns>
public static string getRecentFolder()
{
List<string> recentPaths = GetRecentPaths();
if (recentPaths.Count > 0)
{
string recentFile = recentPaths[0];
if (File.Exists(recentFile))
{
return Path.GetDirectoryName(recentFile);
}
}
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
}
}
}