Table of Contents

Class SaveSlotOptions

Namespace
KeenEyes.Serialization
Assembly
KeenEyes.Core.dll

Options for configuring save operations.

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

Examples

var options = new SaveSlotOptions
{
    Compression = CompressionMode.Brotli,
    CompressionLevel = CompressionLevel.SmallestSize,
    IncludeChecksum = true,
    DisplayName = "Autosave - Level 15"
};

Remarks

Use this to customize how saves are created, including compression, checksums, and metadata. Default values are optimized for most use cases.

Properties

AppVersion

Gets or sets the application version to store with this save.

public string? AppVersion { get; init; }

Property Value

string

Remarks

Format is application-defined (e.g., "1.0.0", "2024.1", "build-1234").

Compact

Gets options optimized for smallest file size.

public static SaveSlotOptions Compact { get; }

Property Value

SaveSlotOptions

Remarks

Uses binary format with Brotli compression at maximum level.

Compression

Gets or sets the compression mode.

public CompressionMode Compression { get; init; }

Property Value

CompressionMode

Remarks

Defaults to GZip for a good balance of speed and compression ratio.

CompressionLevel

Gets or sets the compression level when compression is enabled.

public CompressionLevel CompressionLevel { get; init; }

Property Value

CompressionLevel

Remarks

Higher compression levels result in smaller files but take longer to compress.

CustomMetadata

Gets or sets custom application-specific metadata.

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

Property Value

IReadOnlyDictionary<string, object>

Remarks

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

Debug

Gets options for human-readable save files (debugging).

public static SaveSlotOptions Debug { get; }

Property Value

SaveSlotOptions

Remarks

Uses JSON format with no compression. Files are larger but can be manually inspected and edited.

Default

Gets default options optimized for typical use cases.

public static SaveSlotOptions Default { get; }

Property Value

SaveSlotOptions

Remarks

Uses binary format with GZip compression and SHA256 checksums.

DisplayName

Gets or sets the human-readable display name for the save slot.

public string? DisplayName { get; init; }

Property Value

string

Remarks

If null, the slot name will be used for display.

Fast

Gets options optimized for fastest save/load performance.

public static SaveSlotOptions Fast { get; }

Property Value

SaveSlotOptions

Remarks

Uses binary format with fastest compression and no checksums.

Format

Gets or sets the serialization format.

public SaveFormat Format { get; init; }

Property Value

SaveFormat

Remarks

Defaults to Binary for optimal performance and size.

IncludeChecksum

Gets or sets whether to compute and store a SHA256 checksum.

public bool IncludeChecksum { get; init; }

Property Value

bool

Remarks

When enabled, a SHA256 hash is computed over the compressed data and stored in the save file. This allows detection of file corruption during load.

Defaults to true. Disable only if performance is critical and corruption detection is handled externally.

PlayTime

Gets or sets the accumulated play time to store with this save.

public TimeSpan PlayTime { get; init; }

Property Value

TimeSpan

ThumbnailData

Gets or sets the thumbnail image data as bytes.

public byte[]? ThumbnailData { get; init; }

Property Value

byte[]

Remarks

Should be PNG or JPEG image data. Will be base64-encoded when stored.

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

ThumbnailMimeType

Gets or sets the MIME type of the thumbnail image.

public string? ThumbnailMimeType { get; init; }

Property Value

string

Remarks

Common values: "image/png", "image/jpeg". Required if ThumbnailData is provided.