|
@@ -654,9 +654,9 @@ namespace InABox.Core
|
|
|
return (result != null ? (T)result : default)!;
|
|
|
}
|
|
|
|
|
|
- public static IEnumerable<IProperty> SerializableProperties(Type type) =>
|
|
|
+ public static IEnumerable<IProperty> SerializableProperties(Type type, Predicate<IProperty>? filter = null) =>
|
|
|
DatabaseSchema.Properties(type)
|
|
|
- .Where(x => !(x is StandardProperty st) || st.IsSerializable);
|
|
|
+ .Where(x => (!(x is StandardProperty st) || st.IsSerializable) && (filter?.Invoke(x) ?? true));
|
|
|
|
|
|
private static void WriteOriginalValues<TObject>(this CoreBinaryWriter writer, TObject obj)
|
|
|
where TObject : BaseObject
|
|
@@ -773,7 +773,7 @@ namespace InABox.Core
|
|
|
public static void WriteObjects<TObject>(this CoreBinaryWriter writer, ICollection<TObject>? objects)
|
|
|
where TObject : BaseObject, new() => WriteObjects(writer, typeof(TObject), objects);
|
|
|
|
|
|
- public static void WriteObjects<TObject>(this CoreBinaryWriter writer, Type type, ICollection<TObject>? objects)
|
|
|
+ public static void WriteObjects<TObject>(this CoreBinaryWriter writer, Type type, ICollection<TObject>? objects, Predicate<IProperty>? filter = null)
|
|
|
where TObject : BaseObject
|
|
|
{
|
|
|
if (!typeof(TObject).IsAssignableFrom(type))
|
|
@@ -787,7 +787,7 @@ namespace InABox.Core
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var properties = SerializableProperties(type).ToList();
|
|
|
+ var properties = SerializableProperties(type, filter).ToList();
|
|
|
writer.Write(properties.Count);
|
|
|
foreach (var property in properties)
|
|
|
{
|