@@ -4,6 +4,7 @@ using System.Linq; | |||||
using System.Net; | using System.Net; | ||||
using System.Net.NetworkInformation; | using System.Net.NetworkInformation; | ||||
using System.Threading; | using System.Threading; | ||||
using Newtonsoft.Json; | |||||
using Shadowsocks.Model; | using Shadowsocks.Model; | ||||
namespace Shadowsocks.Controller.Strategy | namespace Shadowsocks.Controller.Strategy | ||||
@@ -65,7 +66,7 @@ namespace Shadowsocks.Controller.Strategy | |||||
score += statisticsData.MinResponse*factor; | score += statisticsData.MinResponse*factor; | ||||
if (!config.Calculations.TryGetValue("MaxResponse", out factor)) factor = 0; | if (!config.Calculations.TryGetValue("MaxResponse", out factor)) factor = 0; | ||||
score += statisticsData.MaxResponse*factor; | score += statisticsData.MaxResponse*factor; | ||||
Logging.Debug($"{serverName} {SimpleJson.SimpleJson.SerializeObject(statisticsData)}"); | |||||
Logging.Debug($"{serverName} {JsonConvert.SerializeObject(statisticsData)}"); | |||||
return score; | return score; | ||||
} | } | ||||
@@ -6,6 +6,7 @@ using System.Reflection; | |||||
using Shadowsocks.Controller; | using Shadowsocks.Controller; | ||||
using Shadowsocks.Controller.Strategy; | using Shadowsocks.Controller.Strategy; | ||||
using SimpleJson; | using SimpleJson; | ||||
using Newtonsoft.Json; | |||||
namespace Shadowsocks.Model | namespace Shadowsocks.Model | ||||
{ | { | ||||
@@ -28,10 +29,10 @@ namespace Shadowsocks.Model | |||||
try | try | ||||
{ | { | ||||
var content = File.ReadAllText(ConfigFile); | var content = File.ReadAllText(ConfigFile); | ||||
var configuration = SimpleJson.SimpleJson.DeserializeObject<StatisticsStrategyConfiguration>(content); | |||||
var configuration = JsonConvert.DeserializeObject<StatisticsStrategyConfiguration>(content); | |||||
return configuration; | return configuration; | ||||
} | } | ||||
catch (FileNotFoundException) | |||||
catch (FileNotFoundException e) | |||||
{ | { | ||||
var configuration = new StatisticsStrategyConfiguration(); | var configuration = new StatisticsStrategyConfiguration(); | ||||
Save(configuration); | Save(configuration); | ||||
@@ -48,7 +49,7 @@ namespace Shadowsocks.Model | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
var content = SimpleJson.SimpleJson.SerializeObject(configuration); | |||||
var content = JsonConvert.SerializeObject(configuration, Formatting.Indented); | |||||
File.WriteAllText(ConfigFile, content); | File.WriteAllText(ConfigFile, content); | ||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||
@@ -5,4 +5,5 @@ | |||||
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net4-client" /> | <package id="Microsoft.Bcl" version="1.1.8" targetFramework="net4-client" /> | ||||
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net4-client" /> | <package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net4-client" /> | ||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net4-client" /> | <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net4-client" /> | ||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net4-client" /> | |||||
</packages> | </packages> |
@@ -81,6 +81,10 @@ | |||||
<EmbedInteropTypes>False</EmbedInteropTypes> | <EmbedInteropTypes>False</EmbedInteropTypes> | ||||
</Reference> | </Reference> | ||||
<Reference Include="Microsoft.VisualBasic" /> | <Reference Include="Microsoft.VisualBasic" /> | ||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | |||||
<HintPath>3rd\Newtonsoft.Json.7.0.1\lib\net40\Newtonsoft.Json.dll</HintPath> | |||||
<Private>True</Private> | |||||
</Reference> | |||||
<Reference Include="PresentationCore" /> | <Reference Include="PresentationCore" /> | ||||
<Reference Include="PresentationFramework" /> | <Reference Include="PresentationFramework" /> | ||||
<Reference Include="System" /> | <Reference Include="System" /> | ||||