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
IApplicationrelativePath
stringRelative 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
IApplicationkey
stringKey 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
IApplicationkey
stringKey of string to get.
defaultValue
stringDefault string.
Returns
- string
String.
OpenManifestResourceStream(IApplication, string)
Open stream to read manifest resource.
public static Stream OpenManifestResourceStream(this IApplication app, string name)
Parameters
app
IApplicationname
stringName of resource.
Returns
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
IApplicationtype
TypeType to provide namespace to scope resource name.
name
stringName of resource.
Returns
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
IApplicationrelativePath
stringRelative path of directory to create.
directoryInfo
DirectoryInfoDirectoryInfo represents the directory.
Returns
- bool
True if directory has been created successfully.