/* * the actual entry point : ---. \|/ * ' for opcodes */ public static FullType FromJson <FullType> (JsonValue JV) { Mapping.ConsumerBase Consumer = Mapping.GetConsumer(typeof(FullType)); Type normalizedType = Consumer.expected_RHS_Type; SObject intermediateVal = PLJGlue.Convert(normalizedType, JV); MethodInfo closedRoundabout = typeof(LightJSonAdapter).GetMethod("roundabout").MakeGenericMethod(new [] { normalizedType, typeof(FullType) }); try { return((FullType)closedRoundabout.Invoke(null, new object [] { intermediateVal, Consumer.F })); } catch (TargetInvocationException e) { throw e.InnerException; // the actual exception whithin the function being invoked ( gets wrapped by reflection ) } }
public static void Test1() { var X = new Mapping.ConsumerIndexer_New_LHS <Vector3, float>(3); string dummy = ""; JsonValue JV_dim1_arr3 = PLJGlue.ParseWithRest("[1,2,3]", out dummy); Console.WriteLine(FromJson <Vector3> (JV_dim1_arr3)); Console.WriteLine(FromJson <float[]> (JV_dim1_arr3)); JsonValue JV_dim2_arr44 = PLJGlue.ParseWithRest("[[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]", out dummy); JsonValue JV_dim2_arr28 = PLJGlue.ParseWithRest("[[1,2,3,4,1,2,3,4],[1,2,3,4,1,2,3,4]]", out dummy); Console.WriteLine(FromJson <Matrix4x4> (JV_dim2_arr44)); Console.WriteLine(FromJson <UnityEngine.Rendering.SphericalHarmonicsL2> (JV_dim2_arr28)); }