Interface IResourceDataAccessorAsync
Namespace: Sdl.LanguagePlatform.Core.Resources
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
public interface IResourceDataAccessorAsync
Methods
GetResourceDataAsync(CultureCode, LanguageResourceType, Boolean)
Similar to ReadResourceDataAsync(CultureCode, LanguageResourceType, Boolean) but returns the result as a byte array.
Declaration
Task<byte[]> GetResourceDataAsync(CultureCode culture, LanguageResourceType t, bool fallback)
Parameters
Type | Name | Description |
---|---|---|
Sdl.Core.Globalization.CultureCode | culture | |
LanguageResourceType | t | |
System.Boolean | fallback |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Byte[]> |
GetResourceStatusAsync(CultureCode, LanguageResourceType, Boolean)
Returns the resource status for the specified resource and the specified culture.
Declaration
Task<ResourceStatus> GetResourceStatusAsync(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 |
---|---|
System.Threading.Tasks.Task<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<CultureCode> GetSupportedCultures(LanguageResourceType t)
Parameters
Type | Name | Description |
---|---|---|
LanguageResourceType | t | The resource type |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Sdl.Core.Globalization.CultureCode> | The list of cultures for which a resource of the specified type is available |
ReadResourceDataAsync(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
Task<Stream> ReadResourceDataAsync(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.Threading.Tasks.Task<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). |