namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip.Import;
///
/// Abstraction over an L5K text source so the parser can consume strings, files, or streams
/// without coupling to . Implementations return the full text in a
/// single call — L5K files are typically <10 MB even for large controllers, and the parser
/// needs random access to handle nested DATATYPE/TAG blocks regardless.
///
public interface IL5kSource
{
/// Reads the full L5K body as a string.
string ReadAll();
}
/// String-backed source — used by tests + when the L5K body is loaded elsewhere.
public sealed class StringL5kSource : IL5kSource
{
private readonly string _text;
public StringL5kSource(string text) => _text = text ?? throw new ArgumentNullException(nameof(text));
public string ReadAll() => _text;
}
/// File-backed source — used by Admin / driver init to load *.L5K exports.
public sealed class FileL5kSource : IL5kSource
{
private readonly string _path;
public FileL5kSource(string path) => _path = path ?? throw new ArgumentNullException(nameof(path));
public string ReadAll() => System.IO.File.ReadAllText(_path);
}