Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PutterBase.cs
1using System;
2using System.Collections.Generic;
3using System.Security.Cryptography.X509Certificates;
4using System.Threading.Tasks;
6
8{
12 public abstract class PutterBase : IContentPutter
13 {
17 public PutterBase()
18 {
19 }
20
24 public abstract string[] UriSchemes
25 {
26 get;
27 }
28
35 public abstract bool CanPut(Uri Uri, out Grade Grade);
36
46 public virtual Task<object> PutAsync(Uri Uri, object Data, X509Certificate Certificate,
47 RemoteCertificateEventHandler RemoteCertificateValidator, params KeyValuePair<string, string>[] Headers)
48 {
49 return this.PutAsync(Uri, Data, Certificate, RemoteCertificateValidator, 60000, Headers);
50 }
51
62 public virtual async Task<object> PutAsync(Uri Uri, object Data, X509Certificate Certificate,
63 RemoteCertificateEventHandler RemoteCertificateValidator, int TimeoutMs, params KeyValuePair<string, string>[] Headers)
64 {
65 KeyValuePair<byte[], string> P = await InternetContent.EncodeAsync(Data, System.Text.Encoding.UTF8);
66 KeyValuePair<byte[], string> Result = await this.PutAsync(Uri, P.Key, P.Value, Certificate,
67 RemoteCertificateValidator, TimeoutMs, Headers);
68
69 return await InternetContent.DecodeAsync(Result.Value, Result.Key, Uri);
70 }
71
82 public virtual Task<KeyValuePair<byte[], string>> PutAsync(Uri Uri, byte[] EncodedData, string ContentType,
83 X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, params KeyValuePair<string, string>[] Headers)
84 {
85 return this.PutAsync(Uri, EncodedData, ContentType, Certificate, RemoteCertificateValidator, 60000, Headers);
86 }
87
99 public abstract Task<KeyValuePair<byte[], string>> PutAsync(Uri Uri, byte[] EncodedData, string ContentType,
100 X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, int TimeoutMs, params KeyValuePair<string, string>[] Headers);
101
102 }
103}
Static class managing encoding and decoding of internet content.
static Task< KeyValuePair< byte[], string > > EncodeAsync(object Object, Encoding Encoding, params string[] AcceptedContentTypes)
Encodes an object.
static Task< object > DecodeAsync(string ContentType, byte[] Data, Encoding Encoding, KeyValuePair< string, string >[] Fields, Uri BaseUri)
Decodes an object.
Abstract base class for putters.
Definition: PutterBase.cs:13
virtual Task< KeyValuePair< byte[], string > > PutAsync(Uri Uri, byte[] EncodedData, string ContentType, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, params KeyValuePair< string, string >[] Headers)
Puts to a resource, using a Uniform Resource Identifier (or Locator).
Definition: PutterBase.cs:82
abstract bool CanPut(Uri Uri, out Grade Grade)
If the putter is able to put to a resource, given its URI.
abstract Task< KeyValuePair< byte[], string > > PutAsync(Uri Uri, byte[] EncodedData, string ContentType, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, int TimeoutMs, params KeyValuePair< string, string >[] Headers)
Puts to a resource, using a Uniform Resource Identifier (or Locator).
virtual async Task< object > PutAsync(Uri Uri, object Data, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, int TimeoutMs, params KeyValuePair< string, string >[] Headers)
Puts to a resource, using a Uniform Resource Identifier (or Locator).
Definition: PutterBase.cs:62
PutterBase()
Abstract base class for putters.
Definition: PutterBase.cs:17
abstract string[] UriSchemes
Supported URI schemes.
Definition: PutterBase.cs:25
virtual Task< object > PutAsync(Uri Uri, object Data, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, params KeyValuePair< string, string >[] Headers)
Puts to a resource, using a Uniform Resource Identifier (or Locator).
Definition: PutterBase.cs:46
Basic interface for Internet Content putters. A class implementing this interface and having a defaul...
delegate void RemoteCertificateEventHandler(object Sender, RemoteCertificateEventArgs e)
Delegate for remote certificate event handlers.
Grade
Grade enumeration
Definition: Grade.cs:7