Add JSONIpv6Mapping
parent
0d3c6b50fc
commit
5262b420ea
|
@ -55,6 +55,7 @@
|
|||
<Compile Include="mapping\JSONEnumMapping.cs" />
|
||||
<Compile Include="mapping\JSONDictionaryMapping.cs" />
|
||||
<Compile Include="mapping\JSONExceptionMapping.cs" />
|
||||
<Compile Include="mapping\JSONIPv6Mapping.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="mapping\" />
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// /**
|
||||
// * File: JSONIPv6Mapping.cs
|
||||
// * Author: haraldwolff
|
||||
// *
|
||||
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
||||
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
||||
// *
|
||||
// *
|
||||
// **/
|
||||
using System;
|
||||
using ln.types;
|
||||
namespace ln.json.mapping
|
||||
{
|
||||
public class JSONIPv6Mapping : JSONMapping
|
||||
{
|
||||
public JSONIPv6Mapping() :base(typeof(IPv6))
|
||||
{
|
||||
}
|
||||
|
||||
public override object FromJson(JSONMapper mapper, JSONValue json)
|
||||
{
|
||||
return IPv6.Parse((json as JSONString).Value);
|
||||
}
|
||||
|
||||
public override JSONValue ToJson(JSONMapper mapper, object value)
|
||||
{
|
||||
return new JSONString((value as IPv6).ToCIDR());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -108,6 +108,8 @@ namespace ln.json.mapping
|
|||
Add(new JSONRPCCallMapping());
|
||||
Add(new JSONRPCResultMapping());
|
||||
|
||||
Add(new JSONIPv6Mapping());
|
||||
|
||||
}
|
||||
|
||||
public void Add(JSONMapping mapping)
|
||||
|
|
Loading…
Reference in New Issue