2026-05-16 18:14:41 -05:00
|
|
|
using System.IO;
|
2025-05-13 00:52:19 +02:00
|
|
|
using System.Text;
|
2026-05-16 18:14:41 -05:00
|
|
|
using LANCommander.SDK.Parsers.Ini;
|
2025-05-13 00:52:19 +02:00
|
|
|
|
|
|
|
|
namespace LANCommander.SDK.Helpers
|
|
|
|
|
{
|
|
|
|
|
public static class IniHelper
|
|
|
|
|
{
|
2026-05-16 18:14:41 -05:00
|
|
|
public static readonly IniParseOptions DefaultOptions = new();
|
2025-05-13 00:52:19 +02:00
|
|
|
|
2026-05-16 18:14:41 -05:00
|
|
|
public static IniDocument FromString(string iniFileContent)
|
2025-05-13 00:52:19 +02:00
|
|
|
{
|
2026-05-16 18:14:41 -05:00
|
|
|
return IniParser.Parse(iniFileContent, DefaultOptions);
|
2025-05-13 00:52:19 +02:00
|
|
|
}
|
|
|
|
|
|
2026-05-16 18:14:41 -05:00
|
|
|
public static IniDocument FromString(string iniFileContent, IniParseOptions options)
|
2025-05-13 00:52:19 +02:00
|
|
|
{
|
2026-05-16 18:14:41 -05:00
|
|
|
return IniParser.Parse(iniFileContent, options);
|
2025-05-13 00:52:19 +02:00
|
|
|
}
|
|
|
|
|
|
2026-05-16 18:14:41 -05:00
|
|
|
public static string ToString(IniDocument document)
|
2025-05-13 00:52:19 +02:00
|
|
|
{
|
2026-05-16 18:14:41 -05:00
|
|
|
return document.Serialize();
|
2025-05-13 00:52:19 +02:00
|
|
|
}
|
|
|
|
|
|
2026-05-16 18:14:41 -05:00
|
|
|
public static string ToString(IniDocument document, Encoding encoding)
|
2025-05-13 00:52:19 +02:00
|
|
|
{
|
2026-05-16 18:14:41 -05:00
|
|
|
return document.Serialize();
|
2025-05-13 00:52:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|