Permalink
Browse files

Made a fix to the serialization stuff

  • Loading branch information...
1 parent e7e173e commit f038bb6a44c9333f6d34ebfecb7eacbd7bd13935 @robashton committed Nov 8, 2012
View
@@ -15,12 +15,12 @@
<Target Name="Build">
<CallTarget Targets="CreateZombify"></CallTarget>
- <CallTarget Targets="BuildProjects"></CallTarget>
<CallTarget Targets="CopyFiles"></CallTarget>
<CallTarget Targets="Package"></CallTarget>
</Target>
<Target Name="CreateZombify">
+ <CallTarget Targets="BuildProjects"></CallTarget>
<Copy SkipUnchangedFiles="true" SourceFiles="@(ZombifyServer)"
DestinationFolder="..\src\zombify\server"/>
</Target>
Binary file not shown.
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.Remoting;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -69,11 +70,18 @@ private void onBeginGetContext (IAsyncResult result)
var method = handler.GetType().GetMethods()
.Where (x=> x.Name == methodName).FirstOrDefault(x => x.GetParameters().Length == data.Children().Count());
+ if(method == null)
+ Console.WriteLine("Cannot find method called {0} with parameter count {1}", methodName, data.Children().Count());
+
var args = new List<object>();
+
+ var deserializeMethod = typeof(JToken).GetMethods().Where(x=> x.Name == "ToObject" && x.GetParameters().Length == 0).Single();
foreach(var par in method.GetParameters()) {
- var val = data.GetValue(par.Name);
- var obj = JsonConvert.DeserializeObject(val.ToString(), par.ParameterType);
+ var val = data[par.Name];
+ Console.WriteLine("Matching parameter {0} to value {1}, using type {2}", par.Name, val, par.ParameterType);
+ var deserializer = deserializeMethod.MakeGenericMethod(new [] { par.ParameterType});
+ var obj = deserializer.Invoke(val, new Object[] {});
args.Add (obj);
}
method.Invoke (handler, args.ToArray());
File renamed without changes.
File renamed without changes.
View
@@ -1,7 +1,7 @@
{
"name": "zombify",
"main": "./driver",
- "version": "1.0.2",
+ "version": "1.0.4",
"keywords": [
"c#",
"test",
Binary file not shown.

0 comments on commit f038bb6

Please sign in to comment.