You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/Serialization/IBinaryWriter.cs

224 lines
7.6 KiB

6 years ago
using System;
using System.Collections.Concurrent;
6 years ago
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading.Tasks;
6 years ago
namespace ZeroLevel.Services.Serialization
{
public interface IBinaryWriter
6 years ago
: IDisposable
{
void WriteBoolean(bool val);
void WriteChar(char val);
6 years ago
void WriteByte(byte val);
6 years ago
void WriteBytes(byte[] val);
void WriteShort(short number);
void WriteUShort(ushort number);
6 years ago
void WriteDouble(double val);
6 years ago
void WriteFloat(float val);
6 years ago
void WriteInt32(Int32 number);
void WriteUInt32(UInt32 number);
6 years ago
void WriteLong(Int64 number);
void WriteULong(UInt64 number);
6 years ago
void WriteString(string line);
6 years ago
void WriteGuid(Guid guid);
6 years ago
void WriteDateTime(DateTime? datetime);
void WriteTime(TimeOnly? time);
void WriteDate(DateOnly? date);
6 years ago
void WriteDecimal(Decimal number);
6 years ago
void WriteTimeSpan(TimeSpan period);
6 years ago
void WriteIP(IPAddress ip);
6 years ago
void WriteIPEndpoint(IPEndPoint endpoint);
#region Extensions
5 years ago
#region Arrays
void WriteArray<T>(T[] array) where T : IBinarySerializable;
void WriteArray(string[] array);
void WriteArray(IPAddress[] array);
void WriteArray(IPEndPoint[] array);
void WriteArray(Guid[] array);
void WriteArray(DateTime[] array);
void WriteArray(DateTime?[] array);
5 years ago
void WriteArray(UInt64[] array);
void WriteArray(UInt32[] array);
void WriteArray(char[] array);
void WriteArray(short[] array);
void WriteArray(ushort[] array);
void WriteArray(Int64[] array);
void WriteArray(Int32[] array);
void WriteArray(float[] array);
void WriteArray(Double[] array);
void WriteArray(bool[] array);
void WriteArray(byte[] array);
void WriteArray(byte[][] array);
void WriteArray(decimal[] array);
void WriteArray(TimeSpan[] array);
#endregion
#region Collections
6 years ago
void WriteCollection<T>(IEnumerable<T> collection)
where T : IBinarySerializable;
void WriteCollection(IEnumerable<string> collection);
void WriteCollection(IEnumerable<char> collection);
6 years ago
void WriteCollection(IEnumerable<Guid> collection);
void WriteCollection(IEnumerable<DateTime> collection);
void WriteCollection(IEnumerable<DateTime?> collection);
6 years ago
void WriteCollection(IEnumerable<Int64> collection);
void WriteCollection(IEnumerable<Int32> collection);
void WriteCollection(IEnumerable<UInt64> collection);
void WriteCollection(IEnumerable<UInt32> collection);
void WriteCollection(IEnumerable<short> collection);
void WriteCollection(IEnumerable<ushort> collection);
6 years ago
void WriteCollection(IEnumerable<Double> collection);
6 years ago
void WriteCollection(IEnumerable<Decimal> collection);
void WriteCollection(IEnumerable<TimeSpan> collection);
void WriteCollection(IEnumerable<float> collection);
6 years ago
void WriteCollection(IEnumerable<bool> collection);
void WriteCollection(IEnumerable<byte> collection);
void WriteCollection(IEnumerable<byte[]> collection);
void WriteCollection(IEnumerable<IPEndPoint> collection);
void WriteCollection(IEnumerable<IPAddress> collection);
5 years ago
#endregion
void WriteDictionary<TKey, TValue>(IDictionary<TKey, TValue> collection);
5 years ago
void WriteDictionary<TKey, TValue>(ConcurrentDictionary<TKey, TValue> collection);
6 years ago
void Write<T>(T item)
where T : IBinarySerializable;
void WriteCompatible<T>(T item);
#endregion Extensions
6 years ago
Stream Stream { get; }
}
public interface IAsyncBinaryWriter
: IDisposable
{
Task WriteCharAsync(char val);
Task WriteBytesAsync(byte[] val);
Task WriteShortAsync(short number);
Task WriteUShortAsync(ushort number);
Task WriteDoubleAsync(double val);
Task WriteFloatAsync(float val);
Task WriteInt32Async(Int32 number);
Task WriteUInt32Async(UInt32 number);
Task WriteLongAsync(Int64 number);
Task WriteULongAsync(UInt64 number);
Task WriteStringAsync(string line);
Task WriteGuidAsync(Guid guid);
Task WriteDateTimeAsync(DateTime? datetime);
Task WriteTimeAsync(TimeOnly? time);
Task WriteDateAsync(DateOnly? date);
Task WriteDecimalAsync(Decimal number);
Task WriteTimeSpanAsync(TimeSpan period);
Task WriteIPAsync(IPAddress ip);
Task WriteIPEndpointAsync(IPEndPoint endpoint);
#region Extensions
#region Arrays
Task WriteArrayAsync<T>(T[] array)
where T : IAsyncBinarySerializable;
Task WriteArrayAsync(string[] array);
Task WriteArrayAsync(IPAddress[] array);
Task WriteArrayAsync(IPEndPoint[] array);
Task WriteArrayAsync(Guid[] array);
Task WriteArrayAsync(DateTime[] array);
Task WriteArrayAsync(DateTime?[] array);
Task WriteArrayAsync(UInt64[] array);
Task WriteArrayAsync(UInt32[] array);
Task WriteArrayAsync(char[] array);
Task WriteArrayAsync(short[] array);
Task WriteArrayAsync(ushort[] array);
Task WriteArrayAsync(Int64[] array);
Task WriteArrayAsync(Int32[] array);
Task WriteArrayAsync(float[] array);
Task WriteArrayAsync(Double[] array);
Task WriteArrayAsync(bool[] array);
Task WriteArrayAsync(byte[] array);
Task WriteArrayAsync(byte[][] array);
Task WriteArrayAsync(decimal[] array);
Task WriteArrayAsync(TimeSpan[] array);
#endregion
#region Collections
Task WriteCollectionAsync<T>(IEnumerable<T> collection)
where T : IAsyncBinarySerializable;
Task WriteCollectionAsync(IEnumerable<string> collection);
Task WriteCollectionAsync(IEnumerable<char> collection);
Task WriteCollectionAsync(IEnumerable<Guid> collection);
Task WriteCollectionAsync(IEnumerable<DateTime> collection);
Task WriteCollectionAsync(IEnumerable<DateTime?> collection);
Task WriteCollectionAsync(IEnumerable<Int64> collection);
Task WriteCollectionAsync(IEnumerable<Int32> collection);
Task WriteCollectionAsync(IEnumerable<UInt64> collection);
Task WriteCollectionAsync(IEnumerable<UInt32> collection);
Task WriteCollectionAsync(IEnumerable<short> collection);
Task WriteCollectionAsync(IEnumerable<ushort> collection);
Task WriteCollectionAsync(IEnumerable<Double> collection);
Task WriteCollectionAsync(IEnumerable<Decimal> collection);
Task WriteCollectionAsync(IEnumerable<TimeSpan> collection);
Task WriteCollectionAsync(IEnumerable<float> collection);
Task WriteCollectionAsync(IEnumerable<bool> collection);
Task WriteCollectionAsync(IEnumerable<byte> collection);
Task WriteCollectionAsync(IEnumerable<byte[]> collection);
Task WriteCollectionAsync(IEnumerable<IPEndPoint> collection);
Task WriteCollectionAsync(IEnumerable<IPAddress> collection);
#endregion
Task WriteDictionaryAsync<TKey, TValue>(IDictionary<TKey, TValue> collection);
Task WriteDictionaryAsync<TKey, TValue>(ConcurrentDictionary<TKey, TValue> collection);
Task WriteAsync<T>(T item)
where T : IAsyncBinarySerializable;
Task WriteCompatibleAsync<T>(T item);
#endregion Extensions
Stream Stream { get; }
}
}

Powered by TurnKey Linux.