Permalink
Browse files

Replacing json serialization library with Newtonsoft.Json for indente…

…d formatting of the .giles save file (for readability)
  • Loading branch information...
1 parent 526eda6 commit 1d569a250da2ba211a16c8e3efe92a46ee9d59f8 @codereflection committed Feb 23, 2012
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,13 +1,13 @@
using System.Collections.Generic;
using System.ComponentModel;
-using System.Web.Script.Serialization;
using Giles.Core.UI;
+using Newtonsoft.Json;
namespace Giles.Core.Configuration
{
public class GilesConfig : INotifyPropertyChanged
{
- [ScriptIgnore]
+ [JsonIgnore]
public List<IUserDisplay> UserDisplay = new List<IUserDisplay>();
private long buildDelay = 500;
public List<string> Filters { get; set; }
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
-using System.Web.Script.Serialization;
using Giles.Core.UI;
+using Newtonsoft.Json;
namespace Giles.Core.Configuration
{
@@ -21,7 +21,7 @@ public GilesConfig Build()
{
var path = GilesConfigPath(solutionPath);
if (File.Exists(path))
- config = new JavaScriptSerializer().Deserialize<GilesConfig>(File.ReadAllText(path));
+ config = JsonConvert.DeserializeObject<GilesConfig>(File.ReadAllText(path));
else
{
config.TestAssemblies = testAssemblies;
@@ -35,8 +35,7 @@ public GilesConfig Build()
public static string Save(GilesConfig config)
{
- var serializer = new JavaScriptSerializer();
- var data = serializer.Serialize(config);
+ var data = JsonConvert.SerializeObject(config, Formatting.Indented);
var path = GilesConfigPath(config.SolutionPath);
File.WriteAllText(path, data);
@@ -98,12 +98,14 @@
<Reference Include="Growl.CoreLibrary">
<HintPath>..\..\lib\Growl.Connector\Growl.CoreLibrary.dll</HintPath>
</Reference>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\..\lib\Newtonsoft.Json.4.0.8\lib\net40\Newtonsoft.Json.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Security" />
- <Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>

0 comments on commit 1d569a2

Please sign in to comment.