2017-04-12 18:49:58 +02:00
|
|
|
|
namespace SweetLib.Classes.Storer
|
|
|
|
|
{
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface, which provides several methods to store simple data.
|
|
|
|
|
/// </summary>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
public interface IStorer
|
|
|
|
|
{
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reads a string value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section in which the data is stored.</param>
|
|
|
|
|
/// <param name="key">Represents the key of the stored data.</param>
|
|
|
|
|
/// <param name="defaultValue">Default value, if this value does not exist.</param>
|
|
|
|
|
/// <returns>Value of the <see cref="key"/> in <see cref="section"/>.</returns>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
string ReadString(string section, string key, string defaultValue = "");
|
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reads an integer value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section in which the data is stored.</param>
|
|
|
|
|
/// <param name="key">Represents the key of the stored data.</param>
|
|
|
|
|
/// <param name="defaultValue">Default value, if this value does not exist.</param>
|
|
|
|
|
/// <returns>Value of the <see cref="key"/> in <see cref="section"/>.</returns>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
int ReadInteger(string section, string key, int defaultValue = 0);
|
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reads a bool value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section in which the data is stored.</param>
|
|
|
|
|
/// <param name="key">Represents the key of the stored data.</param>
|
|
|
|
|
/// <param name="defaultValue">Default value, if this value does not exist.</param>
|
|
|
|
|
/// <returns>Value of the <see cref="key"/> in <see cref="section"/>.</returns>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
bool ReadBool(string section, string key, bool defaultValue = false);
|
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Checks, if a key exists inside a section.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section in which the data is stored.</param>
|
|
|
|
|
/// <param name="key">Represents the key of the stored data.</param>
|
|
|
|
|
/// <returns>True, if <see cref="key"/> is found inside <see cref="section"/>.</returns>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
bool HasKey(string section, string key);
|
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Writes a string value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section in which the data is stored.</param>
|
|
|
|
|
/// <param name="key">Represents the key of the stored data.</param>
|
|
|
|
|
/// <param name="value">Value to be stored.</param>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
void WriteString(string section, string key, string value);
|
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Writes an integer value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section in which the data is stored.</param>
|
|
|
|
|
/// <param name="key">Represents the key of the stored data.</param>
|
|
|
|
|
/// <param name="value">Value to be stored.</param>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
void WriteInteger(string section, string key, int value);
|
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Writes a bool value.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section in which the data is stored.</param>
|
|
|
|
|
/// <param name="key">Represents the key of the stored data.</param>
|
|
|
|
|
/// <param name="value">Value to be stored.</param>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
void WriteBool(string section, string key, bool value);
|
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Deletes a key inside a <see cref="section"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section in which the data is stored.</param>
|
|
|
|
|
/// <param name="key">Represents the key to be deleted.</param>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
void DeleteKey(string section, string key);
|
|
|
|
|
|
2017-04-16 18:07:30 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Deletes a section with all its keys.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="section">Represents the section to be deleted.</param>
|
2017-04-12 18:49:58 +02:00
|
|
|
|
void DeleteSection(string section);
|
|
|
|
|
}
|
|
|
|
|
}
|