Table of Contents

Class NcLineSourceDependency

Namespace
Hi.NcParsers.Dependencys.SystemWired
Assembly
HiMech.dll

In-memory line source for NC “files” with no disk backing — inline NC-code plays whose FilePath is a command-title pseudo-path (e.g. “NC Code”). Control-flow re-segmentation (WHILE reverse jump, backward GOTO, M99 P{seq} caller re-entry — every LabelScanUtil scan) re-reads the host file by path; an inline play's pseudo-path never exists on disk, so without this source those jumps fall through (loops that do not loop) or error with a *FileNotFound diagnostic. RunNc(string, string) registers the play's raw lines under its pseudo-path before running; LabelScanUtil consults this source first and only falls back to disk.

Entries persist for the runner's lifetime, the latest registration of a path winning — deliberately NOT ISessionResettable: the session-reset sweep runs inside the first RunNcLines(string, IEnumerable<string>, MachiningSession, StepDiagnosticProgress, NcDiagnosticProgress, CancellationToken) of a fresh session, which would wipe the registration made moments earlier for that very play. A registered pseudo-path shadows an identically-named disk file during re-segmentation, so inline command titles should not mirror real project-relative NC paths.

public class NcLineSourceDependency : INcDependency, IMakeXmlSource
Inheritance
NcLineSourceDependency
Implements
Inherited Members
Extension Methods

Constructors

NcLineSourceDependency()

Initializes a new instance with no registered sources.

public NcLineSourceDependency()

Properties

XName

XML element name used to register this dependency with XFactory.

public static string XName { get; }

Property Value

string

Methods

Contains(string)

Whether path has a registered line source.

public bool Contains(string path)

Parameters

path string

Returns

bool

MakeXmlSource(string, string, bool)

Runtime-only dependency — registrations are per-play and not meaningful to persist; serialization writes only the empty element so the dependency survives an XML round-trip with the map implicitly empty.

public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)

Parameters

baseDirectory string
relFile string
exhibitionOnly bool

Returns

XElement

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

factory XFactory

Register(string, string[])

Registers (or overwrites) the line content served for path. No-op on a null/empty path or null lines.

public void Register(string path, string[] lines)

Parameters

path string
lines string[]

TryGetLines(string, out string[])

Gets the registered line content for path; returns whether a registration exists.

public bool TryGetLines(string path, out string[] lines)

Parameters

path string
lines string[]

Returns

bool