瀏覽代碼

More compatability bug fixes with filters.

Kenric Nugteren 7 月之前
父節點
當前提交
2912bd0054
共有 2 個文件被更改,包括 16 次插入4 次删除
  1. 5 1
      InABox.Core/CoreUtils.cs
  2. 11 3
      InABox.Core/Query/Filter.cs

+ 5 - 1
InABox.Core/CoreUtils.cs

@@ -2021,7 +2021,11 @@ namespace InABox.Core
         }
         public static Expression DeserialiseExpression(this CoreBinaryReader reader, Type t)
         {
-            var expressionType = (SerialisedExpressionType)reader.ReadByte();
+            return DeserialiseExpression(reader, t, reader.ReadByte());
+        }
+        public static Expression DeserialiseExpression(this CoreBinaryReader reader, Type t, byte type)
+        {
+            var expressionType = (SerialisedExpressionType)type;
             switch (expressionType)
             {
                 case SerialisedExpressionType.Member:

+ 11 - 3
InABox.Core/Query/Filter.cs

@@ -1523,9 +1523,17 @@ namespace InABox.Core
         public void DeserializeBinary(CoreBinaryReader reader)
         {
             // For compatability purposes when redesigning system to no longer use Serializable Expression.
-            reader.ReadByte();
-
-            Property = reader.ReadString();
+            var b = reader.ReadByte();
+            if(b != 0)
+            {
+                var exp = reader.DeserialiseExpression(typeof(T), b);
+                Property = CoreUtils.ExpressionToString(typeof(object), exp);
+                Logger.Send(LogType.Information, "", $"Non-zero byte: {Property} ({exp.Type})");
+            }
+            else
+            {
+                Property = reader.ReadString();
+            }
 
             Operator = (Operator)reader.ReadByte();
             if(Operator == Operator.Not)