Class AchievementStorefrontSnapshotJson
Encodes and decodes an AchievementStorefrontSnapshot as JSON, in the same
hand-rolled idiom StructuredWireJson uses for the structured-store wire DTOs: a
StringBuilder plus JsonStringEscaper for writing, JsonValue
for reading. Nothing here touches Unity — this is the wire/file shape a
IAchievementDefinitionSyncConnector
reads and writes, and doubles as a permanent, headless-testable import/export format independent of
which storefront (or file) a snapshot came from.
Inherited Members
Namespace: Serenity.Achievements.Application.Sync
Assembly: Serenity.Achievements.Application.dll
Syntax
public static class AchievementStorefrontSnapshotJson
Methods
ToJson(AchievementStorefrontSnapshot)
Serializes a snapshot to JSON.
Declaration
public static string ToJson(AchievementStorefrontSnapshot snapshot)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementStorefrontSnapshot | snapshot | The snapshot to serialize. |
Returns
| Type | Description |
|---|---|
| string | The JSON text. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | When no snapshot was given. |
TryFromJson(string, out AchievementStorefrontSnapshot, out string)
Deserializes a snapshot previously written by ToJson(AchievementStorefrontSnapshot).
Declaration
public static bool TryFromJson(string json, out AchievementStorefrontSnapshot snapshot, out string error)
Parameters
| Type | Name | Description |
|---|---|---|
| string | json | The JSON text to parse. |
| AchievementStorefrontSnapshot | snapshot | The parsed snapshot, or null on failure. |
| string | error | Why parsing failed, or empty on success. |
Returns
| Type | Description |
|---|---|
| bool | True when the JSON was a valid snapshot. |