using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Net; using System.Threading.Tasks; namespace ZeroLevel.Services.Serialization { public interface IBinaryReader : IDisposable { bool ReadBoolean(); char ReadChar(); byte ReadByte(); byte[] ReadBytes(); Double ReadDouble(); float ReadFloat(); short ReadShort(); ushort ReadUShort(); Int32 ReadInt32(); UInt32 ReadUInt32(); Int64 ReadLong(); UInt64 ReadULong(); string ReadString(); Guid ReadGuid(); DateTime? ReadDateTime(); TimeOnly? ReadTime(); DateOnly? ReadDate(); decimal ReadDecimal(); TimeSpan ReadTimeSpan(); IPAddress ReadIP(); IPEndPoint ReadIPEndpoint(); #region Extensions #region Arrays T[] ReadArray() where T : IBinarySerializable, new(); string[] ReadStringArray(); IPAddress[] ReadIPArray(); IPEndPoint[] ReadIPEndPointArray(); Guid[] ReadGuidArray(); DateTime?[] ReadDateTimeArray(); Int64[] ReadInt64Array(); Int32[] ReadInt32Array(); UInt64[] ReadUInt64Array(); UInt32[] ReadUInt32Array(); char[] ReadCharArray(); short[] ReadShortArray(); ushort[] ReadUShortArray(); float[] ReadFloatArray(); Double[] ReadDoubleArray(); bool[] ReadBooleanArray(); byte[] ReadByteArray(); byte[][] ReadByteArrayArray(); decimal[] ReadDecimalArray(); TimeSpan[] ReadTimeSpanArray(); #endregion #region Collections List ReadCollection() where T : IBinarySerializable, new(); List ReadStringCollection(); List ReadGuidCollection(); List ReadDateTimeCollection(); List ReadCharCollection(); List ReadInt64Collection(); List ReadInt32Collection(); List ReadDoubleCollection(); List ReadDecimalCollection(); List ReadTimeSpanCollection(); List ReadFloatCollection(); List ReadBooleanCollection(); List ReadByteCollection(); List ReadByteArrayCollection(); List ReadIPCollection(); List ReadIPEndPointCollection(); List ReadUInt64Collection(); List ReadUInt32Collection(); List ReadShortCollection(); List ReadUShortCollection(); #endregion #region Collections lazy IEnumerable ReadCollectionLazy() where T : IBinarySerializable, new(); IEnumerable ReadStringCollectionLazy(); IEnumerable ReadIPCollectionLazy(); IEnumerable ReadIPEndPointCollectionLazy(); IEnumerable ReadGuidCollectionLazy(); IEnumerable ReadDateTimeCollectionLazy(); IEnumerable ReadInt64CollectionLazy(); IEnumerable ReadInt32CollectionLazy(); IEnumerable ReadUInt64CollectionLazy(); IEnumerable ReadUInt32CollectionLazy(); IEnumerable ReadCharCollectionLazy(); IEnumerable ReadShortCollectionLazy(); IEnumerable ReadUShortCollectionLazy(); IEnumerable ReadFloatCollectionLazy(); IEnumerable ReadDoubleCollectionLazy(); IEnumerable ReadBooleanCollectionLazy(); IEnumerable ReadByteCollectionLazy(); IEnumerable ReadByteArrayCollectionLazy(); IEnumerable ReadDecimalCollectionLazy(); IEnumerable ReadTimeSpanCollectionLazy(); #endregion T Read() where T : IBinarySerializable; T Read(object arg) where T : IBinarySerializable; T ReadCompatible(); Dictionary ReadDictionary(); ConcurrentDictionary ReadDictionaryAsConcurrent(); #endregion Extensions void SetPosition(long position); } public interface IAsyncBinaryReader : IDisposable { Task ReadBooleanAsync(); Task ReadCharAsync(); Task ReadByteAsync(); Task ReadBytesAsync(); Task ReadDoubleAsync(); Task ReadFloatAsync(); Task ReadShortAsync(); Task ReadUShortAsync(); Task ReadInt32Async(); Task ReadUInt32Async(); Task ReadLongAsync(); Task ReadULongAsync(); Task ReadStringAsync(); Task ReadGuidAsync(); Task ReadDateTimeAsync(); Task ReadTimeAsync(); Task ReadDateAsync(); Task ReadDecimalAsync(); Task ReadTimeSpanAsync(); Task ReadIPAsync(); Task ReadIPEndpointAsync(); #region Extensions #region Arrays Task ReadArrayAsync() where T : IAsyncBinarySerializable, new(); Task ReadStringArrayAsync(); Task ReadIPArrayAsync(); Task ReadIPEndPointArrayAsync(); Task ReadGuidArrayAsync(); Task ReadDateTimeArrayAsync(); Task ReadInt64ArrayAsync(); Task ReadInt32ArrayAsync(); Task ReadUInt64ArrayAsync(); Task ReadUInt32ArrayAsync(); Task ReadCharArrayAsync(); Task ReadShortArrayAsync(); Task ReadUShortArrayAsync(); Task ReadFloatArrayAsync(); Task ReadDoubleArrayAsync(); Task ReadBooleanArrayAsync(); Task ReadByteArrayAsync(); Task ReadByteArrayArrayAsync(); Task ReadDecimalArrayAsync(); Task ReadTimeSpanArrayAsync(); #endregion #region Collections Task> ReadCollectionAsync() where T : IAsyncBinarySerializable, new(); Task> ReadStringCollectionAsync(); Task> ReadGuidCollectionAsync(); Task> ReadDateTimeCollectionAsync(); Task> ReadCharCollectionAsync(); Task> ReadInt64CollectionAsync(); Task> ReadInt32CollectionAsync(); Task> ReadDoubleCollectionAsync(); Task> ReadDecimalCollectionAsync(); Task> ReadTimeSpanCollectionAsync(); Task> ReadFloatCollectionAsync(); Task> ReadBooleanCollectionAsync(); Task> ReadByteCollectionAsync(); Task> ReadByteArrayCollectionAsync(); Task> ReadIPCollectionAsync(); Task> ReadIPEndPointCollectionAsync(); Task> ReadUInt64CollectionAsync(); Task> ReadUInt32CollectionAsync(); Task> ReadShortCollectionAsync(); Task> ReadUShortCollectionAsync(); #endregion Task ReadAsync() where T : IAsyncBinarySerializable; Task ReadAsync(object arg) where T : IAsyncBinarySerializable; Task ReadCompatibleAsync(); Task> ReadDictionaryAsync(); Task> ReadDictionaryAsConcurrentAsync(); #endregion Extensions } }