compat
This commit is contained in:
@@ -43,11 +43,8 @@ namespace shadowsocks_csharp.Model
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = "[0,1,2]";
|
||||
var result = SimpleJson.SimpleJson.DeserializeObject<List<int>>(json);
|
||||
|
||||
string configContent = File.ReadAllText(CONFIG_FILE);
|
||||
Configuration config = SimpleJson.SimpleJson.DeserializeObject<Configuration>(configContent);
|
||||
Configuration config = SimpleJson.SimpleJson.DeserializeObject<Configuration>(configContent, new JsonSerializerStrategy());
|
||||
config.isDefault = false;
|
||||
return config;
|
||||
}
|
||||
@@ -129,5 +126,18 @@ namespace shadowsocks_csharp.Model
|
||||
throw new ArgumentException("server can not be blank");
|
||||
}
|
||||
}
|
||||
|
||||
private class JsonSerializerStrategy : SimpleJson.PocoJsonSerializerStrategy
|
||||
{
|
||||
// convert string to int
|
||||
public override object DeserializeObject(object value, Type type)
|
||||
{
|
||||
if (type == typeof(Int32) && value.GetType() == typeof(string))
|
||||
{
|
||||
return Int32.Parse(value.ToString());
|
||||
}
|
||||
return base.DeserializeObject(value, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;SIMPLE_JSON_REFLECTIONEMIT</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
|
||||
Submodule shadowsocks-csharp/simple-json updated: 663c62a77a...6b632fd304
Reference in New Issue
Block a user