浏览代码

Updated Filters And SortOrders to save their enums as numbers, to prevent inconsistencies between versions.

Kenric Nugteren 1 月之前
父节点
当前提交
334710f0ad
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 2
      InABox.Core/Query/Filter.cs
  2. 1 1
      InABox.Core/Query/SortOrder.cs

+ 2 - 2
InABox.Core/Query/Filter.cs

@@ -2237,11 +2237,11 @@ namespace InABox.Core
             // For the above reader to work, the $type property *must* be serialised first.
             writer.WriteString("$type", filter.GetType().FullName);
             writer.WriteString("Expression", prop);
-            writer.WriteString("Operator", op.ToString());
+            writer.WriteNumber("Operator", (int)op);
             writer.WriteBoolean("IsNot", filter.IsNot);
 
             if (val is FilterConstant fcVal)
-                writer.WriteString("FilterConstant", fcVal.ToString());
+                writer.WriteNumber("FilterConstant", (int)fcVal);
             else if(val is CustomFilterValue cVal)
                 writer.WriteBase64String("CustomValue", cVal.Data);
             else

+ 1 - 1
InABox.Core/Query/SortOrder.cs

@@ -336,7 +336,7 @@ namespace InABox.Core
             
             writer.WriteString("$type", value.GetType().FullName);
             writer.WriteString("Expression", prop);
-            writer.WriteString("Direction", dir.ToString());
+            writer.WriteNumber("Direction", (int)dir);
 
             if(value.Thens.Any())
             {