using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using static System.Net.WebRequestMethods;
namespace EasyDevCore.Remote.HttpAccess
{
///
/// Contract for serializing and deserializing objects.
///
public interface ISerializer
{
///
/// Serializes an object to a string representation.
///
string Serialize(object obj);
///
/// Serializes the specified object.
///
///
/// The object.
///
string Serialize(T obj);
///
/// Deserializes an object from a string representation.
///
T Deserialize(string s);
///
/// Deserializes an object from a stream representation.
///
T Deserialize(Stream stream);
///
/// Deserializes the asynchronous.
///
///
/// The stream.
///
Task DeserializeAsync(Stream stream);
}
///
///
///
public class HttpAccessSetup
{
private static ISerializer _JsonSerializerRequest;
private static ISerializer _UrlEncodedSerializerRequest;
private static ISerializer _JsonSerializerResponse;
///
/// Gets or sets the json serializer request.
///
///
/// The json serializer request.
///
public static ISerializer JsonSerializerRequest { get => (_JsonSerializerRequest ?? (_JsonSerializerRequest = new TextJsonSerializer())); set => _JsonSerializerRequest = value; }
///
/// Gets or sets the URL encoded serializer.
///
///
/// The URL encoded serializer.
///
public static ISerializer UrlEncodedSerializerRequest { get => (_UrlEncodedSerializerRequest ?? (_UrlEncodedSerializerRequest = new UrlEncodedSerializer())); set => _UrlEncodedSerializerRequest = value; }
///
/// Gets or sets the json serializer response.
///
///
/// The json serializer response.
///
public static ISerializer JsonSerializerResponse { get => (_JsonSerializerResponse ?? (_JsonSerializerResponse = new TextJsonSerializer())); set => _JsonSerializerResponse = value; }
}
}