Beispiel #1
0
 private static void StringTranslator(IntPtr isolate, ISetValueToJs setValueApi, IntPtr holder, object obj)
 {
     if (obj == null)
     {
         setValueApi.SetNull(isolate, holder);
     }
     else
     {
         setValueApi.SetString(isolate, holder, obj as string);
     }
 }
Beispiel #2
0
 internal void AnyTranslator(IntPtr isolate, ISetValueToJs setValueApi, IntPtr holder, object obj)
 {
     if (obj == null)
     {
         setValueApi.SetNull(isolate, holder);
     }
     else
     {
         Type realType = obj.GetType();
         if (realType == typeof(object))
         {
             int typeId   = typeRegister.GetTypeId(isolate, realType);
             int objectId = objectPool.FindOrAddObject(obj);
             setValueApi.SetObject(isolate, holder, typeId, new IntPtr(objectId));
         }
         else
         {
             GetTranslateFunc(realType)(isolate, setValueApi, holder, obj);
         }
     }
 }