From 33c2d69b548229664a0fac7b64e59fb193a76e25 Mon Sep 17 00:00:00 2001 From: JamesNK Date: Sun, 21 Sep 2008 10:23:55 +0000 Subject: [PATCH] -Added compact framework support -Refactored JavaScriptConvert to not rely on DateTimeOffset when converting dates -Refactored JsonSerializer to use new CreateInstance on ReflectionUtils -Deleted JsonHandler --- Src/Lib/NUnitLite.dll | Bin 0 -> 74752 bytes Src/Newtonsoft.Json.Compact.sln | 31 + .../JavaScriptConvertTest.cs | 2 + .../JsonSerializerTest.cs | 12 + Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs | 6 +- .../Newtonsoft.Json.Tests.Compact.csproj | 103 ++++ Src/Newtonsoft.Json.Tests/PerformanceTests.cs | 2 +- .../Properties/AssemblyInfo.cs | 10 +- .../Converters/HtmlColorConverter.cs | 2 +- .../Converters/IsoDateTimeConverter.cs | 8 +- .../Converters/JavaScriptDateTimeConverter.cs | 8 +- .../Converters/XmlNodeConverter.cs | 1 - Src/Newtonsoft.Json/DateTimeOffset.cs | 558 ++++++++++++++++++ Src/Newtonsoft.Json/JavaScriptConvert.cs | 26 +- Src/Newtonsoft.Json/JsonHandler.cs | 90 --- Src/Newtonsoft.Json/JsonSerializer.cs | 4 +- Src/Newtonsoft.Json/Linq/JValue.cs | 4 +- .../Newtonsoft.Json.Compact.csproj | 133 +++++ .../Newtonsoft.Json.Silverlight.csproj | 4 - .../Properties/AssemblyInfo.cs | 15 +- .../Utilities/CollectionUtils.cs | 2 +- Src/Newtonsoft.Json/Utilities/ConvertUtils.cs | 4 + .../Utilities/DateTimeUtils.cs | 7 +- .../Utilities/MiscellaneousUtils.cs | 45 -- .../Utilities/ReflectionUtils.cs | 93 +-- 25 files changed, 960 insertions(+), 210 deletions(-) create mode 100644 Src/Lib/NUnitLite.dll create mode 100644 Src/Newtonsoft.Json.Compact.sln create mode 100644 Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj create mode 100644 Src/Newtonsoft.Json/DateTimeOffset.cs delete mode 100644 Src/Newtonsoft.Json/JsonHandler.cs create mode 100644 Src/Newtonsoft.Json/Newtonsoft.Json.Compact.csproj diff --git a/Src/Lib/NUnitLite.dll b/Src/Lib/NUnitLite.dll new file mode 100644 index 0000000000000000000000000000000000000000..3cc074fde18aee6673edd0aaa2bda2f9c035545d GIT binary patch literal 74752 zcmeFa37AyH^#@w_*6rKt4AZmp49lzx*w8aDASxgzASx;AsEJFWzTY`jxBB+XpeFz1eR<#aCb7DHr%s(Z zb?Vf5>s}5&Zkdom2nYZD_@fXT@JoM#IQ;3L8OiyT_vefC;b*EhSi_&GKKk@CnyRK` z(x+ukI=kxRlO|72Ppg`EN>yh1=n)4BG2D{kyt0>v zd8O?Xc6HPW3DLl$0{(yYS3|`j zY9V(t#Ub|_GDOS236_X~wyvKgI<-vuDO@E4YGD3Cz@~zr_Lz3cjA{6t-vRm}jq9rQ z2I9XeAtv<5G-XZ(V%?x4SF{4ZzP~}xzDMSiNog>Wt^zu<4Qg8P4e@2;=mfGW{zx}l z1jOf83bFAfA#!sv%P$Iw8f=jOC-TR|HfUof^M#1m>2?SsDdBb(qNu?UqzI}T7xtxR zEDeG`l86es$Vn6hQtjhTJaA3S4R$FV6Ah)&fRQ!vK7lzB4{J7pUc&pm@}lP-rO7Ti0*y`dS(JKZbnWCapDpW6W$FbB$; z4nMXcy1}?J6x!TR($FbV6zF?5SesC0BfzAy(>09|S|3FAYbH zbPZM>pRT1yqR2`05OD`}rj9|J;b3K*N({PjC*1{X>8`{JHuO*Q6F0pFu*Y+@-PU+l|>@1sbDl!FM_Ii@Yk^GRnE18m-U8)lPEc&R2D&uML`T! zKR96B>UtG(S$WTY9iB@t)MeYKE~HG7vPz@Dr6e_`2zjY8;fC3UMNTLz=uJ)<{t+1)aa>kyqHx@@H7>r8H z791H}doW<89A z@fmey+Dm@X9-j-oKnVhPXZIeN!{HgtWH8gO9<@tnV=#2=CbUarHpVZXCdnIi*xfx#v=6WG#lODk=xKC)F7aS7Yyub0_?^U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dssu#<($#VHDRLx{<(m#F&e>23l1jh3ORhU0` zk7@^DUYG$SR6rc&;6)easO3H8pvMecI~L(hqANvamdOm0X(naqJ&g&bJ^Jw8EV8qb zEz`j*12EEACWKU;o-KhabMuYanQ7Q=4@!FeS?=j2&x4JEVwgWZw3@=d6D z|C3d4%oV$F%I(MH0yv#Nm4cbx#HRw}4M&Kt6-<3ptPfFtfuC%}qm1=Ee%4-IY-FA+ zn2PkOZ^wJ-g8-iiHXkXN+UUcW^~)D8zVfj;pFPC~JL@<2cp-xO1@qC1yWvY8e`T+I zq5X-=S1!DK@ugQU1g~7&y>R8_;H4{9Ub*zj#jpj34qpwZ_z}m?J@uW}dF9FC7XE+x z)q?r$XA0)#_R99xf3f$S%2z6D|NKk;)tfTcf0LtDUVFP4cKdIS7INX@;^oDQZzqFR zR=2$NHa=VMwmhGj)h_niyJr2hZ0;WObpUYJn3 z<8Pid^-pJA|33Hsm;!j;7%+Isn4@t-R5~s`rk?%CjJG~rFppr*+|Q%p%gDZo`0X8} ztGIu$joAAZ?l9cJbrbhf__je~er@8<|C&~Yyv!eW{Q)hC4RUq1%B&z$091yUcwdG= zwFW{wyr06KkIJYfS{XD;(9S@Ry&EAt{^JB*h6fn=fYE74?_pwmUY$J@x`(YVn9yiwD9i62A_?VNsaB>emA!FRV gLVd>c5VZK9ak6+O7Ylf6C("1"); Assert.AreEqual(1, i); +#if !PocketPC DateTimeOffset d = JavaScriptConvert.DeserializeObject(@"""\/Date(-59011455539000+0000)\/"""); Assert.AreEqual(new DateTimeOffset(new DateTime(100, 1, 1, 1, 1, 1, DateTimeKind.Utc)), d); +#endif bool b = JavaScriptConvert.DeserializeObject("true"); Assert.AreEqual(true, b); diff --git a/Src/Newtonsoft.Json.Tests/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/JsonSerializerTest.cs index 117425f6..6ad453e4 100644 --- a/Src/Newtonsoft.Json.Tests/JsonSerializerTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonSerializerTest.cs @@ -36,7 +36,9 @@ using System.Collections.ObjectModel; using Newtonsoft.Json.Linq; using System.Linq; using Newtonsoft.Json.Converters; +#if !PocketPC using System.Runtime.Serialization.Json; +#endif using Newtonsoft.Json.Utilities; using System.Globalization; using System.ComponentModel; @@ -742,6 +744,7 @@ keyword such as type of business."" Assert.AreEqual("Large", deserializedProductShort.Sizes[2]); } +#if !PocketPC [Test] public void Unicode() { @@ -781,6 +784,7 @@ keyword such as type of business."" result = JavaScriptConvert.SerializeObject(testDates); Assert.AreEqual(expected, result); } +#endif [Test] public void DateTimeOffset() @@ -1319,5 +1323,13 @@ keyword such as type of business."" new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }); Assert.AreEqual(@"{}", json); } + + [Test] + public void DeserializeStringDate() + { + string dateText = @"""\/Date(1221644506800-0700)\/"""; + + + } } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs index fee72e56..d35b5f5a 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs @@ -159,7 +159,11 @@ namespace Newtonsoft.Json.Tests.Linq public void Casting() { Assert.AreEqual(new DateTime(2000, 12, 20), (DateTime)new JValue(new DateTime(2000, 12, 20))); +#if !PocketPC Assert.AreEqual(new DateTimeOffset(2000, 12, 20, 23, 50, 10, TimeSpan.Zero), (DateTimeOffset)new JValue(new DateTimeOffset(2000, 12, 20, 23, 50, 10, TimeSpan.Zero))); + Assert.AreEqual(null, (DateTimeOffset?)new JValue((DateTimeOffset?)null)); + Assert.AreEqual(null, (DateTimeOffset?)(JValue)null); +#endif Assert.AreEqual(true, (bool)new JValue(true)); Assert.AreEqual(true, (bool?)new JValue(true)); Assert.AreEqual(null, (bool?)((JValue)null)); @@ -170,9 +174,7 @@ namespace Newtonsoft.Json.Tests.Linq Assert.AreEqual(null, (int?)new JValue((int?)null)); Assert.AreEqual(null, (int?)(JValue)null); Assert.AreEqual(null, (DateTime?)new JValue((DateTime?)null)); - Assert.AreEqual(null, (DateTimeOffset?)new JValue((DateTimeOffset?)null)); Assert.AreEqual(null, (DateTime?)(JValue)null); - Assert.AreEqual(null, (DateTimeOffset?)(JValue)null); Assert.AreEqual(null, (short?)new JValue((short?)null)); Assert.AreEqual(null, (short?)(JValue)null); Assert.AreEqual(null, (float?)new JValue((float?)null)); diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj new file mode 100644 index 00000000..bf7ebc84 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Compact.csproj @@ -0,0 +1,103 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {32EA9694-4FB3-43E9-A6AD-050F1D35EA0A} + Library + Properties + Newtonsoft.Json.Tests.Compact + Newtonsoft.Json.Tests.Compact + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + PocketPC + b2c48bd2-963d-4549-9169-1fa021dce484 + 5.2 + Newtonsoft.Json.Tests.Compact + v3.5 + Windows Mobile 6 Professional SDK + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE;$(PlatformFamilyName) + true + true + prompt + 512 + 4 + Off + + + pdbonly + true + bin\Release\ + TRACE;$(PlatformFamilyName) + true + true + prompt + 512 + 4 + Off + + + + + False + ..\Lib\NUnitLite.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {256AA604-F61B-4B6D-8D51-C8E6AB11E435} + Newtonsoft.Json.Compact + + + + + + + + + + + + \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/PerformanceTests.cs b/Src/Newtonsoft.Json.Tests/PerformanceTests.cs index 0004545b..2f117300 100644 --- a/Src/Newtonsoft.Json.Tests/PerformanceTests.cs +++ b/Src/Newtonsoft.Json.Tests/PerformanceTests.cs @@ -1,4 +1,4 @@ -#if !SILVERLIGHT +#if !SILVERLIGHT && !PocketPC using System; using System.Collections.Generic; using System.Globalization; diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs index 4999ec2d..5dfbc24e 100644 --- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -6,10 +6,12 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. -#if !SILVERLIGHT -[assembly: AssemblyTitle("Newtonsoft Json.NET Tests")] -#else +#if SILVERLIGHT [assembly: AssemblyTitle("Newtonsoft Json.NET Tests Silverlight")] +#elif PocketPC +[assembly: AssemblyTitle("Newtonsoft Json.NET Tests Compact")] +#else +[assembly: AssemblyTitle("Newtonsoft Json.NET Tests")] #endif [assembly: AssemblyDescription("")] @@ -38,4 +40,6 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("3.0.0.0")] +#if !PocketPC [assembly: AssemblyFileVersion("3.0.0.0")] +#endif \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Converters/HtmlColorConverter.cs b/Src/Newtonsoft.Json/Converters/HtmlColorConverter.cs index 807e2cf8..054f3203 100644 --- a/Src/Newtonsoft.Json/Converters/HtmlColorConverter.cs +++ b/Src/Newtonsoft.Json/Converters/HtmlColorConverter.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !SILVERLIGHT +#if !SILVERLIGHT && !PocketPC using System; using System.Collections.Generic; using System.Text; diff --git a/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs b/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs index fe9f7526..7e4ea01a 100644 --- a/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs @@ -120,8 +120,12 @@ namespace Newtonsoft.Json.Converters /// public override bool CanConvert(Type objectType) { - return (typeof(DateTime).IsAssignableFrom(objectType) - || typeof(DateTimeOffset).IsAssignableFrom(objectType)); + if (typeof(DateTime).IsAssignableFrom(objectType)) + return true; + if (typeof(DateTimeOffset).IsAssignableFrom(objectType)) + return true; + + return false; } } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs b/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs index 12b8cd1a..e20b2806 100644 --- a/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs @@ -79,8 +79,12 @@ namespace Newtonsoft.Json.Converters /// public override bool CanConvert(Type objectType) { - return (typeof(DateTime).IsAssignableFrom(objectType) - || typeof(DateTimeOffset).IsAssignableFrom(objectType)); + if (typeof(DateTime).IsAssignableFrom(objectType)) + return true; + if (typeof(DateTimeOffset).IsAssignableFrom(objectType)) + return true; + + return false; } } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs index 34bd47f0..6a934ab8 100644 --- a/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs +++ b/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; using System.Text; -using System.Drawing; using System.Xml; using Newtonsoft.Json.Utilities; using System.Linq; diff --git a/Src/Newtonsoft.Json/DateTimeOffset.cs b/Src/Newtonsoft.Json/DateTimeOffset.cs new file mode 100644 index 00000000..5670fd05 --- /dev/null +++ b/Src/Newtonsoft.Json/DateTimeOffset.cs @@ -0,0 +1,558 @@ +#if PocketPC +using System.Globalization; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; +using System.Security.Permissions; +using System; + +namespace Newtonsoft.Json +{ + public struct DateTimeOffset : IComparable, IFormattable, IComparable, IEquatable + { + private DateTime _dateTime; + private short _offsetMinutes; + internal const long MaxOffset = 0x7558bdb000L; + public static readonly DateTimeOffset MaxValue; + internal const long MinOffset = -504000000000L; + public static readonly DateTimeOffset MinValue; + + static DateTimeOffset() + { + MinValue = new DateTimeOffset(0L, TimeSpan.Zero); + MaxValue = new DateTimeOffset(0x2bca2875f4373fffL, TimeSpan.Zero); + } + + public DateTimeOffset(System.DateTime dateTime) + { + TimeSpan utcOffset; + if (dateTime.Kind != DateTimeKind.Utc) + { + utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime); + } + else + { + utcOffset = new TimeSpan(0L); + } + this._offsetMinutes = ValidateOffset(utcOffset); + this._dateTime = ValidateDate(dateTime, utcOffset); + } + + public DateTimeOffset(System.DateTime dateTime, TimeSpan offset) + { + if (dateTime.Kind == DateTimeKind.Local) + { + if (offset != TimeZone.CurrentTimeZone.GetUtcOffset(dateTime)) + { + throw new ArgumentException("The UTC Offset of the local dateTime parameter does not match the offset argument.", "offset"); + } + } + else if ((dateTime.Kind == DateTimeKind.Utc) && (offset != TimeSpan.Zero)) + { + throw new ArgumentException("The UTC Offset for Utc DateTime instances must be 0.", "offset"); + } + this._offsetMinutes = ValidateOffset(offset); + this._dateTime = ValidateDate(dateTime, offset); + } + + public DateTimeOffset(long ticks, TimeSpan offset) + { + this._offsetMinutes = ValidateOffset(offset); + System.DateTime dateTime = new System.DateTime(ticks); + this._dateTime = ValidateDate(dateTime, offset); + } + + public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, TimeSpan offset) + { + this._offsetMinutes = ValidateOffset(offset); + this._dateTime = ValidateDate(new System.DateTime(year, month, day, hour, minute, second), offset); + } + + public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, TimeSpan offset) + { + this._offsetMinutes = ValidateOffset(offset); + this._dateTime = ValidateDate(new System.DateTime(year, month, day, hour, minute, second, millisecond), offset); + } + + public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, TimeSpan offset) + { + this._offsetMinutes = ValidateOffset(offset); + this._dateTime = ValidateDate(new System.DateTime(year, month, day, hour, minute, second, millisecond, calendar), offset); + } + + public DateTimeOffset Add(TimeSpan timeSpan) + { + return new DateTimeOffset(this.ClockDateTime.Add(timeSpan), this.Offset); + } + + public DateTimeOffset AddDays(double days) + { + return new DateTimeOffset(this.ClockDateTime.AddDays(days), this.Offset); + } + + public DateTimeOffset AddHours(double hours) + { + return new DateTimeOffset(this.ClockDateTime.AddHours(hours), this.Offset); + } + + public DateTimeOffset AddMilliseconds(double milliseconds) + { + return new DateTimeOffset(this.ClockDateTime.AddMilliseconds(milliseconds), this.Offset); + } + + public DateTimeOffset AddMinutes(double minutes) + { + return new DateTimeOffset(this.ClockDateTime.AddMinutes(minutes), this.Offset); + } + + public DateTimeOffset AddMonths(int months) + { + return new DateTimeOffset(this.ClockDateTime.AddMonths(months), this.Offset); + } + + public DateTimeOffset AddSeconds(double seconds) + { + return new DateTimeOffset(this.ClockDateTime.AddSeconds(seconds), this.Offset); + } + + public DateTimeOffset AddTicks(long ticks) + { + return new DateTimeOffset(this.ClockDateTime.AddTicks(ticks), this.Offset); + } + + public DateTimeOffset AddYears(int years) + { + return new DateTimeOffset(this.ClockDateTime.AddYears(years), this.Offset); + } + + public static int Compare(DateTimeOffset first, DateTimeOffset second) + { + return System.DateTime.Compare(first.UtcDateTime, second.UtcDateTime); + } + + public int CompareTo(DateTimeOffset other) + { + System.DateTime utcDateTime = other.UtcDateTime; + System.DateTime time2 = this.UtcDateTime; + if (time2 > utcDateTime) + { + return 1; + } + if (time2 < utcDateTime) + { + return -1; + } + return 0; + } + + public bool Equals(DateTimeOffset other) + { + return this.UtcDateTime.Equals(other.UtcDateTime); + } + + public override bool Equals(object obj) + { + if (obj is DateTimeOffset) + { + DateTimeOffset offset = (DateTimeOffset)obj; + return this.UtcDateTime.Equals(offset.UtcDateTime); + } + return false; + } + + public static bool Equals(DateTimeOffset first, DateTimeOffset second) + { + return System.DateTime.Equals(first.UtcDateTime, second.UtcDateTime); + } + + public bool EqualsExact(DateTimeOffset other) + { + return (((this.ClockDateTime == other.ClockDateTime) && (this.Offset == other.Offset)) && (this.ClockDateTime.Kind == other.ClockDateTime.Kind)); + } + + public static DateTimeOffset FromFileTime(long fileTime) + { + return new DateTimeOffset(System.DateTime.FromFileTime(fileTime)); + } + + public override int GetHashCode() + { + return this.UtcDateTime.GetHashCode(); + } + + public static DateTimeOffset operator +(DateTimeOffset dateTimeTz, TimeSpan timeSpan) + { + return new DateTimeOffset(dateTimeTz.ClockDateTime + timeSpan, dateTimeTz.Offset); + } + + public static bool operator ==(DateTimeOffset left, DateTimeOffset right) + { + return (left.UtcDateTime == right.UtcDateTime); + } + + public static bool operator >(DateTimeOffset left, DateTimeOffset right) + { + return (left.UtcDateTime > right.UtcDateTime); + } + + public static bool operator >=(DateTimeOffset left, DateTimeOffset right) + { + return (left.UtcDateTime >= right.UtcDateTime); + } + + public static implicit operator DateTimeOffset(System.DateTime dateTime) + { + return new DateTimeOffset(dateTime); + } + + public static bool operator !=(DateTimeOffset left, DateTimeOffset right) + { + return (left.UtcDateTime != right.UtcDateTime); + } + + public static bool operator <(DateTimeOffset left, DateTimeOffset right) + { + return (left.UtcDateTime < right.UtcDateTime); + } + + public static bool operator <=(DateTimeOffset left, DateTimeOffset right) + { + return (left.UtcDateTime <= right.UtcDateTime); + } + + public static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right) + { + return (TimeSpan)(left.UtcDateTime - right.UtcDateTime); + } + + public static DateTimeOffset operator -(DateTimeOffset dateTimeTz, TimeSpan timeSpan) + { + return new DateTimeOffset(dateTimeTz.ClockDateTime - timeSpan, dateTimeTz.Offset); + } + + public static DateTimeOffset Parse(string input) + { + return new DateTimeOffset(DateTime.Parse(input, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None)); + } + + public static DateTimeOffset Parse(string input, IFormatProvider formatProvider) + { + return Parse(input, formatProvider, DateTimeStyles.None); + } + + public static DateTimeOffset Parse(string input, IFormatProvider formatProvider, DateTimeStyles styles) + { + styles = ValidateStyles(styles, "styles"); + return new DateTimeOffset(DateTime.Parse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles)); + } + + public static DateTimeOffset ParseExact(string input, string format, IFormatProvider formatProvider) + { + return ParseExact(input, format, formatProvider, DateTimeStyles.None); + } + + public static DateTimeOffset ParseExact(string input, string format, IFormatProvider formatProvider, DateTimeStyles styles) + { + styles = ValidateStyles(styles, "styles"); + return new DateTimeOffset(DateTime.ParseExact(input, format, DateTimeFormatInfo.GetInstance(formatProvider), styles)); + } + + public static DateTimeOffset ParseExact(string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles) + { + styles = ValidateStyles(styles, "styles"); + return new DateTimeOffset(DateTime.ParseExact(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles)); + } + + public TimeSpan Subtract(DateTimeOffset value) + { + return this.UtcDateTime.Subtract(value.UtcDateTime); + } + + public DateTimeOffset Subtract(TimeSpan value) + { + return new DateTimeOffset(this.ClockDateTime.Subtract(value), this.Offset); + } + + int IComparable.CompareTo(object obj) + { + if (obj == null) + { + return 1; + } + if (!(obj is DateTimeOffset)) + { + throw new ArgumentException("Object must be of type DateTimeOffset."); + } + DateTimeOffset offset = (DateTimeOffset)obj; + System.DateTime utcDateTime = offset.UtcDateTime; + System.DateTime time2 = this.UtcDateTime; + if (time2 > utcDateTime) + { + return 1; + } + if (time2 < utcDateTime) + { + return -1; + } + return 0; + } + + public long ToFileTime() + { + return this.UtcDateTime.ToFileTime(); + } + + public DateTimeOffset ToLocalTime() + { + return new DateTimeOffset(this.UtcDateTime.ToLocalTime()); + } + + public DateTimeOffset ToOffset(TimeSpan offset) + { + System.DateTime time = this._dateTime + offset; + return new DateTimeOffset(time.Ticks, offset); + } + + //public override string ToString() + //{ + // return DateTimeFormat.Format(this.ClockDateTime, null, DateTimeFormatInfo.CurrentInfo, this.Offset); + //} + + //public string ToString(IFormatProvider formatProvider) + //{ + // return DateTimeFormat.Format(this.ClockDateTime, null, DateTimeFormatInfo.GetInstance(formatProvider), this.Offset); + //} + + //public string ToString(string format) + //{ + // return DateTimeFormat.Format(this.ClockDateTime, format, DateTimeFormatInfo.CurrentInfo, this.Offset); + //} + + //public string ToString(string format, IFormatProvider formatProvider) + //{ + // return DateTimeFormat.Format(this.ClockDateTime, format, DateTimeFormatInfo.GetInstance(formatProvider), this.Offset); + //} + + public string ToString(string format, IFormatProvider formatProvider) + { + if (!string.IsNullOrEmpty(format)) + { + format = format.Replace("K", "zzz"); + format = format.Replace("zzz", Offset.Hours.ToString("+00;-00", CultureInfo.InvariantCulture) + ":" + Offset.Minutes.ToString("00;00", CultureInfo.InvariantCulture)); + format = format.Replace("zz", Offset.Hours.ToString("+00;-00", CultureInfo.InvariantCulture)); + format = format.Replace("z", Offset.Hours.ToString("+0;-0", CultureInfo.InvariantCulture)); + } + + return ClockDateTime.ToString(format, formatProvider); + } + + public DateTimeOffset ToUniversalTime() + { + return new DateTimeOffset(this.UtcDateTime); + } + + private static System.DateTime ValidateDate(System.DateTime dateTime, TimeSpan offset) + { + long ticks = dateTime.Ticks - offset.Ticks; + if ((ticks < 0L) || (ticks > 0x2bca2875f4373fffL)) + { + throw new ArgumentOutOfRangeException("offset", "The UTC time represented when the offset is applied must be between year 0 and 10,000."); + } + return new System.DateTime(ticks, DateTimeKind.Unspecified); + } + + private static short ValidateOffset(TimeSpan offset) + { + long ticks = offset.Ticks; + if ((ticks % 0x23c34600L) != 0L) + { + throw new ArgumentException("Offset must be specified in whole minutes.", "offset"); + } + if ((ticks < -504000000000L) || (ticks > 0x7558bdb000L)) + { + throw new ArgumentOutOfRangeException("offset", "Offset must be within plus or minus 14 hours."); + } + return (short)(offset.Ticks / 0x23c34600L); + } + + private static DateTimeStyles ValidateStyles(DateTimeStyles style, string parameterName) + { + if ((style & ~(DateTimeStyles.RoundtripKind | DateTimeStyles.AssumeUniversal | DateTimeStyles.AssumeLocal | DateTimeStyles.AdjustToUniversal | DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.AllowWhiteSpaces)) != DateTimeStyles.None) + { + throw new ArgumentException("An undefined DateTimeStyles value is being used.", parameterName); + } + if (((style & DateTimeStyles.AssumeLocal) != DateTimeStyles.None) && ((style & DateTimeStyles.AssumeUniversal) != DateTimeStyles.None)) + { + throw new ArgumentException("The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together.", parameterName); + } + if ((style & DateTimeStyles.NoCurrentDateDefault) != DateTimeStyles.None) + { + throw new ArgumentException("The DateTimeStyles value 'NoCurrentDateDefault' is not allowed when parsing DateTimeOffset.", parameterName); + } + style &= ~DateTimeStyles.RoundtripKind; + style &= ~DateTimeStyles.AssumeLocal; + return style; + } + + private System.DateTime ClockDateTime + { + get + { + System.DateTime time = this._dateTime + this.Offset; + return new System.DateTime(time.Ticks, DateTimeKind.Unspecified); + } + } + + public System.DateTime Date + { + get + { + return this.ClockDateTime.Date; + } + } + + public System.DateTime DateTime + { + get + { + return this.ClockDateTime; + } + } + + public int Day + { + get + { + return this.ClockDateTime.Day; + } + } + + public System.DayOfWeek DayOfWeek + { + get + { + return this.ClockDateTime.DayOfWeek; + } + } + + public int DayOfYear + { + get + { + return this.ClockDateTime.DayOfYear; + } + } + + public int Hour + { + get + { + return this.ClockDateTime.Hour; + } + } + + public System.DateTime LocalDateTime + { + get + { + return this.UtcDateTime.ToLocalTime(); + } + } + + public int Millisecond + { + get + { + return this.ClockDateTime.Millisecond; + } + } + + public int Minute + { + get + { + return this.ClockDateTime.Minute; + } + } + + public int Month + { + get + { + return this.ClockDateTime.Month; + } + } + + public static DateTimeOffset Now + { + get + { + return new DateTimeOffset(System.DateTime.Now); + } + } + + public TimeSpan Offset + { + get + { + return new TimeSpan(0, this._offsetMinutes, 0); + } + } + + public int Second + { + get + { + return this.ClockDateTime.Second; + } + } + + public long Ticks + { + get + { + return this.ClockDateTime.Ticks; + } + } + + public TimeSpan TimeOfDay + { + get + { + return this.ClockDateTime.TimeOfDay; + } + } + + public System.DateTime UtcDateTime + { + get + { + return System.DateTime.SpecifyKind(this._dateTime, DateTimeKind.Utc); + } + } + + public static DateTimeOffset UtcNow + { + get + { + return new DateTimeOffset(System.DateTime.UtcNow); + } + } + + public long UtcTicks + { + get + { + return this.UtcDateTime.Ticks; + } + } + + public int Year + { + get + { + return this.ClockDateTime.Year; + } + } + } +} +#endif \ No newline at end of file diff --git a/Src/Newtonsoft.Json/JavaScriptConvert.cs b/Src/Newtonsoft.Json/JavaScriptConvert.cs index b97a5097..14a86631 100644 --- a/Src/Newtonsoft.Json/JavaScriptConvert.cs +++ b/Src/Newtonsoft.Json/JavaScriptConvert.cs @@ -101,7 +101,14 @@ namespace Newtonsoft.Json /// A Json string representation of the . public static string ToString(DateTime value) { - return ToStringInternal(new DateTimeOffset(value), value.Kind); + TimeSpan utcOffset; +#if PocketPC + utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(value); +#else + utcOffset = TimeZoneInfo.Local.GetUtcOffset(value); +#endif + + return ToStringInternal(value, utcOffset, value.Kind); } /// @@ -111,31 +118,30 @@ namespace Newtonsoft.Json /// A Json string representation of the . public static string ToString(DateTimeOffset value) { - return ToStringInternal(value, DateTimeKind.Local); + return ToStringInternal(value.UtcDateTime, value.Offset, DateTimeKind.Local); } - internal static string ToStringInternal(DateTimeOffset value, DateTimeKind kind) + internal static string ToStringInternal(DateTime value, TimeSpan offset, DateTimeKind kind) { long javaScriptTicks = ConvertDateTimeToJavaScriptTicks(value); - string offset; + string timezoneOffset; switch (kind) { case DateTimeKind.Local: case DateTimeKind.Unspecified: - TimeSpan utcOffset = value.Offset; - offset = utcOffset.Hours.ToString("+00;-00", CultureInfo.InvariantCulture) + utcOffset.Minutes.ToString("00;00", CultureInfo.InvariantCulture); + timezoneOffset = offset.Hours.ToString("+00;-00", CultureInfo.InvariantCulture) + offset.Minutes.ToString("00;00", CultureInfo.InvariantCulture); break; default: - offset = string.Empty; + timezoneOffset = string.Empty; break; } - return @"""\/Date(" + javaScriptTicks.ToString(CultureInfo.InvariantCulture) + offset + @")\/"""; + return @"""\/Date(" + javaScriptTicks.ToString(CultureInfo.InvariantCulture) + timezoneOffset + @")\/"""; } - internal static long ConvertDateTimeToJavaScriptTicks(DateTimeOffset dateTime) + internal static long ConvertDateTimeToJavaScriptTicks(DateTime dateTime) { - DateTimeOffset utcDateTime = dateTime.ToUniversalTime(); + DateTime utcDateTime = dateTime.ToUniversalTime(); //if (utcDateTime < MinimumJavaScriptDate) // utcDateTime = MinimumJavaScriptDate; diff --git a/Src/Newtonsoft.Json/JsonHandler.cs b/Src/Newtonsoft.Json/JsonHandler.cs deleted file mode 100644 index 557932f8..00000000 --- a/Src/Newtonsoft.Json/JsonHandler.cs +++ /dev/null @@ -1,90 +0,0 @@ -#region License -// Copyright (c) 2007 James Newton-King -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -#endregion - -#if !SILVERLIGHT -using System; -using System.Web; -using System.Web.Caching; -using System.Xml; -using System.Text; -using System.Security.Principal; - -namespace Newtonsoft.Json -{ - public abstract class JsonHandler : HandlerBase, IHttpHandler - { - public event EventHandler Error; - - protected abstract void WriteResult(JsonWriter writer); - - public static void JsonResponse(HttpResponse response, Action writeAction) - { - response.ClearHeaders(); - response.ClearContent(); - - JsonWriter writer = new JsonWriter(response.Output); - - writeAction(writer); - - writer.Flush(); - } - - protected virtual void OnError(EventArgs e) - { - if (Error != null) - { - Error(this, e); - } - } - - void IHttpHandler.ProcessRequest(HttpContext context) - { - if (context == null) - throw new ArgumentNullException("context"); - - Context = context; - - try - { - JsonHandler.JsonResponse(context.Response, new Action(WriteResult)); - } - catch (Exception exception) - { - context.AddError(exception); - OnError(EventArgs.Empty); - if (context.Error != null) - { - throw new HttpUnhandledException("blah", exception); - } - } - } - - bool IHttpHandler.IsReusable - { - get { return false; } - } - } -} -#endif \ No newline at end of file diff --git a/Src/Newtonsoft.Json/JsonSerializer.cs b/Src/Newtonsoft.Json/JsonSerializer.cs index 580fde2c..b2bbf1c5 100644 --- a/Src/Newtonsoft.Json/JsonSerializer.cs +++ b/Src/Newtonsoft.Json/JsonSerializer.cs @@ -625,7 +625,7 @@ namespace Newtonsoft.Json } } - newObject = Activator.CreateInstance(objectType, constructorParameters.Values.ToArray()); + newObject = ReflectionUtils.CreateInstance(objectType, constructorParameters.Values.ToArray()); return newObject; } @@ -804,7 +804,7 @@ namespace Newtonsoft.Json { Type objectType = value.GetType(); -#if !SILVERLIGHT +#if !SILVERLIGHT && !PocketPC TypeConverter converter = TypeDescriptor.GetConverter(objectType); // use the objectType's TypeConverter if it has one and can convert to a string diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index dd250d11..a97e7dce 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -199,7 +199,9 @@ namespace Newtonsoft.Json.Linq return JsonTokenType.Integer; else if (value is double || value is float || value is decimal) return JsonTokenType.Float; - else if (value is DateTime || value is DateTimeOffset) + else if (value is DateTime) + return JsonTokenType.Date; + else if (value is DateTimeOffset) return JsonTokenType.Date; else if (value is bool) return JsonTokenType.Boolean; diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Compact.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Compact.csproj new file mode 100644 index 00000000..2707860a --- /dev/null +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Compact.csproj @@ -0,0 +1,133 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {256AA604-F61B-4B6D-8D51-C8E6AB11E435} + Library + Properties + Newtonsoft.Json.Compact + Newtonsoft.Json.Compact + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + PocketPC + b2c48bd2-963d-4549-9169-1fa021dce484 + 5.2 + Newtonsoft.Json.Compact + v3.5 + Windows Mobile 6 Professional SDK + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE;$(PlatformFamilyName) + true + true + prompt + 512 + 4 + Off + + + pdbonly + true + bin\Release\ + TRACE;$(PlatformFamilyName) + true + true + prompt + 512 + 4 + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj index 20ec5856..afc49159 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj @@ -78,9 +78,6 @@ JsonConverterCollection.cs - - JsonHandler.cs - JsonIgnoreAttribute.cs @@ -224,7 +221,6 @@ - diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs index 624989cb..7adbec43 100644 --- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -25,13 +25,16 @@ using System.Security; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -#if !SILVERLIGHT +#if SILVERLIGHT +[assembly: AssemblyTitle("Newtonsoft Json.NET Silverlight")] +[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.Silverlight")] +#elif PocketPC +[assembly: AssemblyTitle("Newtonsoft Json.NET Compact")] +[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.Compact")] +#else [assembly: AssemblyTitle("Newtonsoft Json.NET")] [assembly: InternalsVisibleTo("Newtonsoft.Json.Tests")] [assembly: AllowPartiallyTrustedCallers] -#else -[assembly: AssemblyTitle("Newtonsoft Json.NET Silverlight")] -[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.Silverlight")] #endif @@ -62,4 +65,6 @@ using System.Security; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] \ No newline at end of file +#if !PocketPC +[assembly: AssemblyFileVersion("3.0.0.0")] +#endif \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs b/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs index 85c8aaca..fe656db3 100644 --- a/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs @@ -523,7 +523,7 @@ namespace Newtonsoft.Json.Utilities if (listType.IsArray) list = ToArray(((List)list).ToArray(), ReflectionUtils.GetCollectionItemType(listType)); else if (ReflectionUtils.InheritsGenericClassDefinition(listType, typeof(ReadOnlyCollection<>))) - list = (IList)Activator.CreateInstance(listType, list); + list = (IList)ReflectionUtils.CreateInstance(listType, list); } return list; diff --git a/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs b/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs index 426dabe7..5b432318 100644 --- a/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs @@ -102,6 +102,7 @@ namespace Newtonsoft.Json.Utilities if (initialValue is string && targetType == typeof(Guid)) return new Guid((string)initialValue); +#if !PocketPC // see if source or target types have a TypeConverter that converts between the two TypeConverter toConverter = GetConverter(initialType); @@ -124,6 +125,7 @@ namespace Newtonsoft.Json.Utilities return fromConverter.ConvertFrom(initialValue); #endif } +#endif // handle DBNull and INullable if (initialValue == DBNull.Value) @@ -330,6 +332,7 @@ namespace Newtonsoft.Json.Utilities } #endif +#if !PocketPC private static TypeConverter GetConverter(Type t) { ValidationUtils.ArgumentNotNull(t, "t"); @@ -345,6 +348,7 @@ namespace Newtonsoft.Json.Utilities return (Activator.CreateInstance(Type.GetType(typeConverterAttribute.ConverterTypeName)) as TypeConverter); #endif } +#endif public static bool IsInteger(object value) { diff --git a/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs b/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs index 33c11d50..cb4bf15b 100644 --- a/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs @@ -11,7 +11,12 @@ namespace Newtonsoft.Json.Utilities { public static string GetLocalOffset(this DateTime d) { - TimeSpan utcOffset = TimeZoneInfo.Local.GetUtcOffset(d); + TimeSpan utcOffset; +#if PocketPC + utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(d); +#else + utcOffset = TimeZoneInfo.Local.GetUtcOffset(d); +#endif return utcOffset.Hours.ToString("+00;-00", CultureInfo.InvariantCulture) + ":" + utcOffset.Minutes.ToString("00;00", CultureInfo.InvariantCulture); } diff --git a/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs b/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs index df33be03..71ae1706 100644 --- a/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs @@ -35,51 +35,6 @@ namespace Newtonsoft.Json.Utilities } } - public static bool TryGetDescription(object value, out string description) - { - return TryAction(delegate { return GetDescription(value); }, out description); - } - - public static string GetDescription(object o) - { - ValidationUtils.ArgumentNotNull(o, "o"); - - ICustomAttributeProvider attributeProvider = o as ICustomAttributeProvider; - - // object passed in isn't an attribute provider - // if value is an enum value, get value field member, otherwise get values type - if (attributeProvider == null) - { - Type valueType = o.GetType(); - - if (valueType.IsEnum) - attributeProvider = valueType.GetField(o.ToString()); - else - attributeProvider = valueType; - } - - DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute(attributeProvider); - - if (descriptionAttribute != null) - return descriptionAttribute.Description; - else - throw new Exception("No DescriptionAttribute on '{0}'.".FormatWith(CultureInfo.InvariantCulture, o.GetType())); - } - - public static IList GetDescriptions(IList values) - { - ValidationUtils.ArgumentNotNull(values, "values"); - - string[] descriptions = new string[values.Count]; - - for (int i = 0; i < values.Count; i++) - { - descriptions[i] = GetDescription(values[i]); - } - - return descriptions; - } - public static string ToString(object value) { if (value == null) diff --git a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs index 452d6d75..a46377aa 100644 --- a/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs +++ b/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs @@ -381,21 +381,6 @@ namespace Newtonsoft.Json.Utilities return (property.GetIndexParameters().Length > 0); } - public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes) - { - return GetMember(type, name, memberTypes, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); - } - - public static MemberInfo GetMember(Type type, string name, MemberTypes memberTypes, BindingFlags bindingAttr) - { - ValidationUtils.ArgumentNotNull(type, "type"); - ValidationUtils.ArgumentNotNull(name, "name"); - - MemberInfo[] result = type.GetMember(name, memberTypes, bindingAttr); - - return CollectionUtils.GetSingleItem(result); - } - /// /// Gets the member's value on the object. /// @@ -565,29 +550,6 @@ namespace Newtonsoft.Json.Utilities return t.FullName + ", " + t.Assembly.GetName().Name; } - public static List FindMembers(Type targetType, MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria) - { - ValidationUtils.ArgumentNotNull(targetType, "targetType"); - - List memberInfos = new List(targetType.FindMembers(memberType, bindingAttr, filter, filterCriteria)); - - // fix weirdness with FieldInfos only being returned for the current Type - // find base type fields and add them to result - if ((memberType & MemberTypes.Field) != 0 - && (bindingAttr & BindingFlags.NonPublic) != 0) - { - // modify flags to not search for public fields - BindingFlags nonPublicBindingAttr = bindingAttr ^ BindingFlags.Public; - - while ((targetType = targetType.BaseType) != null) - { - memberInfos.AddRange(targetType.FindMembers(MemberTypes.Field, nonPublicBindingAttr, filter, filterCriteria)); - } - } - - return memberInfos; - } - public static Type MakeGenericType(Type genericTypeDefinition, params Type[] innerTypes) { ValidationUtils.ArgumentNotNull(genericTypeDefinition, "genericTypeDefinition"); @@ -604,7 +566,7 @@ namespace Newtonsoft.Json.Utilities public static object CreateGeneric(Type genericTypeDefinition, IList innerTypes, params object[] args) { - return CreateGeneric(genericTypeDefinition, innerTypes, (t, a) => Activator.CreateInstance(t, a.ToArray()), args); + return CreateGeneric(genericTypeDefinition, innerTypes, (t, a) => ReflectionUtils.CreateInstance(t, a.ToArray()), args); } public static object CreateGeneric(Type genericTypeDefinition, IList innerTypes, Func, object> instanceCreator, params object[] args) @@ -617,5 +579,58 @@ namespace Newtonsoft.Json.Utilities return instanceCreator(specificType, args); } + + static object CreateInstance(this Assembly a, string typeName, params object[] pars) + { + var t = a.GetType(typeName); + var c = t.GetConstructor(pars.Select(p => p.GetType()).ToArray()); + if (c == null) + return null; + return c.Invoke(pars); + } + + public static bool IsCompatibleValue(object value, Type type) + { + if (value == null && IsNullable(type)) + return true; + + if (type.IsAssignableFrom(value.GetType())) + return true; + + return false; + } + + public static object CreateInstance(Type type, params object[] args) + { + ValidationUtils.ArgumentNotNull(type, "type"); + +#if !PocketPC + return Activator.CreateInstance(type, args); +#else + ConstructorInfo[] constructors = type.GetConstructors(); + ConstructorInfo match = constructors.Where(c => + { + ParameterInfo[] parameters = c.GetParameters(); + if (parameters.Length != args.Length) + return false; + + for (int i = 0; i < parameters.Length; i++) + { + ParameterInfo parameter = parameters[i]; + object value = args[i]; + + if (!IsCompatibleValue(value, parameter.ParameterType)) + return false; + } + + return true; + }).FirstOrDefault(); + + if (match == null) + throw new Exception("Could not create '{0}' with given parameters.".FormatWith(CultureInfo.InvariantCulture, args)); + + return match.Invoke(args); +#endif + } } } \ No newline at end of file