Table of Contents

Class SaveSlotInfo

Namespace
KeenEyes.Serialization
Assembly
KeenEyes.Core.dll

Represents metadata about a save slot, including display information and save state.

public sealed record SaveSlotInfo : IEquatable<SaveSlotInfo>
Inheritance
SaveSlotInfo
Implements
Inherited Members

Examples

// Create save slot info when saving
var slotInfo = new SaveSlotInfo
{
    SlotName = "slot1",
    DisplayName = "Chapter 3 - The Forest",
    CreatedAt = DateTimeOffset.UtcNow,
    ModifiedAt = DateTimeOffset.UtcNow,
    PlayTime = TimeSpan.FromHours(2.5),
    CustomMetadata = new Dictionary<string, object>
    {
        ["level"] = 15,
        ["location"] = "Dark Forest"
    }
};

Remarks

SaveSlotInfo contains all the information needed to display save slots in a UI without loading the full world snapshot. This includes timestamps, display names, play time, thumbnails, and custom metadata.

Save slot info is stored separately from the world data in the .ksave container, allowing quick enumeration of available saves without parsing the full snapshot.

Properties

AppVersion

Gets or sets the version of the application that created this save.

public string? AppVersion { get; init; }

Property Value

string

Remarks

Useful for detecting saves from older versions and applying migrations. Format is application-defined (e.g., "1.0.0", "2024.1", "build-1234").

Checksum

Gets the SHA256 checksum of the save data for integrity validation.

public string? Checksum { get; init; }

Property Value

string

Remarks

The checksum is computed over the compressed data bytes and stored as a lowercase hexadecimal string (64 characters).

Used to detect save file corruption. If null, no checksum was computed.

CompressedSize

Gets the size of the compressed save data in bytes.

public long CompressedSize { get; init; }

Property Value

long

Remarks

This is the actual file size after compression. Useful for displaying save slot sizes in UI and estimating storage requirements.

Compression

Gets the compression mode used for the save data.

public CompressionMode Compression { get; init; }

Property Value

CompressionMode

CreatedAt

Gets the timestamp when this save slot was first created.

public required DateTimeOffset CreatedAt { get; init; }

Property Value

DateTimeOffset

Remarks

Stored as UTC time for consistency across time zones.

CustomMetadata

Gets custom application-specific metadata.

public IReadOnlyDictionary<string, object>? CustomMetadata { get; init; }

Property Value

IReadOnlyDictionary<string, object>

Remarks

Use this to store game-specific information such as:

  • Player level, health, score
  • Current location or chapter
  • Difficulty setting
  • Completion percentage

Values must be JSON-serializable types (strings, numbers, booleans, or nested dictionaries/arrays of these types).

DisplayName

Gets the human-readable display name for this save slot.

public string? DisplayName { get; init; }

Property Value

string

Remarks

This is the name shown to players in save/load UI. Can contain any characters including spaces, punctuation, and Unicode.

If null, the SlotName should be used for display.

EntityCount

Gets the number of entities in the saved world.

public int EntityCount { get; init; }

Property Value

int

Remarks

Extracted from the snapshot for quick display without full deserialization.

Format

Gets the format used to serialize the world snapshot.

public SaveFormat Format { get; init; }

Property Value

SaveFormat

FormatVersion

Gets the version of the save file format.

public int FormatVersion { get; init; }

Property Value

int

Remarks

Used for backwards compatibility when the save format changes. Current version is 1.

IsValid

Gets whether this save file is currently valid and loadable.

[JsonIgnore]
public bool IsValid { get; }

Property Value

bool

Remarks

A save may be invalid if:

  • The file is corrupted (checksum mismatch)
  • The format version is unsupported
  • Required components are missing

ModifiedAt

Gets the timestamp when this save slot was last modified.

public required DateTimeOffset ModifiedAt { get; init; }

Property Value

DateTimeOffset

Remarks

Updated each time the save is overwritten. For a new save, this equals CreatedAt.

Stored as UTC time for consistency across time zones.

PlayTime

Gets the total play time accumulated in this save.

public TimeSpan PlayTime { get; init; }

Property Value

TimeSpan

Remarks

This is typically tracked by the application and passed when saving. It represents the total time spent playing in this save file.

A value of Zero indicates play time is not tracked.

SaveCount

Gets the number of times this slot has been saved to.

public int SaveCount { get; init; }

Property Value

int

Remarks

Incremented each time the save is overwritten. Starts at 1.

SlotName

Gets the unique identifier for this save slot.

public required string SlotName { get; init; }

Property Value

string

Remarks

The slot name is used as the filename (without extension) and must be a valid filename on all target platforms. Recommended to use lowercase alphanumeric characters, numbers, and underscores only.

Examples: "slot1", "autosave", "quicksave", "chapter3_checkpoint"

ThumbnailBase64

Gets the thumbnail image data as a base64-encoded string.

public string? ThumbnailBase64 { get; init; }

Property Value

string

Remarks

Thumbnails are typically PNG or JPEG images captured at save time. The image data is base64-encoded for JSON compatibility.

Recommended dimensions: 320x180 (16:9) or 256x256 (1:1). Maximum recommended size: 64KB after encoding.

If null, no thumbnail is available.

ThumbnailMimeType

Gets the MIME type of the thumbnail image.

public string? ThumbnailMimeType { get; init; }

Property Value

string

Remarks

Common values: "image/png", "image/jpeg". If null, the MIME type should be inferred from the image data.

UncompressedSize

Gets the size of the uncompressed save data in bytes.

public long UncompressedSize { get; init; }

Property Value

long

Remarks

This is the size before compression. The ratio of CompressedSize to UncompressedSize indicates the compression efficiency.

ValidationError

Gets the validation error message if the save is invalid.

public string? ValidationError { get; init; }

Property Value

string

Remarks

Null if the save is valid. Contains a human-readable error message if validation failed.