Some interfaces cleanup
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ namespace mROA.Codegen
|
|||||||
public sealed class RemoteTypeBinder
|
public sealed class RemoteTypeBinder
|
||||||
{
|
{
|
||||||
static RemoteTypeBinder(){
|
static RemoteTypeBinder(){
|
||||||
RemoteContextRepository.RemoteTypes = new Dictionary<Type, Type> {
|
RemoteInstanceRepository.RemoteTypes = new Dictionary<Type, Type> {
|
||||||
<!I remoteTypePair r sep typesSep><!D typesSep>,
|
<!I remoteTypePair r sep typesSep><!D typesSep>,
|
||||||
<!D>
|
<!D>
|
||||||
};
|
};
|
||||||
ContextRepository.EventBinders = new object[] {
|
InstanceRepository.EventBinders = new object[] {
|
||||||
<!I eventBinder r sep typesSep>
|
<!I eventBinder r sep typesSep>
|
||||||
<!T objectBinderTemplate>
|
<!T objectBinderTemplate>
|
||||||
new EventBinder<<!L type>>
|
new EventBinder<<!L type>>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using mROA.Implementation;
|
using mROA.Implementation;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace mROA.Abstract
|
|||||||
{
|
{
|
||||||
public interface IInstanceRepository : IInjectableModule
|
public interface IInstanceRepository : IInjectableModule
|
||||||
{
|
{
|
||||||
int HostId { get; set; }
|
|
||||||
int ResisterObject<T>(object o, IEndPointContext context);
|
int ResisterObject<T>(object o, IEndPointContext context);
|
||||||
void ClearObject(ComplexObjectIdentifier id, IEndPointContext context);
|
void ClearObject(ComplexObjectIdentifier id, IEndPointContext context);
|
||||||
T GetObject<T>(ComplexObjectIdentifier id, IEndPointContext context);
|
T GetObject<T>(ComplexObjectIdentifier id, IEndPointContext context);
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace mROA.Abstract
|
||||||
|
|
||||||
namespace mROA.Abstract
|
|
||||||
{
|
{
|
||||||
// public interface IContextualSerializationToolKit : IInjectableModule
|
// public interface IContextualSerializationToolKit : IInjectableModule
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace mROA.Abstract
|
namespace mROA.Abstract
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
using mROA.Implementation.Attributes;
|
using mROA.Implementation.Attributes;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Channels;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Channels;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
using static mROA.Implementation.EMessageType;
|
using static mROA.Implementation.EMessageType;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
using mROA.Implementation.Backend;
|
using mROA.Implementation.Backend;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using mROA.Abstract;
|
||||||
|
|
||||||
namespace mROA.Abstract
|
namespace mROA.Implementation
|
||||||
{
|
{
|
||||||
public class EventBinder<T> : IEventBinder<T>
|
public class EventBinder<T> : IEventBinder<T>
|
||||||
{
|
{
|
||||||
public Action<T, IEndPointContext, IRepresentationModuleProducer, int> BindAction { get; set; }
|
public Action<T, IEndPointContext, IRepresentationModuleProducer, int> BindAction { get; set; } = (_, _, _, _) => { };
|
||||||
|
|
||||||
public void BindEvents(T source, IEndPointContext context,
|
public void BindEvents(T source, IEndPointContext context,
|
||||||
IRepresentationModuleProducer representationModuleProducer, int index)
|
IRepresentationModuleProducer representationModuleProducer, int index)
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text.Json;
|
|
||||||
using mROA.Abstract;
|
|
||||||
|
|
||||||
namespace mROA.Implementation
|
|
||||||
{
|
|
||||||
// public class JsonSerializationToolkit : IContextualSerializationToolKit
|
|
||||||
// {
|
|
||||||
// public byte[] Serialize<T>(T objectToSerialize)
|
|
||||||
// {
|
|
||||||
// return JsonSerializer.SerializeToUtf8Bytes(objectToSerialize);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public byte[] Serialize(object objectToSerialize, Type type)
|
|
||||||
// {
|
|
||||||
// return JsonSerializer.SerializeToUtf8Bytes(objectToSerialize, type);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public T? Deserialize<T>(byte[] rawData)
|
|
||||||
// {
|
|
||||||
// return JsonSerializer.Deserialize<T>(rawData);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public object? Deserialize(byte[] rawData, Type type)
|
|
||||||
// {
|
|
||||||
// return JsonSerializer.Deserialize(rawData, type);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public T? Deserialize<T>(Span<byte> rawData)
|
|
||||||
// {
|
|
||||||
// return JsonSerializer.Deserialize<T>(rawData);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public object? Deserialize(Span<byte> rawData, Type type)
|
|
||||||
// {
|
|
||||||
// return JsonSerializer.Deserialize(rawData, type);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public T Cast<T>(object nonCasted)
|
|
||||||
// {
|
|
||||||
// return nonCasted switch
|
|
||||||
// {
|
|
||||||
// JsonElement jsonElement => jsonElement.Deserialize<T>()!,
|
|
||||||
// T casted => casted,
|
|
||||||
// _ => throw new JsonException("Cannot cast object to type " + typeof(T).FullName)
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public object Cast(object nonCasted, Type type)
|
|
||||||
// {
|
|
||||||
// if (nonCasted is JsonElement jsonElement)
|
|
||||||
// return jsonElement.Deserialize(type)!;
|
|
||||||
//
|
|
||||||
// throw new JsonException("Cannot cast object to type " + type.FullName);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void Inject<T>(T dependency)
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -36,7 +36,7 @@ namespace mROA.Implementation
|
|||||||
public bool IsTrusted { get; set; } = true;
|
public bool IsTrusted { get; set; } = true;
|
||||||
public Type[] ParameterTypes { get; set; } = Type.EmptyTypes;
|
public Type[] ParameterTypes { get; set; } = Type.EmptyTypes;
|
||||||
public Type? ReturnType { get; set; }
|
public Type? ReturnType { get; set; }
|
||||||
public Type SuitableType { get; set; }
|
public Type SuitableType { get; set; } = typeof(object);
|
||||||
|
|
||||||
public Action<object, object?[]?, object[], Action<object?>> Invoking { get; set; } =
|
public Action<object, object?[]?, object[], Action<object?>> Invoking { get; set; } =
|
||||||
(_, _, _, post) => { post.Invoke(null); };
|
(_, _, _, post) => { post.Invoke(null); };
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
using mROA.Implementation.Attributes;
|
|
||||||
|
|
||||||
// ReSharper disable UnusedMember.Global
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
@@ -9,7 +7,7 @@ namespace mROA.Implementation
|
|||||||
{
|
{
|
||||||
public class NetworkMessageHeader
|
public class NetworkMessageHeader
|
||||||
{
|
{
|
||||||
protected bool Equals(NetworkMessageHeader other)
|
private bool Equals(NetworkMessageHeader other)
|
||||||
{
|
{
|
||||||
return Id.Equals(other.Id) && MessageType == other.MessageType;
|
return Id.Equals(other.Id) && MessageType == other.MessageType;
|
||||||
}
|
}
|
||||||
@@ -22,11 +20,6 @@ namespace mROA.Implementation
|
|||||||
return Equals((NetworkMessageHeader)obj);
|
return Equals((NetworkMessageHeader)obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return HashCode.Combine(Id, (int)MessageType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly NetworkMessageHeader Null = new();
|
public static readonly NetworkMessageHeader Null = new();
|
||||||
public NetworkMessageHeader()
|
public NetworkMessageHeader()
|
||||||
{
|
{
|
||||||
@@ -43,13 +36,8 @@ namespace mROA.Implementation
|
|||||||
}
|
}
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
|
||||||
public EMessageType MessageType { get; set; }
|
public EMessageType MessageType { get; set; }
|
||||||
|
|
||||||
public byte[] Data { get; set; }
|
public byte[] Data { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
[SerializationIgnore]
|
|
||||||
public object Parced { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using mROA.Abstract;
|
using mROA.Abstract;
|
||||||
|
#pragma warning disable CS8602 // Dereference of a possibly null reference.
|
||||||
|
|
||||||
namespace mROA.Implementation
|
namespace mROA.Implementation
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user