Class CheckpointsSection
ISaveSection holding every checkpoint payload for the owning save slot: a map of caller-chosen checkpoint key to opaque byte payload, encoded as a JSON object of checkpoint key to base64 string.
Implements
Inherited Members
Namespace: Serenity.GameSave.Domain.Sections
Assembly: Serenity.GameSave.Domain.dll
Syntax
public sealed class CheckpointsSection : ISaveSection
Remarks
This section treats checkpoint keys and payloads as opaque, deliberately mirroring
Serenity.Checkpoint.Application.Interfaces.ICheckpointStore's own black-box contract —
it has no dependency on the Checkpoint aggregate. A caller composing the two together (see
Serenity.GameSave.Infrastructure.Stores.ActiveSlotKeyValueStore) supplies checkpoint
slot names (e.g. CheckpointSlot.ToString()) as the checkpoint key.
Constructors
CheckpointsSection()
Declaration
public CheckpointsSection()
Properties
CheckpointKeys
Every checkpoint key currently held, in first-write order.
Declaration
public IReadOnlyList<string> CheckpointKeys { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
SectionKey
The stable key this section is stored under within a SaveDocument.
Declaration
public string SectionKey { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Deserialize(string)
Restores every checkpoint payload from payload. A null or empty
payload resets this section to holding no checkpoints.
Declaration
public void Deserialize(string payload)
Parameters
| Type | Name | Description |
|---|---|---|
| string | payload |
HasPayload(string)
Checks whether a payload is stored under checkpointKey.
Declaration
public bool HasPayload(string checkpointKey)
Parameters
| Type | Name | Description |
|---|---|---|
| string | checkpointKey |
Returns
| Type | Description |
|---|---|
| bool |
RemovePayload(string)
Removes the payload stored under checkpointKey. A missing key is a no-op.
Declaration
public bool RemovePayload(string checkpointKey)
Parameters
| Type | Name | Description |
|---|---|---|
| string | checkpointKey |
Returns
| Type | Description |
|---|---|
| bool |
|
Serialize()
Serializes this section's current state to JSON.
Declaration
public string Serialize()
Returns
| Type | Description |
|---|---|
| string |
SetPayload(string, byte[])
Sets the payload stored under checkpointKey, appending it to
CheckpointKeys the first time this key is set.
Declaration
public void SetPayload(string checkpointKey, byte[] payload)
Parameters
| Type | Name | Description |
|---|---|---|
| string | checkpointKey | |
| byte[] | payload |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
TryGetPayload(string, out byte[])
Gets the payload stored under checkpointKey, if any.
Declaration
public bool TryGetPayload(string checkpointKey, out byte[] payload)
Parameters
| Type | Name | Description |
|---|---|---|
| string | checkpointKey | |
| byte[] | payload |
Returns
| Type | Description |
|---|---|
| bool |