[longomatch] Move the JsonConverter from the type to the serializer



commit ba792ddecb67badfa8713cd188901619372f1cf4
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Mar 13 15:47:51 2015 +0100

    Move the JsonConverter from the type to the serializer
    
    This way it can be configured more easilly when using
    a different serializer, like the one for the DB

 LongoMatch.Core/Common/Color.cs      |    1 -
 LongoMatch.Core/Common/Image.cs      |    1 -
 LongoMatch.Core/Common/Serializer.cs |    2 ++
 LongoMatch.Core/Store/HotKey.cs      |    1 -
 LongoMatch.Core/Store/Point.cs       |    1 -
 LongoMatch.Core/Store/Time.cs        |    1 -
 6 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Color.cs b/LongoMatch.Core/Common/Color.cs
index 0191971..1b81d46 100644
--- a/LongoMatch.Core/Common/Color.cs
+++ b/LongoMatch.Core/Common/Color.cs
@@ -21,7 +21,6 @@ using System.Globalization;
 
 namespace LongoMatch.Core.Common
 {
-       [JsonConverter (typeof (LongoMatchConverter))]
        [Serializable]
        public class Color
        {
diff --git a/LongoMatch.Core/Common/Image.cs b/LongoMatch.Core/Common/Image.cs
index 32740cd..a8daa42 100644
--- a/LongoMatch.Core/Common/Image.cs
+++ b/LongoMatch.Core/Common/Image.cs
@@ -30,7 +30,6 @@ namespace LongoMatch.Core.Common
 #endif
 
        [Serializable]
-       [JsonConverter (typeof(LongoMatchConverter))]
        public class Image: ISerializable, IDisposable
        {
                SImage image;
diff --git a/LongoMatch.Core/Common/Serializer.cs b/LongoMatch.Core/Common/Serializer.cs
index dcc3f15..12f7b45 100644
--- a/LongoMatch.Core/Common/Serializer.cs
+++ b/LongoMatch.Core/Common/Serializer.cs
@@ -117,6 +117,7 @@ namespace LongoMatch.Core.Common
                                settings.PreserveReferencesHandling = PreserveReferencesHandling.Objects;
                                settings.TypeNameHandling = TypeNameHandling.Objects;
                                settings.Converters.Add (new VersionConverter ());
+                               settings.Converters.Add (new LongoMatchConverter ());
                                //settings.ReferenceResolver = new IdReferenceResolver ();
                                return settings;
                        }
@@ -190,6 +191,7 @@ namespace LongoMatch.Core.Common
                        return (
                                objectType == typeof(Time) ||
                                objectType == typeof(Color) ||
+                               objectType == typeof(Point) ||
                                objectType == typeof(HotKey) ||
                                objectType == typeof(Image));
                }
diff --git a/LongoMatch.Core/Store/HotKey.cs b/LongoMatch.Core/Store/HotKey.cs
index 9da973a..575dd7b 100644
--- a/LongoMatch.Core/Store/HotKey.cs
+++ b/LongoMatch.Core/Store/HotKey.cs
@@ -30,7 +30,6 @@ namespace LongoMatch.Core.Store
        /// 'key' and 'modifier' are set to -1 when it's initialized
        /// </summary>
        [Serializable]
-       [JsonConverter (typeof (LongoMatchConverter))]
        public class HotKey : IEquatable<HotKey>
        {
                #region Constructors
diff --git a/LongoMatch.Core/Store/Point.cs b/LongoMatch.Core/Store/Point.cs
index c9ff100..c8b3c0d 100644
--- a/LongoMatch.Core/Store/Point.cs
+++ b/LongoMatch.Core/Store/Point.cs
@@ -24,7 +24,6 @@ namespace LongoMatch.Core.Common
 {
        
        [Serializable]
-       [JsonConverter (typeof (LongoMatchConverter))]
        public class Point {
 
                public Point (double x, double y) {
diff --git a/LongoMatch.Core/Store/Time.cs b/LongoMatch.Core/Store/Time.cs
index 7eefbcd..f7e48c1 100644
--- a/LongoMatch.Core/Store/Time.cs
+++ b/LongoMatch.Core/Store/Time.cs
@@ -30,7 +30,6 @@ namespace LongoMatch.Core.Store
        /// It's expressed in miliseconds and provide some helper methods for time conversion and 
representation
        /// </summary>
        [Serializable]
-       [JsonConverter (typeof (LongoMatchConverter))]
        public class Time :  IComparable
        {
                private const int MS = 1000000 ;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]