-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStringIniParser.cs
63 lines (58 loc) · 1.89 KB
/
StringIniParser.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using IniParser.Model;
using IniParser.Parser;
namespace IniParser
{
/// <summary>
/// Represents an INI data parser for strings.
///
/// </summary>
/// <remarks>
/// This class is deprecated and kept for backwards compatibility.
/// It's just a wrapper around <see cref="IniDataParser"/> class.
/// Please, replace your code.
/// </remarks>
[Obsolete("Use class IniDataParser instead. See remarks comments in this class.")]
public class StringIniParser
{
/// <summary>
/// This instance will handle ini data parsing and writing
/// </summary>
public IniDataParser Parser { get; protected set; }
/// <summary>
/// Ctor
/// </summary>
public StringIniParser() : this (new IniDataParser()) {}
/// <summary>
/// Ctor
/// </summary>
/// <param name="parser"></param>
public StringIniParser(IniDataParser parser)
{
Parser = parser;
}
/// <summary>
/// Parses a string containing data formatted as an INI file.
/// </summary>
/// <param name="dataStr">The string containing the data.</param>
/// <returns>
/// A new <see cref="IniData"/> instance with the data parsed from the string.
/// </returns>
public IniData ParseString(string dataStr)
{
return Parser.Parse(dataStr);
}
/// <summary>
/// Creates a string from the INI data.
/// </summary>
/// <param name="iniData">An <see cref="IniData"/> instance.</param>
/// <returns>
/// A formatted string with the contents of the
/// <see cref="IniData"/> instance object.
/// </returns>
public string WriteString(IniData iniData)
{
return iniData.ToString();
}
}
}