Table of Contents

Class AppInitParams

Namespace
VpnHood.AppLib.App
Assembly
VpnHood.AppLib.App.dll

Provides what a head hands its platform's Init, the same on every platform: who the app is, where the platform keeps its files, and how to build its options once the platform has said where things are.

public class AppInitParams
Inheritance
AppInitParams
Derived
Inherited Members

Remarks

The platform settles the context from it (AppOptionsContext), calls the head's factory, fills in its own defaults for what the head left unset, and makes the app; a desktop platform takes its single-instance lock first. A platform that needs more takes a derived class.

Properties

AppId

Gets the app's ID on the device, which the options carry, a desktop platform takes its single-instance lock on, and a Linux tunnel is tagged with.

public required string AppId { get; init; }

Property Value

string

AppName

Gets the name people see, which the options carry, and which a desktop host names its service and its messages with in the processes that build no options.

public required string AppName { get; init; }

Property Value

string

AppOptionsFactory

Gets the head's options factory, which the platform calls once, in the process that runs the app, after it has settled the context.

public required Func<AppOptionsContext, AppOptions> AppOptionsFactory { get; init; }

Property Value

Func<AppOptionsContext, AppOptions>

AppVersion

Gets the app's own version, beside its name, not the library's, which the options carry.

public required Version AppVersion { get; init; }

Property Value

Version

StorageFolderName

Gets the name of the app's folder under the platform's own place for app data, and of its device-only counterpart (ResolveNoBackupStoragePath(string)), or null where a host lays its storage out itself, as the Linux service does.

public string? StorageFolderName { get; init; }

Property Value

string

Remarks

Required on Android and iOS, whose platforms name the folders; the desktop platforms lay their storage out themselves and do not read it. Never change it for a head that has shipped: a new name is an empty folder, and every setting and profile stays behind in the old one.

Methods

ResolveNoBackupStoragePath(string)

Returns the app's device-only folder (NoBackupStoragePath): the same name, under the folder the platform keeps out of backups.

public string ResolveNoBackupStoragePath(string noBackupFolderPath)

Parameters

noBackupFolderPath string

The platform's folder that is kept out of backups.

Returns

string

The folder's path, StorageFolderName in noBackupFolderPath.

Exceptions

InvalidOperationException

StorageFolderName is null.

ResolveStoragePath()

Returns the app's folder under the system's local app data: %LOCALAPPDATA% on Windows, the app's files folder on Android, Documents on iOS.

public string ResolveStoragePath()

Returns

string

The folder's path, StorageFolderName in the local app data.

Exceptions

InvalidOperationException

The system has no local app data folder, or StorageFolderName is null.