SweetLib/SweetLib.Old/Classes/Storer/IStorer.cs

81 lines
3.7 KiB
C#
Raw Normal View History

namespace SweetLib.Classes.Storer
{
2017-04-16 18:07:30 +02:00
/// <summary>
/// Interface, which provides several methods to store simple data.
/// </summary>
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>
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>
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>
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>
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>
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>
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>
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>
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>
void DeleteSection(string section);
}
}