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; UTF-8 fallback; 256 diagnostics; 4096-byte buffer).

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, you MUST set this — auto-detection will fail loud. For non-Unicode codepages, bring System.Text.Encoding.CodePages as a transitive dependency yourself.

<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 auto-detect is inconclusive. 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

ReadBufferSize

Initial read buffer size for stream/file inputs (must be ≥ 64). Default 4096.

public int ReadBufferSize { get; init; }

Property Value

int

Strictness

Strictness mode (default Tolerant).

public LrcStrictness Strictness { get; init; }

Property Value

LrcStrictness