Browse Source

revert Newtonsoft.Json

tags/3.0
Gang Zhuo 9 years ago
parent
commit
8a6249c4a3
4 changed files with 11 additions and 4 deletions
  1. +2
    -1
      shadowsocks-csharp/Controller/Strategy/StatisticsStrategy.cs
  2. +4
    -3
      shadowsocks-csharp/Model/StatisticsStrategyConfiguration.cs
  3. +1
    -0
      shadowsocks-csharp/packages.config
  4. +4
    -0
      shadowsocks-csharp/shadowsocks-csharp.csproj

+ 2
- 1
shadowsocks-csharp/Controller/Strategy/StatisticsStrategy.cs View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Threading;
using Newtonsoft.Json;
using Shadowsocks.Model;

namespace Shadowsocks.Controller.Strategy
@@ -65,7 +66,7 @@ namespace Shadowsocks.Controller.Strategy
score += statisticsData.MinResponse*factor;
if (!config.Calculations.TryGetValue("MaxResponse", out factor)) factor = 0;
score += statisticsData.MaxResponse*factor;
Logging.Debug($"{serverName} {SimpleJson.SimpleJson.SerializeObject(statisticsData)}");
Logging.Debug($"{serverName} {JsonConvert.SerializeObject(statisticsData)}");
return score;
}



+ 4
- 3
shadowsocks-csharp/Model/StatisticsStrategyConfiguration.cs View File

@@ -6,6 +6,7 @@ using System.Reflection;
using Shadowsocks.Controller;
using Shadowsocks.Controller.Strategy;
using SimpleJson;
using Newtonsoft.Json;

namespace Shadowsocks.Model
{
@@ -28,10 +29,10 @@ namespace Shadowsocks.Model
try
{
var content = File.ReadAllText(ConfigFile);
var configuration = SimpleJson.SimpleJson.DeserializeObject<StatisticsStrategyConfiguration>(content);
var configuration = JsonConvert.DeserializeObject<StatisticsStrategyConfiguration>(content);
return configuration;
}
catch (FileNotFoundException)
catch (FileNotFoundException e)
{
var configuration = new StatisticsStrategyConfiguration();
Save(configuration);
@@ -48,7 +49,7 @@ namespace Shadowsocks.Model
{
try
{
var content = SimpleJson.SimpleJson.SerializeObject(configuration);
var content = JsonConvert.SerializeObject(configuration, Formatting.Indented);
File.WriteAllText(ConfigFile, content);
}
catch (Exception e)


+ 1
- 0
shadowsocks-csharp/packages.config View File

@@ -5,4 +5,5 @@
<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.Build" version="1.0.14" targetFramework="net4-client" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net4-client" />
</packages>

+ 4
- 0
shadowsocks-csharp/shadowsocks-csharp.csproj View File

@@ -81,6 +81,10 @@
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<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="PresentationFramework" />
<Reference Include="System" />


Loading…
Cancel
Save