Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Add SaveSerializable class - to be expanded upon later
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver-makes-code committed Dec 7, 2023
1 parent 461de28 commit 6dea261
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Common/Serialization/SaveSerializable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using PeterO.Cbor;

namespace Common.Serialization;

public abstract class SaveSerializable<T> {
public abstract void Load(T data);
public abstract T Save();

public CBORObject SaveToCbor()
=> CBORObject.FromObject(Save());
public void LoadFromCbor(CBORObject data)
=> Load(data.ToObject<T>());
}

0 comments on commit 6dea261

Please sign in to comment.