Table of Contents

Class LrcParseOptions

Namespace
ModernLrc
Assembly
ModernLrc.dll

Configuration for a parse operation.

public sealed record LrcParseOptions : IEquatable<LrcParseOptions>
Inheritance
LrcParseOptions
Implements
Inherited Members

Examples

// Strict mode: throw on the first Error-severity diagnostic.
var strict = new LrcParseOptions { Strictness = LrcStrictness.Strict };

// Non-Unicode codepage: pass the encoding explicitly (statistical detection is out of scope).
var gbk = new LrcParseOptions { Encoding = Encoding.GetEncoding("GBK") };

// Suppress diagnostics entirely.
var quiet = new LrcParseOptions { MaxDiagnostics = 0 };

Properties

Default

Default options (Tolerant; Latin-1 fallback; 256 diagnostics).

public static LrcParseOptions Default { get; }

Property Value

LrcParseOptions

Encoding

Force the input encoding for byte/stream inputs. null = auto-detect (BOM → UTF-8 validation → fallback). If your file is non-UTF-8 and has no BOM, set this — otherwise FallbackEncoding is used and LRC0010 is reported. For legacy code pages such as Shift-JIS or GBK, call Encoding.RegisterProvider(CodePagesEncodingProvider.Instance) first.

<p>Note: a recognised BOM (UTF-8, UTF-16 LE, UTF-16 BE) takes precedence over this
property — matching <xref href="System.IO.StreamReader" data-throw-if-not-resolved="false"></xref>'s behaviour. Strip the BOM
from the byte array yourself if you need to force a different decoding.</p>
public Encoding? Encoding { get; init; }

Property Value

Encoding

FallbackEncoding

Used when there is no BOM and the bytes are not valid UTF-8. Default Latin1, which decodes every byte losslessly. null disables fallback (auto-detect failure throws).

public Encoding? FallbackEncoding { get; init; }

Property Value

Encoding

ImplausibleTimestampThreshold

Threshold above which a timestamp triggers LRC0070 (still parsed).

public TimeSpan ImplausibleTimestampThreshold { get; init; }

Property Value

TimeSpan

MaxDiagnostics

Cap on how many diagnostics will be emitted before LRC0099 is raised once and the rest are suppressed. Must be ≥ 0. Default 256.

public int MaxDiagnostics { get; init; }

Property Value

int

Strictness

Strictness mode (default Tolerant).

public LrcStrictness Strictness { get; init; }

Property Value

LrcStrictness