93 lines
3.6 KiB
C#
93 lines
3.6 KiB
C#
using System.Numerics;
|
|
|
|
namespace Voile.Resources.DataReaders
|
|
{
|
|
/// <summary>
|
|
/// Reads data from a specified stream.
|
|
/// </summary>
|
|
public interface IStreamDataReader
|
|
{
|
|
/// <summary>
|
|
/// Read data from a specified stream.
|
|
/// </summary>
|
|
/// <param name="data">Stream with data.</param>
|
|
void Read(Stream data);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Validates data integrity or schema.
|
|
/// </summary>
|
|
public interface IDataValidator
|
|
{
|
|
/// <summary>
|
|
/// Determines if data specified is valid and can be safely read.
|
|
/// </summary>
|
|
/// <returns>Returns true if data is valid.</returns>
|
|
bool Valid();
|
|
}
|
|
/// <summary>
|
|
/// Gets primitive type data from a key/value based format.
|
|
/// </summary>
|
|
public interface IStreamKeyValueGetter
|
|
{
|
|
/// <summary>
|
|
/// Get a boolean from this data getter.
|
|
/// </summary>
|
|
/// <param name="key">Key of the value.</param>
|
|
/// <param name="defaultValue">Default value in case this getter fails to get data.</param>
|
|
/// <returns></returns>
|
|
bool GetBool(string key, bool defaultValue = false);
|
|
/// <summary>
|
|
/// Get an int from this data getter.
|
|
/// </summary>
|
|
/// <param name="key">Key of the value.</param>
|
|
/// <param name="defaultValue">Default value in case this getter fails to get data.</param>
|
|
/// <returns></returns>
|
|
int GetInt(string key, int defaultValue = 0);
|
|
/// <summary>
|
|
/// Get a long from this data getter.
|
|
/// </summary>
|
|
/// <param name="key">Key of the value.</param>
|
|
/// <param name="defaultValue">Default value in case this getter fails to get data.</param>
|
|
/// <returns></returns>
|
|
long GetLong(string key, long defaultValue = 0);
|
|
/// <summary>
|
|
/// Get a float from this data getter.
|
|
/// </summary>
|
|
/// <param name="key">Key of the value.</param>
|
|
/// <param name="defaultValue">Default value in case this getter fails to get data.</param>
|
|
/// <returns></returns>
|
|
float GetFloat(string key, float defaultValue = 0.0f);
|
|
/// <summary>
|
|
/// Get a double from this data getter.
|
|
/// </summary>
|
|
/// <param name="key">Key of the value.</param>
|
|
/// <param name="defaultValue">Default value in case this getter fails to get data.</param>
|
|
/// <returns></returns>
|
|
double GetDouble(string key, double defaultValue = 0.0);
|
|
/// <summary>
|
|
/// Get a Voile.Color from this data getter.
|
|
/// </summary>
|
|
/// <param name="key">Key of the value.</param>
|
|
/// <param name="defaultValue">Default value in case this getter fails to get data.</param>
|
|
/// <returns></returns>
|
|
Color GetColor(string key, Color defaultValue);
|
|
/// <summary>
|
|
/// Get a System.Numerics.Vector2 from this data getter.
|
|
/// </summary>
|
|
/// <param name="key">Key of the value.</param>
|
|
/// <param name="defaultValue">Default value in case this getter fails to get data.</param>
|
|
/// <returns></returns>
|
|
Vector2 GetVector2(string key, Vector2 defaultValue);
|
|
|
|
/// <summary>
|
|
/// Get a <see cref="Size"/> from this data getter.
|
|
/// </summary>
|
|
/// <param name="key">Key of the value.</param>
|
|
/// <param name="defaultValue">Default value in case this getter fails to get data.</param>
|
|
/// <returns></returns>
|
|
Size GetSize(string key, Size defaultValue);
|
|
|
|
T[] GetArray<T>(string key, T[] defaultValue);
|
|
}
|
|
} |