Ejemplo n.º 1
0
        private object CleanUpParameter(object p, SmdAdditionalParameters metaData)
        {
            if (p == null || (p != null && p.GetType() == metaData.ObjectType))
            {
                return(p);
            }

            var bob = p as Newtonsoft.Json.Linq.JValue;

            if (bob != null && (bob.Value == null || bob.Value.GetType() == metaData.ObjectType))
            {
                return(bob.Value);
            }

            var paramI = p;

            try
            {
                return(Newtonsoft.Json.JsonConvert.DeserializeObject(paramI.ToString(), metaData.ObjectType));
            }
            catch (Exception)
            {
                // no need to throw here, they will
                // get an invalid cast exception right after this.
            }

            return(paramI);
        }
Ejemplo n.º 2
0
 public Smd()
 {
     transport           = "POST";
     envelope            = "URL";
     target              = "/json.rpc";
     additonalParameters = false;
     parameters          = new SmdAdditionalParameters[0];
     Services            = new ConcurrentDictionary <string, SmdService>();
     Types      = new ConcurrentDictionary <int, JObject>();
     TypeHashes = new List <string>();
 }
Ejemplo n.º 3
0
 public SmdResult(System.Type type)
 {
     Type = SmdAdditionalParameters.GetTypeRecursive(type);
 }