Class ConfigFormatFactory
- Namespace
- KernSmith
- Assembly
- KernSmith.dll
Dispatches config read/write operations to the correct format implementation.
ReadConfig(string) auto-detects the format by inspecting the file CONTENT,
falling back to the extension only when the content is inconclusive.
WriteConfig(BmfcConfig, string) selects by extension (.hiero selects Hiero;
any other extension, including none, selects BMFont).
public static class ConfigFormatFactory
- Inheritance
-
ConfigFormatFactory
- Inherited Members
Methods
ReadConfig(string)
Reads a config file, auto-detecting the format from its CONTENT. A definitive or
majority Hiero signal selects the Hiero format; a majority BMFont signal selects BMFont.
When the content is inconclusive, the extension is used as a tiebreaker: .hiero
selects Hiero and any other extension (including none) selects BMFont. This means a
mistyped or mismatched extension is still parsed according to the actual file contents.
public static BmfcConfig ReadConfig(string filePath)
Parameters
filePathstringPath to a config file.
Returns
- BmfcConfig
A BmfcConfig containing parsed options and font source info.
Exceptions
- FileNotFoundException
Thrown when
filePathdoes not exist.
WriteConfig(BmfcConfig, string)
Writes a config file, auto-detecting the format from its extension. The .hiero
extension selects the Hiero format; any other extension (including none) is written as BMFont.
public static void WriteConfig(BmfcConfig config, string filePath)
Parameters
configBmfcConfigThe configuration to serialize.
filePathstringPath to the destination file.