Skip to content

Commit

Permalink
Remove binary DataMemberMode (stride3d#2094)
Browse files Browse the repository at this point in the history
  • Loading branch information
IXLLEGACYIXL authored Jan 20, 2024
1 parent ddc7423 commit 9ce2451
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 29 deletions.
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -1 +1 @@
90DA134A378FE0AC0D0A140CAFCC3EC35219677AA2A4A9C9868F8BF884A91B01
DE4411933DCBF0757EBDEE0114C51DC83E5E68A2E9D7E22F1EE0398913AEAC5D
Git LFS file not shown
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BFE7D3C7730ED74698052516FFD23052551DA0B625689910B2D19CC3FA917F7C
07CD7154F4FEBCB096C26E3B1A6A3E642DF9DC4C986E5F68E5FD85DE24CC3265
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,6 @@ protected virtual bool PrepareMember(MemberDescriptorBase member, MemberInfo met
return false;
}

if (member.Mode == DataMemberMode.Binary)
{
if (!memberType.IsArray)
throw new InvalidOperationException($"{memberType.FullName} {member.OriginalName} of {Type.FullName} is not an array. Can not be serialized as binary.");
if (!memberType.GetElementType().IsPureValueType())
throw new InvalidOperationException($"{memberType.GetElementType()} is not a pure ValueType. {memberType.FullName} {member.OriginalName} of {Type.FullName} can not serialize as binary.");
}

// If this member cannot be serialized, remove it from the list
if (member.Mode == DataMemberMode.Never)
{
Expand Down
15 changes: 4 additions & 11 deletions sources/core/Stride.Core/DataMemberMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,26 @@ public enum DataMemberMode
/// <summary>
/// Use the default mode depending on the type of the field/property.
/// </summary>
Default,
Default = 0,

/// <summary>
/// When restored, new object is created by using the parameters in
/// the YAML data and assigned to the property / field. When the
/// property / field is writeable, this is the default.
/// </summary>
Assign,
Assign = 1,

/// <summary>
/// Only valid for a property / field that return a class, no strings, primitives or value types.
/// When restored, instead of recreating the whole class,
/// the members are independently restored. When the property / field
/// is not writeable this is the default.
/// </summary>
Content,

/// <summary>
/// Only valid for a property / field that has an array type of
/// some value type. The content of the array is stored in a binary
/// format encoded in base64 style.
/// </summary>
Binary,
Content = 2,

/// <summary>
/// The property / field will not be stored.
/// </summary>
Never,
Never = 4,
}
}

0 comments on commit 9ce2451

Please sign in to comment.