Class SnapshotSyntax
- Namespace
- Hi.NcParsers.InspectionSyntaxs
- Assembly
- HiMech.dll
Debug-time JsonObject capture: deep-clones every key on the current
JsonObject (except the
SnapshotKey envelope itself) into
json[SnapshotKey][SectionName],
leaving the rest of the block untouched.
Insertable at any position in NcSyntaxList — placement determines what stage the dump captures (e.g. drop after the Parsing bundle for "after-parsing", drop after the Logic bundle for "after-logic"). Two instances with different SectionName values can coexist on the same pipeline and their dumps end up under sibling keys of the same SnapshotKey envelope, so a single cache file shows the data at every captured stage in one place.
Excluding the SnapshotKey envelope from the clone keeps each captured section flat: it reflects "everything else on the block at that stage", and re-running through additional SnapshotSyntax instances never nests past one level.
Set IsEnabled = false to keep the configuration
in place but skip the capture (no JSON mutation, no allocation) —
convenient for toggling a debug pipeline without removing the entries.
public class SnapshotSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
SnapshotSyntax
- Implements
- Inherited Members
- Extension Methods
Constructors
SnapshotSyntax()
Creates a SnapshotSyntax with no SectionName set yet.
public SnapshotSyntax()
SnapshotSyntax(string)
Creates a SnapshotSyntax with the given SectionName.
public SnapshotSyntax(string sectionName)
Parameters
sectionNamestringSub-key under SnapshotKey for this instance's capture.
SnapshotSyntax(XElement)
Reconstructs a SnapshotSyntax from a project XML element previously produced by MakeXmlSource(string, string, bool).
public SnapshotSyntax(XElement src)
Parameters
srcXElementXML element carrying SectionName and IsEnabled; null is treated as defaults.
Fields
SnapshotKey
Top-level JSON envelope key under which captured sections are stored. Each SnapshotSyntax instance writes a sibling key (named by SectionName) inside this envelope.
public const string SnapshotKey = "Snapshot"
Field Value
Properties
IsEnabled
When false, Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress) is a no-op — keeps the
entry in the syntax list for easy toggling without re-editing
the project.
public bool IsEnabled { get; set; }
Property Value
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
SectionName
Sub-key inside the SnapshotKey envelope under which this instance writes its capture. Two instances configured with the same SectionName are last-writer-wins on a given block. Required: Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress) throws InvalidOperationException when this is null or empty (a misconfiguration the user should see, not a silent skip).
public string SectionName { get; set; }
Property Value
XName
XML element name for Generators registration.
public static string XName { get; }
Property Value
Methods
Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress)
Build syntax arrangement into the
syntaxPieceNode in-place.
public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList, NcDiagnosticProgress ncDiagnosticProgress)
Parameters
syntaxPieceNodeLazyLinkedListNode<SyntaxPiece>ncDependencyListList<INcDependency>ncDiagnosticProgressNcDiagnosticProgress
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory