2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-09-13 12:43:17 +00:00
This commit is contained in:
2025-08-24 05:58:40 +03:00
parent b12939e109
commit a1353a03ad
7 changed files with 92 additions and 55 deletions

View File

@@ -114,10 +114,16 @@ public static class DataSerializer
public static (TransmissionTypeIdentifier, byte[]) EnumComposer(object value, DistributedConnection connection)
{
Console.WriteLine(value.GetType().Name);
if (value == null)
return (TransmissionTypeIdentifier.Null, new byte[0]);
var template = connection.Instance.Warehouse.GetTemplateByType(value.GetType());
var warehouse = connection?.Instance?.Warehouse ?? connection?.Server?.Instance?.Warehouse;
if (warehouse == null)
throw new Exception("Warehouse not set.");
var template = warehouse.GetTemplateByType(value.GetType());
var intVal = Convert.ChangeType(value, (value as Enum).GetTypeCode());