|
|
@ -16,9 +16,9 @@ namespace Model
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// The data manager injected that know how to serialize the data.
|
|
|
|
/// The data manager injected that know how to serialize the data.
|
|
|
|
/// <br/><remarks><i>The setter is actually public for testing purpose. It will be private after.</i></remarks>
|
|
|
|
/// <br/><remarks><i>The setter is actually public for testing purpose. It will be private after.</i></remarks>
|
|
|
|
/// <br/>See: <see cref="IDataManager"/>
|
|
|
|
/// <br/>See: <see cref="IDataSerializer"/>
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public IDataManager Serializer { get; set; }
|
|
|
|
public IDataSerializer Serializer { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// The collection of all data. Each line of this dictionary has the type of the data as it key and the data for values.
|
|
|
|
/// The collection of all data. Each line of this dictionary has the type of the data as it key and the data for values.
|
|
|
@ -31,7 +31,7 @@ namespace Model
|
|
|
|
/// Constructor of the DataManager class. Take a IDataManager that will provide methods for the serialisation of the data.
|
|
|
|
/// Constructor of the DataManager class. Take a IDataManager that will provide methods for the serialisation of the data.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="dataMgr">The data manager that know how to serialize a file.</param>
|
|
|
|
/// <param name="dataMgr">The data manager that know how to serialize a file.</param>
|
|
|
|
public DataManager(IDataManager dataMgr)
|
|
|
|
public DataManager(IDataSerializer dataMgr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Serializer = dataMgr;
|
|
|
|
Serializer = dataMgr;
|
|
|
|
Data = Serializer.Load();
|
|
|
|
Data = Serializer.Load();
|
|
|
@ -41,21 +41,21 @@ namespace Model
|
|
|
|
#region Methods
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Reload the data. Useful to update new data written in the save file.
|
|
|
|
/// Reload the data. Useful to update new data written in the save file.
|
|
|
|
/// <br/>See: <see cref="IDataManager.Load"/>
|
|
|
|
/// <br/>See: <see cref="IDataSerializer.Load"/>
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public void Reload()
|
|
|
|
public void Reload()
|
|
|
|
=> Data = Serializer.Load();
|
|
|
|
=> Data = Serializer.Load();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Save the data. Call the Save method of the serializer.
|
|
|
|
/// Save the data. Call the Save method of the serializer.
|
|
|
|
/// <br/>See: <see cref="IDataManager.Save(Dictionary{string, List{object}})"/>
|
|
|
|
/// <br/>See: <see cref="IDataSerializer.Save(Dictionary{string, List{object}})"/>
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public void Save()
|
|
|
|
public void Save()
|
|
|
|
=> Serializer.Save(Data);
|
|
|
|
=> Serializer.Save(Data);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Import data from a file.
|
|
|
|
/// Import data from a file.
|
|
|
|
/// <br/>See: <see cref="IDataManager.Import{T}(string)"/>
|
|
|
|
/// <br/>See: <see cref="IDataSerializer.Import{T}(string)"/>
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="T">The type of data to import.</typeparam>
|
|
|
|
/// <typeparam name="T">The type of data to import.</typeparam>
|
|
|
|
/// <param name="pathOfTheFile">The path containing the name of the file created.</param>
|
|
|
|
/// <param name="pathOfTheFile">The path containing the name of the file created.</param>
|
|
|
@ -68,7 +68,7 @@ namespace Model
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Export the data from the collection of data.
|
|
|
|
/// Export the data from the collection of data.
|
|
|
|
/// <br/>See: <see cref="IDataManager.Export{T}(T, string)"/>
|
|
|
|
/// <br/>See: <see cref="IDataSerializer.Export{T}(T, string)"/>
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="T">The type of data to export</typeparam>
|
|
|
|
/// <typeparam name="T">The type of data to export</typeparam>
|
|
|
|
/// <param name="obj">The object to export</param>
|
|
|
|
/// <param name="obj">The object to export</param>
|
|
|
|