1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01:00

Marked features related to Lidgren.Network as obsolete

This commit is contained in:
Ell 2021-12-03 12:52:26 +01:00
parent 636522bc3e
commit 0c881e374b
4 changed files with 13 additions and 0 deletions

View file

@ -67,6 +67,9 @@ Improvements
- **Use TitleContainer for opening streams where possible** - **Use TitleContainer for opening streams where possible**
- Set GraphicsResource Name when loading assets using RawContentManager - Set GraphicsResource Name when loading assets using RawContentManager
Removals
- Marked features related to Lidgren.Network as obsolete
## 5.1.0 ## 5.1.0
### MLEM ### MLEM
Additions Additions

View file

@ -22,6 +22,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<ProjectReference Include="..\MLEM\MLEM.csproj" /> <ProjectReference Include="..\MLEM\MLEM.csproj" />
<!--TODO remove lidgren support eventually (methods marked as obsolete since 5.2.0)-->
<PackageReference Include="Lidgren.Network" Version="1.0.2"> <PackageReference Include="Lidgren.Network" Version="1.0.2">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>

View file

@ -10,6 +10,7 @@ namespace MLEM.Data {
/// It can be used both for serialization of outgoing packets, and deserialization of incoming packets. /// It can be used both for serialization of outgoing packets, and deserialization of incoming packets.
/// Before serializing and deserializing an object, each of the object's fields has to have a handler. New handlers can be added using <see cref="AddHandler{T}(System.Action{Lidgren.Network.NetBuffer,T},System.Func{Lidgren.Network.NetBuffer,T})"/> or <see cref="AddHandler{T}(Newtonsoft.Json.JsonSerializer)"/>. /// Before serializing and deserializing an object, each of the object's fields has to have a handler. New handlers can be added using <see cref="AddHandler{T}(System.Action{Lidgren.Network.NetBuffer,T},System.Func{Lidgren.Network.NetBuffer,T})"/> or <see cref="AddHandler{T}(Newtonsoft.Json.JsonSerializer)"/>.
/// </summary> /// </summary>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public class NetBufferSerializer { public class NetBufferSerializer {
private readonly Dictionary<Type, Action<NetBuffer, object>> writeFunctions = new Dictionary<Type, Action<NetBuffer, object>>(); private readonly Dictionary<Type, Action<NetBuffer, object>> writeFunctions = new Dictionary<Type, Action<NetBuffer, object>>();

View file

@ -19,6 +19,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to write to</param> /// <param name="buffer">The buffer to write to</param>
/// <param name="vector">The vector to write</param> /// <param name="vector">The vector to write</param>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static void Write(this NetBuffer buffer, Vector2 vector) { public static void Write(this NetBuffer buffer, Vector2 vector) {
buffer.Write(vector.X); buffer.Write(vector.X);
buffer.Write(vector.Y); buffer.Write(vector.Y);
@ -29,6 +30,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to read from</param> /// <param name="buffer">The buffer to read from</param>
/// <returns>The read vector</returns> /// <returns>The read vector</returns>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static Vector2 ReadVector2(this NetBuffer buffer) { public static Vector2 ReadVector2(this NetBuffer buffer) {
return new Vector2(buffer.ReadFloat(), buffer.ReadFloat()); return new Vector2(buffer.ReadFloat(), buffer.ReadFloat());
} }
@ -38,6 +40,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to write to</param> /// <param name="buffer">The buffer to write to</param>
/// <param name="guid">The guid to write</param> /// <param name="guid">The guid to write</param>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static void Write(this NetBuffer buffer, Guid guid) { public static void Write(this NetBuffer buffer, Guid guid) {
buffer.Write(guid.ToByteArray()); buffer.Write(guid.ToByteArray());
} }
@ -47,6 +50,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to read from</param> /// <param name="buffer">The buffer to read from</param>
/// <returns>The read guid</returns> /// <returns>The read guid</returns>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static Guid ReadGuid(this NetBuffer buffer) { public static Guid ReadGuid(this NetBuffer buffer) {
return new Guid(buffer.ReadBytes(16)); return new Guid(buffer.ReadBytes(16));
} }
@ -56,6 +60,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to write to</param> /// <param name="buffer">The buffer to write to</param>
/// <param name="direction">The direction to write</param> /// <param name="direction">The direction to write</param>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static void Write(this NetBuffer buffer, Direction2 direction) { public static void Write(this NetBuffer buffer, Direction2 direction) {
buffer.Write((short) direction); buffer.Write((short) direction);
} }
@ -65,6 +70,7 @@ namespace MLEM.Data {
/// </summary> /// </summary>
/// <param name="buffer">The buffer to read from</param> /// <param name="buffer">The buffer to read from</param>
/// <returns>The read direction</returns> /// <returns>The read direction</returns>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static Direction2 ReadDirection(this NetBuffer buffer) { public static Direction2 ReadDirection(this NetBuffer buffer) {
return (Direction2) buffer.ReadInt16(); return (Direction2) buffer.ReadInt16();
} }
@ -76,6 +82,7 @@ namespace MLEM.Data {
/// <param name="obj">The object to write</param> /// <param name="obj">The object to write</param>
/// <param name="serializer">The JSON serializer to use</param> /// <param name="serializer">The JSON serializer to use</param>
/// <typeparam name="T">The type of object written</typeparam> /// <typeparam name="T">The type of object written</typeparam>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static void WriteObject<T>(this NetBuffer buffer, T obj, JsonSerializer serializer) { public static void WriteObject<T>(this NetBuffer buffer, T obj, JsonSerializer serializer) {
if (EqualityComparer<T>.Default.Equals(obj, default)) { if (EqualityComparer<T>.Default.Equals(obj, default)) {
buffer.Write(0); buffer.Write(0);
@ -97,6 +104,7 @@ namespace MLEM.Data {
/// <param name="serializer">The JSON serializer to use</param> /// <param name="serializer">The JSON serializer to use</param>
/// <typeparam name="T">The type of object read</typeparam> /// <typeparam name="T">The type of object read</typeparam>
/// <returns>The read object</returns> /// <returns>The read object</returns>
[Obsolete("Lidgren.Network support is deprecated. Consider using LiteNetLib or a custom implementation instead.")]
public static T ReadObject<T>(this NetBuffer buffer, JsonSerializer serializer) { public static T ReadObject<T>(this NetBuffer buffer, JsonSerializer serializer) {
var length = buffer.ReadInt32(); var length = buffer.ReadInt32();
if (length <= 0) if (length <= 0)