logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class SaveDocument

    The full contents of a single game-save slot: promoted, queryable metadata (label, save timestamp, playtime, completion) plus an ordered map of section key to that section's own serialized JSON payload.

    Inheritance
    object
    SaveDocument
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    Namespace: Serenity.GameSave.Domain.ValueObjects
    Assembly: Serenity.GameSave.Domain.dll
    Syntax
    public sealed class SaveDocument
    Remarks

    Metadata is immutable; the section payload map is mutated through SetSectionPayload(string, string), which preserves first-registration order so payload encoding stays deterministic.

    Constructors

    SaveDocument(string, long, double, double)

    Creates a new SaveDocument with no section payloads yet.

    Declaration
    public SaveDocument(string label, long savedAtUtcTicks, double playtimeSeconds, double completionPercent)
    Parameters
    Type Name Description
    string label

    The save's display label.

    long savedAtUtcTicks

    The UTC timestamp (in ticks) at which this save was last written.

    double playtimeSeconds

    The accumulated playtime, in seconds, at the time of the save.

    double completionPercent

    The completion percentage (0-100) at the time of the save.

    Properties

    CompletionPercent

    The completion percentage (0-100) at the time of the save.

    Declaration
    public double CompletionPercent { get; }
    Property Value
    Type Description
    double

    Label

    The save's display label.

    Declaration
    public string Label { get; }
    Property Value
    Type Description
    string

    PlaytimeSeconds

    The accumulated playtime, in seconds, at the time of the save.

    Declaration
    public double PlaytimeSeconds { get; }
    Property Value
    Type Description
    double

    SavedAtUtcTicks

    The UTC timestamp (in ticks) at which this save was last written.

    Declaration
    public long SavedAtUtcTicks { get; }
    Property Value
    Type Description
    long

    SectionKeys

    Every registered section key, in first-registration order.

    Declaration
    public IReadOnlyList<string> SectionKeys { get; }
    Property Value
    Type Description
    IReadOnlyList<string>

    Methods

    GetSectionPayload(string)

    Gets the raw JSON payload registered for sectionKey, or null when none is set.

    Declaration
    public string GetSectionPayload(string sectionKey)
    Parameters
    Type Name Description
    string sectionKey
    Returns
    Type Description
    string

    SetSectionPayload(string, string)

    Sets the raw JSON payload for sectionKey, appending it to SectionKeys the first time this key is set.

    Declaration
    public void SetSectionPayload(string sectionKey, string jsonPayload)
    Parameters
    Type Name Description
    string sectionKey
    string jsonPayload
    Exceptions
    Type Condition
    ArgumentException

    Thrown when sectionKey is null or empty.

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()
    In this article
    © 2026 Serenity. All Rights Reserved