Table of Contents

Class ApplicationExtensions

Namespace
CarinaStudio
Assembly
CarinaStudio.AppBase.Application.dll

Extensions of IApplication.

public static class ApplicationExtensions
Inheritance
ApplicationExtensions
Inherited Members

Methods

CreatePrivateDirectory(IApplication, string)

Create directory in private directory of application.

public static DirectoryInfo CreatePrivateDirectory(this IApplication app, string relativePath)

Parameters

app IApplication

IApplication.

relativePath string

Relative path of directory to create.

Returns

DirectoryInfo

DirectoryInfo represents the directory.

Exceptions

ArgumentException

Given path is not a relative path.

IOException

Unable to create directory.

GetFormattedString(IApplication, string, params object?[])

Get formatted string from resources according to given key and current settings or system language.

public static string GetFormattedString(this IApplication app, string key, params object?[] args)

Parameters

app IApplication

IApplication.

key string

Key of format string to get.

args object[]

Arguments to be formatted.

Returns

string

Formatted string.

Exceptions

ArgumentException

Format string is null.

GetStringNonNull(IApplication, string, string)

Get non-null string from resources according to given key and current settings or system language.

public static string GetStringNonNull(this IApplication app, string key, string defaultValue = "")

Parameters

app IApplication

IApplication.

key string

Key of string to get.

defaultValue string

Default string.

Returns

string

String.

OpenManifestResourceStream(IApplication, string)

Open stream to read manifest resource.

public static Stream OpenManifestResourceStream(this IApplication app, string name)

Parameters

app IApplication

IApplication.

name string

Name of resource.

Returns

Stream

Stream of manifest resource.

Exceptions

ArgumentException

Resource cannot be found.

OpenManifestResourceStream(IApplication, Type, string)

Open stream to read manifest resource.

public static Stream OpenManifestResourceStream(this IApplication app, Type type, string name)

Parameters

app IApplication

IApplication.

type Type

Type to provide namespace to scope resource name.

name string

Name of resource.

Returns

Stream

Stream of manifest resource.

Exceptions

ArgumentException

Resource cannot be found.

TryCreatePrivateDirectory(IApplication, string, out DirectoryInfo?)

Try creating directory in private directory of application.

public static bool TryCreatePrivateDirectory(this IApplication app, string relativePath, out DirectoryInfo? directoryInfo)

Parameters

app IApplication

IApplication.

relativePath string

Relative path of directory to create.

directoryInfo DirectoryInfo

DirectoryInfo represents the directory.

Returns

bool

True if directory has been created successfully.