Class AchievementManifestExporter
Turns the achievements a project authored into the manifest a storefront's bulk importer reads, or into a complete JSON dump for a pipeline that wants every field.
Inherited Members
Namespace: Serenity.Achievements.Application.Authoring
Assembly: Serenity.Achievements.Application.dll
Syntax
public static class AchievementManifestExporter
Remarks
Engine-free on purpose: the text this produces is the deliverable an author uploads, so it has to be assertable character for character in a headless test rather than eyeballed in a window. The Studio's table builds the rows from its assets and this decides what the file says.
Three promises make that assertable. Rows come out ordered by id (ordinal, ties keeping the order they arrived in), every number and boolean is written in the invariant culture, and every line ends with a single LF — including the last. LF rather than CRLF because the file is read by importers and by git far more often than by Notepad, and a manifest whose diff depends on which machine exported it is a manifest nobody can review.
The name and description columns carry Serenity's keys, not localized text. Steam, Xbox and Epic all expect display strings in their own portals; a project using the Localization module has no display string here to give them, only the key the runtime resolves. Mapping keys to strings belongs to whoever owns the translations, so this exports the key and says so in the column name.
JSON escaping comes from JsonStringEscaper rather than a second copy written here.
Serenity.StructuredPersistence.Json is a zero-reference, engine-free assembly of pure string
handling, so referencing it from Application drags nothing behind it and buys the one RFC 8259 escaping
rule already proven by the persistence suite. The same assembly's JsonObjectWriter.WriteQuotedLong
is why progressTarget is written as a quoted digit string rather than a bare number.
Fields
EmptyJson
The whole text of a JSON manifest carrying no achievements.
Declaration
public const string EmptyJson = "[]"
Field Value
| Type | Description |
|---|---|
| string |
EpicHeader
The column header row of an Epic manifest.
Declaration
public const string EpicHeader = "achievement_id,name_key,description_key,hidden,progress_target"
Field Value
| Type | Description |
|---|---|
| string |
LineEnding
The line ending every manifest this writes uses, including after the last line.
Declaration
public const string LineEnding = "\n"
Field Value
| Type | Description |
|---|---|
| string |
PlayStationHeader
The column header row of a PlayStation manifest.
Declaration
public const string PlayStationHeader = "trophy_id,grade,name_key,description_key,hidden"
Field Value
| Type | Description |
|---|---|
| string |
SteamHeader
The column header row of a Steam manifest.
Declaration
public const string SteamHeader = "api_name,display_name_key,description_key,hidden,progress_target"
Field Value
| Type | Description |
|---|---|
| string |
XboxHeader
The column header row of an Xbox manifest.
Declaration
public const string XboxHeader = "achievement_id,name_key,description_key,gamerscore,hidden,progress_target"
Field Value
| Type | Description |
|---|---|
| string |
Methods
Export(IReadOnlyList<AchievementManifestRow>, AchievementManifestFormat)
Exports every achievement the format accepts, and names the ones it does not.
Declaration
public static AchievementManifestExportReport Export(IReadOnlyList<AchievementManifestRow> rows, AchievementManifestFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementManifestRow> | rows | The achievements to export. May be null and may contain null. |
| AchievementManifestFormat | format | The manifest shape to write. |
Returns
| Type | Description |
|---|---|
| AchievementManifestExportReport | The text, the count, and what was left out. |
Remarks
Three things keep an achievement out of a manifest, checked in this order because that is the order an author has to fix them in: the authoring rules reject it, it names no identifier for this storefront, or it is bound for PlayStation with no trophy tier. Every one of them is reported by id and reason — writing the row anyway would produce a sheet the importer rejects line by line with no reason an author can act on.
FileExtensionOf(AchievementManifestFormat)
The file extension a manifest of this shape is saved under.
Declaration
public static string FileExtensionOf(AchievementManifestFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementManifestFormat | format | The manifest shape. |
Returns
| Type | Description |
|---|---|
| string | The extension, without a leading dot. |
PlatformOf(AchievementManifestFormat)
The storefront a per-storefront manifest is keyed by.
Declaration
public static AchievementPlatformKind PlatformOf(AchievementManifestFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementManifestFormat | format | The manifest shape. |
Returns
| Type | Description |
|---|---|
| AchievementPlatformKind | The storefront. GenericJson answers PlayStation, which no caller reads: JSON is keyed by nothing and never asks. |