Implement new transition.
This commit is contained in:
19
Assets/Cryville/Crtr/JsonPdtExpConverter.cs
Normal file
19
Assets/Cryville/Crtr/JsonPdtExpConverter.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Cryville.Common.Pdt;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
public class JsonPdtExpConverter : JsonConverter<PdtExpression> {
|
||||
static readonly PdtFragmentInterpreter _itor = new PdtFragmentInterpreter();
|
||||
public override PdtExpression ReadJson(JsonReader reader, Type objectType, PdtExpression existingValue, bool hasExistingValue, JsonSerializer serializer) {
|
||||
_itor.SetSource((string)reader.Value);
|
||||
return _itor.GetExp();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, PdtExpression value, JsonSerializer serializer) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override bool CanWrite { get { return false; } }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user