2026-03-18 16:13:02 -04:00
|
|
|
namespace SabreTools.Serialization.CrossModel
|
2023-09-08 16:54:07 -04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2025-09-26 15:48:36 -04:00
|
|
|
/// Defines how to convert between two model types
|
2023-09-08 16:54:07 -04:00
|
|
|
/// </summary>
|
2025-09-26 15:48:36 -04:00
|
|
|
public interface ICrossModel<TSource, TDest>
|
2023-09-08 16:54:07 -04:00
|
|
|
{
|
2026-01-25 20:07:59 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Enable outputting debug information
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Debug { get; set; }
|
|
|
|
|
|
2023-09-08 16:54:07 -04:00
|
|
|
/// <summary>
|
2025-09-26 15:28:53 -04:00
|
|
|
/// Deserialize a <typeparamref name="TDest"/> into <typeparamref name="TSource"/>
|
2023-09-08 16:54:07 -04:00
|
|
|
/// </summary>
|
2023-09-08 18:39:57 -04:00
|
|
|
/// <typeparam name="T">Type of object to deserialize to</typeparam>
|
|
|
|
|
/// <typeparam name="U">Type of object to deserialize from</typeparam>
|
2023-09-08 16:54:07 -04:00
|
|
|
/// <param name="obj">Object to deserialize from</param>
|
|
|
|
|
/// <returns>Filled object on success, null on error</returns>
|
2026-01-25 16:15:05 -05:00
|
|
|
public TSource? Deserialize(TDest? obj);
|
2023-09-08 18:39:57 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2025-09-26 15:28:53 -04:00
|
|
|
/// Serialize a <typeparamref name="TSource"/> into <typeparamref name="TDest"/>
|
2023-09-08 18:39:57 -04:00
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
|
|
|
|
/// <typeparam name="U">Type of object to serialize to</typeparam>
|
|
|
|
|
/// <param name="obj">Object to serialize from</param>
|
|
|
|
|
/// <returns>Filled object on success, null on error</returns>
|
2026-01-25 16:15:05 -05:00
|
|
|
public TDest? Serialize(TSource? obj);
|
2023-09-08 16:54:07 -04:00
|
|
|
}
|
2025-07-24 09:31:28 -04:00
|
|
|
}
|