Class TranslationProviderUriBuilder
A utility class that allows translation providers that implement the ITranslationProvider interface to return Uri values that confirm to the suggested Uri scheme.
Inheritance
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemoryApi
Assembly: Sdl.LanguagePlatform.TranslationMemoryApi.dll
Syntax
public class TranslationProviderUriBuilder
Constructors
TranslationProviderUriBuilder()
Constructs an empty TranslationMemoryUriBuilder class.
Declaration
public TranslationProviderUriBuilder()
TranslationProviderUriBuilder(String)
Constructs a TranslationMemoryUriBuilder class of the given type.
Declaration
public TranslationProviderUriBuilder(string type)
Parameters
| Type | Name | Description |
|---|---|---|
| String | type |
TranslationProviderUriBuilder(String, String)
Constructs a TranslationMemoryUriBuilder class using the given type and protocol.
Declaration
public TranslationProviderUriBuilder(string type, string protocol)
Parameters
| Type | Name | Description |
|---|---|---|
| String | type | A type string which is used together with the protocol string to uniquely identify a translation provider. You may wish to use your company name or initials as part of this unique identifier. This must not contain the "." character and must not be equal to "file" as this is not compatible with the Translation Provider Uri Schema. |
| String | protocol | A protocol string used together with the type parameter to uniquely identify a translation provider. |
Remarks
If the protocol value is set to the special value "file" then this will have an effect on how the Resource property is stored. For "file" protocols the Resource property will always be converted back to a local Windows file format with server path separation characters '/' replaced by local file path separating characters ''.
TranslationProviderUriBuilder(Uri)
Constructs a TranslationMemoryUriBuilder class from the given Uri and also setting a flag to say if the Uri will be used to contain a Windows filename.
Declaration
public TranslationProviderUriBuilder(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri |
Properties
HostName
An optional host name.
Declaration
public string HostName { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Item[String]
A string indexer that allows any number of key/value pairs to used as Uri parameters.
Declaration
public string this[string propertyName] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| String | propertyName |
Property Value
| Type | Description |
|---|---|
| String |
Password
An optional password. NB: This password will not be encrypted.
Declaration
public string Password { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Remarks
If you need to protect a password then you should not set a password in the Uri property but use the ITranslationProviderCredentialStore in your translation provider factory.
Port
An optional port.
Declaration
public int Port { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Protocol
The protocol that is used.
Declaration
public string Protocol { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Remarks
If the protocol value is set to the special value "file" then this will have an effect on how the Resource property is stored. For "file" protocols the Resource property will always be converted back to a local Windows file format with server path separation characters '/' replaced by local file path separating characters ''.
Resource
An optional resource string.
Declaration
public string Resource { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Remarks
This string which may contain any number of '/' characters will be written directly to the Uri so the the string must be compatible with the Uri format. However, if the Protocol value is set to the special value "file" then this will have an effect on how this Resource property is stored. For "file" protocols the Resource property will always be converted back to a local Windows file format with server path separation characters '/' replaced by local file path separating characters ''.
Type
The type of the translation provider. This type must be unique for all installed translation providers.
Declaration
public string Type { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Remarks
You may wish to use your company name or other unique name as part of the the type string.
Uri
Returns the Uri built from the properties of this class.
Declaration
public Uri Uri { get; }
Property Value
| Type | Description |
|---|---|
| Uri |
UserName
An optional UserName.
Declaration
public string UserName { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Methods
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | The System.Object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Overrides
Exceptions
| Type | Condition |
|---|---|
| System.NullReferenceException | The |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
GetParameterKeys()
Returns an array of parameter key names that have values defined for them.
Declaration
public string[] GetParameterKeys()
Returns
| Type | Description |
|---|---|
| String[] |
Remarks
This array does not contain entries for "userName" or "password" values.
ParseUri(Uri)
Initializes the TranslationMemoryUriBuilder class from the given Uri.
Declaration
public void ParseUri(Uri uri)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri |
ToString()
Creates a string representing the Uri
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String |