Class NullAchievementScreenshotStore
The screenshot store installed when nothing can hold the bytes: it stores nothing and hands back no key, so the unlock record simply carries no screenshot.
Implements
Inherited Members
Namespace: Serenity.Achievements.Application.Services
Assembly: Serenity.Achievements.Application.dll
Syntax
public sealed class NullAchievementScreenshotStore : IAchievementScreenshotStore
Remarks
Pairs with NullAchievementScreenshotCapturer: the attachment collaborator requires both a capturer and a store, so a project with no capture support still needs a store instance to construct one. Keeps the unlock path free of null checks.
Constructors
NullAchievementScreenshotStore()
Declaration
public NullAchievementScreenshotStore()
Methods
DeleteAllAsync(PlayerId, CancellationToken)
Removes every screenshot stored for a player.
Declaration
public Task DeleteAllAsync(PlayerId player, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerId | player | The player to clear. |
| CancellationToken | cancellationToken | Token used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task |
SaveAsync(PlayerId, AchievementId, byte[], CancellationToken)
Stores the screenshot bytes for an unlock and returns the key to read them back by.
Declaration
public Task<string> SaveAsync(PlayerId player, AchievementId achievement, byte[] pngBytes, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| PlayerId | player | The player the unlock belongs to. |
| AchievementId | achievement | The achievement that was unlocked. |
| byte[] | pngBytes | The encoded PNG bytes to store. |
| CancellationToken | cancellationToken | Token used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<string> | The key the screenshot can be read back by, or null when nothing was stored. |