2using System.Collections.Generic;
3using System.Security.Cryptography.X509Certificates;
4using System.Threading.Tasks;
38 if (
string.IsNullOrEmpty(UriToResource(Uri)))
50 private static string UriToResource(Uri Uri)
54 switch (Uri.OriginalString)
56 case "urn:nf:iot:e2e:1.0":
57 SchemaName =
"E2E.xsd";
60 case "urn:nf:iot:leg:id:1.0":
61 SchemaName =
"LegalIdentities.xsd";
64 case "urn:nf:iot:p2p:1.0":
65 SchemaName =
"P2P.xsd";
68 case "urn:nf:iot:leg:sc:1.0":
69 SchemaName =
"SmartContracts.xsd";
76 return typeof(ContractsClient).Namespace +
".Schema." + SchemaName;
88 params KeyValuePair<string, string>[] Headers)
90 string SchemaName = UriToResource(Uri);
91 if (
string.IsNullOrEmpty(SchemaName))
92 throw new Exception(
"URI not recognized.");
107 int TimeoutMs, params KeyValuePair<string, string>[] Headers)
109 return this.
GetAsync(Uri, Certificate, RemoteCertificateValidator, Headers);
120 public async Task<KeyValuePair<string, TemporaryStream>>
GetTempStreamAsync(Uri Uri, X509Certificate Certificate,
123 string SchemaName = UriToResource(Uri);
124 if (
string.IsNullOrEmpty(SchemaName))
125 throw new Exception(
"URI not recognized.");
144 public Task<KeyValuePair<string, TemporaryStream>>
GetTempStreamAsync(Uri Uri, X509Certificate Certificate,
147 return this.
GetTempStreamAsync(Uri, Certificate, RemoteCertificateValidator, Headers);
171 params KeyValuePair<string, string>[] Headers)
173 return Task.FromResult<
object>(
null);
186 int TimeoutMs, params KeyValuePair<string, string>[] Headers)
188 return Task.FromResult<
object>(
null);
Static class managing loading of resources stored as embedded resources or in content files.
static byte[] LoadResource(string ResourceName)
Loads a resource from an embedded resource.
const string DefaultContentType
Default content type for XML documents.
Static class managing loading of XSL resources stored as embedded resources or in content files.
static XmlSchema LoadSchema(string ResourceName)
Loads an XML schema from an embedded resource.
Getter for well-known contract schemas.
bool CanGet(Uri Uri, out Grade Grade)
If the getter is able to get a resource, given its URI.
string[] UriSchemes
Supported URI schemes.
async Task< KeyValuePair< string, TemporaryStream > > GetTempStreamAsync(Uri Uri, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, params KeyValuePair< string, string >[] Headers)
Gets a (possibly big) resource, using a Uniform Resource Identifier (or Locator).
Task< KeyValuePair< string, TemporaryStream > > GetTempStreamAsync(Uri Uri, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, int TimeoutMs, params KeyValuePair< string, string >[] Headers)
Gets a (possibly big) resource, using a Uniform Resource Identifier (or Locator).
Task< object > HeadAsync(Uri Uri, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, params KeyValuePair< string, string >[] Headers)
Gets the headers of a resource, using a Uniform Resource Identifier (or Locator).
bool CanHead(Uri Uri, out Grade Grade)
If the getter is able to get headers of a resource, given its URI.
Task< object > GetAsync(Uri Uri, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, params KeyValuePair< string, string >[] Headers)
Gets a resource, using a Uniform Resource Identifier (or Locator).
ContractSchemasGetter()
Getter for well-known contract schemas.
Task< object > HeadAsync(Uri Uri, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, int TimeoutMs, params KeyValuePair< string, string >[] Headers)
Gets the headers of a resource, using a Uniform Resource Identifier (or Locator).
Task< object > GetAsync(Uri Uri, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, int TimeoutMs, params KeyValuePair< string, string >[] Headers)
Gets a resource, using a Uniform Resource Identifier (or Locator).
Manages a temporary stream. Contents is kept in-memory, if below a memory threshold,...
override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Asynchronously writes a sequence of bytes to the current stream, advances the current position within...
Basic interface for Internet Content getters. A class implementing this interface and having a defaul...
delegate void RemoteCertificateEventHandler(object Sender, RemoteCertificateEventArgs e)
Delegate for remote certificate event handlers.