Skip to content

Commit

Permalink
Correct Issue onryldz#128 in TSuperArray.SaveTo(Stream
Browse files Browse the repository at this point in the history
Add support to deserialize TGUID in Issue onryldz#127
  • Loading branch information
MarkRSill committed Nov 13, 2018
1 parent 4e60eb8 commit 35528ad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion XSuperObject.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ procedure TSuperArray.SaveTo(Stream: TStream; const Ident, UniversalTime: Boolea
begin
S := TStringStream.Create( AsJSON(Ident, UniversalTime) );
try
S.SaveToStream(S);
S.SaveToStream(Stream);
finally
S.Free;
end;
Expand Down Expand Up @@ -2424,6 +2424,14 @@ class procedure TSerializeParse.WriteMember<T, Typ>(Data: Pointer; Member: Typ;
SetValue<Typ>(Data, MemberValue, Member, TValue.From<TDateTime>(Ancestor.AsVariant))
end
else
// Handle TGUID
if (RType = TypeInfo(TGUID)) then
begin
if IJSONData.Ancestor[Member].DataType <> dtNull then
SetValue(Data, MemberValue, Member, TValue.From(StringToGuid(IJSONData.Ancestor[Member].AsVariant)))
end
else
// End TGUID
case RType.Kind of
tkInteger:
SetValue<Typ>(Data, MemberValue, Member, Integer(IJSonData.I[Member]));
Expand Down

0 comments on commit 35528ad

Please sign in to comment.