Skip to content

Commit 6a663bd

Browse files
committed
chore(Assistant v2): Implement TryDeserialize and CreateInstance on MessageInput
1 parent 36a89e8 commit 6a663bd

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Scripts/Services/Assistant/v2/Models/MessageInput.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*
1616
*/
1717
using FullSerializer;
18+
using FullSerializer.Internal;
1819
using System;
1920
using System.Collections.Generic;
2021
using System.Runtime.Serialization;
@@ -86,7 +87,22 @@ public override bool CanProcess(Type type)
8687

8788
public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType)
8889
{
89-
throw new NotImplementedException();
90+
if (data.IsString == false)
91+
{
92+
return fsResult.Fail("Type converter requires a string");
93+
}
94+
95+
instance = fsTypeCache.GetType(data.AsString);
96+
if (instance == null)
97+
{
98+
return fsResult.Fail("Unable to find type " + data.AsString);
99+
}
100+
return fsResult.Success;
101+
}
102+
103+
public override object CreateInstance(fsData data, Type storageType)
104+
{
105+
return new MessageInput();
90106
}
91107

92108
public override fsResult TrySerialize(object instance, out fsData serialized, Type storageType)

0 commit comments

Comments
 (0)