40 lines
864 B
C#
40 lines
864 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Globalization;
|
|
using System;
|
|
using System.Numerics;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
{
|
|
public class BigIntegerSerializer: CustomSerializer
|
|
{
|
|
public override List<Type> HandlingTypes()
|
|
{
|
|
return new List<Type>(){ typeof( BigInteger ) };
|
|
}
|
|
|
|
|
|
public override JSONData Serialize( object value )
|
|
{
|
|
var bigInteger = (BigInteger) value;
|
|
return new JSONValue( bigInteger.ToString( "R" ) );
|
|
}
|
|
|
|
public override void Deserialize( JSONData data, Reference referenceRelation )
|
|
{
|
|
if ( referenceRelation.target == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
var bigInteger = BigInteger.Parse( data.stringValue );
|
|
|
|
referenceRelation.AssignValue( bigInteger );
|
|
}
|
|
}
|
|
} |