Table of Contents

Interface IPatchServerService

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Contract for version lookups and patch binary downloads. All methods use a single API host URL (NGINX routes by path to the correct backend).

public interface IPatchServerService

Methods

DownloadPatch(string, string, string, long, Action<bool>, Action<string>, Action<DownloadStats>)

Asynchronously downloads a patch file from the server. When expectedSha256 is provided, the downloaded file is hashed after download and the operation fails (with onError) if the digest does not match.

IEnumerator DownloadPatch(string patchUrl, string destinationFilePath, string expectedSha256, long expectedTotalBytes, Action<bool> onComplete, Action<string> onError, Action<DownloadStats> onProgress)

Parameters

patchUrl string

The full URL of the patch file to download.

destinationFilePath string

Full path (including file name) the patch archive is written to. Parent directories are created if missing.

expectedSha256 string

Lowercase hex SHA-256 the downloaded file must match, or null/empty to skip verification.

expectedTotalBytes long

Total size the download is expected to be, from the version manifest's Size, or 0 when the server did not report one.

onComplete Action<bool>

Callback invoked upon successful download (and verification, if requested). The argument is true when a patch archive was written to destinationFilePath, and false when the server reported the client is already up to date and there is nothing to apply.

onError Action<string>

Callback invoked with an error message upon failure.

onProgress Action<DownloadStats>

Callback invoked periodically with a DownloadStats snapshot.

Returns

IEnumerator

An IEnumerator for use in a Unity Coroutine.

Remarks

The expected size is passed in rather than read from the response so the caller can display a total before the first byte arrives, and so a truncated or chunked response cannot change what the player was told the download would be.

GetLatestVersion(string, string, Action<VersionConfig, PatchInfo>, Action<string>)

Asynchronously retrieves the latest client version from the API gateway. When clientVersion is non-empty, the server may also return patch metadata (SHA-256, size, availability) for that specific client version.

IEnumerator GetLatestVersion(string apiHost, string clientVersion, Action<VersionConfig, PatchInfo> onComplete, Action<string> onError)

Parameters

apiHost string

The unified API host URL.

clientVersion string

The client's current version string, or null/empty to request only the latest version.

onComplete Action<VersionConfig, PatchInfo>

Callback invoked with the latest VersionConfig and per-version PatchInfo upon success.

onError Action<string>

Callback invoked with an error message upon failure.

Returns

IEnumerator

An IEnumerator for use in a Unity Coroutine.