Class MenuDefinitionScanner
The single set of rules for whether an authored menu will actually work: an id that is present and not
already taken by another menu, options that are present and each individually well-formed, and a
layout configuration whose numbers cannot silently produce nothing. Mirrors
Serenity.GameUi.Application.Validation.HudDefinitionScanner's shape: a nested MenuDefinitionScanner.Sections
vocabulary, a scan over the raw authored fields so a wizard can call it before an asset exists, and one
finding per rule violated rather than a single pass/fail.
Inherited Members
Namespace: Serenity.Menu.Application.Validation
Assembly: Serenity.Menu.Application.dll
Syntax
public static class MenuDefinitionScanner
Remarks
Engine-agnostic: it reads only IMenuSettingsDefinition and plain values, and takes an id-collision check as a caller-supplied delegate rather than touching the project directly. That is what lets the same rules run in the editor wizard, in a headless validator and in a pure unit test.
Duplicate-option-id detection is delegated to FindDuplicateOptionIds(IReadOnlyList<UiOption>) rather than reimplemented here — the same knowledge, already shared by the runtime safety check and the options-list inspector, would otherwise disagree the moment one of the three copies drifted.
Fields
OutputSection
Section name for a finding about where the asset is written rather than the menu itself.
Declaration
public const string OutputSection = "Output"
Field Value
| Type | Description |
|---|---|
| string |
Methods
Scan(IMenuSettingsDefinition, Func<string, bool>, IReadOnlyCollection<string>)
Scans a whole menu.
Declaration
public static IReadOnlyList<AuthoringIssue> Scan(IMenuSettingsDefinition menu, Func<string, bool> isIdTaken = null, IReadOnlyCollection<string> knownTransitionTargets = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IMenuSettingsDefinition | menu | The menu to scan. |
| Func<string, bool> | isIdTaken | Returns whether a candidate id already belongs to another menu; omit to scan without an id-collision check (the id is still required to be non-empty). |
| IReadOnlyCollection<string> | knownTransitionTargets | Every id a transition option may resolve to; omit to scan without checking transition targets, for a caller that cannot enumerate the views around this menu. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<AuthoringIssue> | Every finding, asset-level first, then one option at a time in list order. |