csharpcf25d736 | 1 | namespace CascadeIDE.Services.Presentation; |
| 2 | |
| 3 | /// <summary>Результат разбора <c>presentation</c>: список экранов, на каждом — упорядоченные якоря с опциональными весами.</summary> |
| 4 | public sealed class PresentationParseResult |
| 5 | { |
| 6 | private PresentationParseResult( |
| 7 | IReadOnlyList<IReadOnlyList<PresentationAnchorSlot>> screens, |
| 8 | string? error) |
| 9 | { |
| 10 | Screens = screens; |
| 11 | Error = error; |
| 12 | } |
| 13 | |
| 14 | public IReadOnlyList<IReadOnlyList<PresentationAnchorSlot>> Screens { get; } |
| 15 | |
| 16 | /// <summary>Не null при неуспехе; тогда <see cref="Screens"/> пустой.</summary> |
| 17 | public string? Error { get; } |
| 18 | |
| 19 | public bool IsSuccess => Error is null; |
| 20 | |
| 21 | public static PresentationParseResult Ok(IReadOnlyList<IReadOnlyList<PresentationAnchorSlot>> screens) => |
| 22 | new(screens, null); |
| 23 | |
| 24 | public static PresentationParseResult Fail(string message) => |
| 25 | new(Array.Empty<IReadOnlyList<PresentationAnchorSlot>>(), message); |
| 26 | } |
| 27 | |
View only · write via MCP/CIDE