mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-12-01 21:21:34 -05:00
refactor: share duplicated fill, cache, settings and toggle code
- fill_plate and fill_area share one MCP fill helper - FillLinear uses FillHelpers.HasOverlappingParts - BestFitCache and FillResultCache entries derive from DrawingCacheEntry - NestDefaults and ClampSettings read through SettingsFile.TryReadText - MainForm view toggles share one ToggleView handler Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4b61d249c0
commit
d77693aaff
10 files changed
+178
-217
No files matched your search
@@ -102,22 +102,11 @@ public sealed class NestDefaults
|
||||
out NestDefaultsStatus status
|
||||
)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
|
||||
// A file that exists but cannot be read (locked, access-denied)
|
||||
// must never block creating a nest.
|
||||
if (!SettingsFile.TryReadText(path, out var json, out var missing))
|
||||
{
|
||||
status = NestDefaultsStatus.Missing;
|
||||
return WithUnits(Fallback, fallbackUnits);
|
||||
}
|
||||
|
||||
string json;
|
||||
try
|
||||
{
|
||||
json = File.ReadAllText(path);
|
||||
}
|
||||
catch (Exception ex) when (SettingsFile.IsUnreadableFile(ex))
|
||||
{
|
||||
// A file that exists but cannot be read (locked, access-denied)
|
||||
// must never block creating a nest.
|
||||
status = NestDefaultsStatus.Invalid;
|
||||
status = missing ? NestDefaultsStatus.Missing : NestDefaultsStatus.Invalid;
|
||||
return WithUnits(Fallback, fallbackUnits);
|
||||
}
|
||||
return Parse(json, fallbackUnits, out status);
|
||||
|
||||
Reference in new issue
Block a user