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: Sdl.LanguagePlatform.Core.Resources
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
public interface IResourceDataAccessor
Methods
GetResourceData(CultureCode, LanguageResourceType, Boolean)
Similar to ReadResourceData(CultureCode, LanguageResourceType, Boolean) but returns the result as a byte array.
Declaration
byte[] GetResourceData(CultureCode culture, LanguageResourceType t, bool fallback)
Parameters
Type | Name | Description |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | |
LanguageResourceType | t | |
System.Boolean | fallback |
Returns
Type | Description |
---|---|
System.Byte[] |
GetResourceStatus(CultureCode, LanguageResourceType, Boolean)
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 |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | The culture for which the status is requested. |
LanguageResourceType | t | The language resource type which is requested. |
System.Boolean | 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 |
---|---|
System.Collections.Generic.List<System.Globalization.CultureInfo> | The list of cultures for which a resource of the specified type is available |
ReadResourceData(CultureCode, LanguageResourceType, Boolean)
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 |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | The culture for which a resource is requested. |
LanguageResourceType | t | The language resource type which is requested. |
System.Boolean | fallback | If true, a resource accessor may fallback to a more general culture. If false, no fallback may be performed. |
Returns
Type | Description |
---|---|
System.IO.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). |