Interface IResourceDataAccessor
A resource data accessor provides access to language-specific resources of different types (see LanguageResourceType for the supported resource types).
Resources are binary-stored data streams. The caller is responsible to read the data in the resource-specific format and interpret it accordingly.
Namespace: SdlSdl.LanguagePlatformCoreResources
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
public interface IResourceDataAccessor
Methods
GetResourceData(CultureCode, LanguageResourceType, bool)
Similar to ReadResourceData(CultureCode, LanguageResourceType, bool) but returns the result as a byte array.
Declaration
byte[] GetResourceData(CultureCode culture, LanguageResourceType t, bool fallback)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture | |
LanguageResourceType | t | |
bool | fallback |
Returns
Type | Description |
---|---|
byte |
GetResourceStatus(CultureCode, LanguageResourceType, bool)
Returns the resource status for the specified resource and the specified culture.
Declaration
ResourceStatus GetResourceStatus(CultureCode culture, LanguageResourceType t, bool fallback)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture | The culture for which the status is requested. |
LanguageResourceType | t | The language resource type which is requested. |
bool | fallback | If true, a resource accessor may fallback to a more general culture. If false, no fallback may be performed. |
Returns
Type | Description |
---|---|
ResourceStatus | The resource status for the resource type and culture. |
GetSupportedCultures(LanguageResourceType)
Returns all cultures for which resources are found for the provided resource type.
Declaration
List<CultureInfo> GetSupportedCultures(LanguageResourceType t)
Parameters
Type | Name | Description |
---|---|---|
LanguageResourceType | t | The resource type |
Returns
Type | Description |
---|---|
ListCultureInfo | The list of cultures for which a resource of the specified type is available |
ReadResourceData(CultureCode, LanguageResourceType, bool)
Returns the data stream for the specified resource type and culture. If an appropriate resource is not found, an exception is thrown and/or null is returned. Callers should check for both conditions, and check the resource status before the stream is requested.
Declaration
Stream ReadResourceData(CultureCode culture, LanguageResourceType t, bool fallback)
Parameters
Type | Name | Description |
---|---|---|
CultureCode | culture | The culture for which a resource is requested. |
LanguageResourceType | t | The language resource type which is requested. |
bool | fallback | If true, a resource accessor may fallback to a more general culture. If false, no fallback may be performed. |
Returns
Type | Description |
---|---|
Stream | A stream containing the data for the requested resource, or null if the resource is not available (in which case callers may also throw an exception). |