internal object AnyTranslator(IntPtr isolate, IGetValueFromJs getValueApi, IntPtr value, bool isByRef) { var type = getValueApi.GetJsValueType(isolate, value, isByRef); switch (type) { case JsValueType.BigInt: return(getValueApi.GetBigInt(isolate, value, isByRef)); case JsValueType.Boolean: return(getValueApi.GetBoolean(isolate, value, isByRef)); case JsValueType.Date: return(DateTranslator(isolate, getValueApi, value, isByRef)); case JsValueType.ArrayBuffer: return(getValueApi.GetArrayBuffer(isolate, value, isByRef)); case JsValueType.Function: return(getValueApi.GetFunction(isolate, value, isByRef)); case JsValueType.JsObject: return(getValueApi.GetJSObject(isolate, value, isByRef)); case JsValueType.NativeObject: var typeId = getValueApi.GetTypeId(isolate, value, isByRef); if (!typeRegister.IsArray(typeId)) { var objType = typeRegister.GetType(typeId); if (objType != typeof(object) && generalGetterMap.ContainsKey(objType)) { return(generalGetterMap[objType](isolate, getValueApi, value, isByRef)); } } var objPtr = getValueApi.GetNativeObject(isolate, value, isByRef); var result = objectPool.Get(objPtr.ToInt32()); var typedValueResult = result as TypedValue; if (typedValueResult != null) { return(typedValueResult.Target); } return(result); case JsValueType.Number: return(getValueApi.GetNumber(isolate, value, isByRef)); case JsValueType.String: return(getValueApi.GetString(isolate, value, isByRef)); default: return(null); } }
internal object AnyTranslator(IntPtr isolate, IGetValueFromJs getValueApi, IntPtr value, bool isByRef) { var type = getValueApi.GetJsValueType(isolate, value, isByRef); switch (type) { case JsValueType.BigInt: return(getValueApi.GetBigInt(isolate, value, isByRef)); case JsValueType.Boolean: return(getValueApi.GetBoolean(isolate, value, isByRef)); case JsValueType.Date: return(DateTranslator(isolate, getValueApi, value, isByRef)); //case JsValueType.Function: //case JsValueType.JsObject: case JsValueType.NativeObject: var typeId = getValueApi.GetTypeId(isolate, value, isByRef); var objType = typeRegister.GetType(typeId); if (objType != typeof(object) && generalGetterMap.ContainsKey(objType)) { return(generalGetterMap[objType](isolate, getValueApi, value, isByRef)); } var objPtr = getValueApi.GetObject(isolate, value, isByRef); return(objectPool.Get(objPtr.ToInt32())); case JsValueType.Number: return(getValueApi.GetNumber(isolate, value, isByRef)); case JsValueType.String: return(getValueApi.GetString(isolate, value, isByRef)); default: return(null); } }