Exemplo n.º 1
0
    private static Object[] obj_deserialize_int(byte [] in_bytes, Int32 asem_type, String assem, String atype, IFormatter bf)
    {
        Object [] ret = new Object[2];
        System.IO.MemoryStream mem_strim = new System.IO.MemoryStream();

        Type type = new VInvoke().get_type(asem_type, assem, atype);

        mem_strim.Seek(0, SeekOrigin.Begin);
        mem_strim.Write(in_bytes, 0, (int)in_bytes.Length);

        mem_strim.Seek(0, SeekOrigin.Begin);
        Object org_obj = bf.Deserialize(mem_strim);

        if (!(type.IsInstanceOfType(org_obj) || (org_obj != null && type == org_obj.GetType())))
        {
            throw new Exception("The deserialized object is not an instance of " + type.FullName);
        }

        return(res_to_ptr(org_obj));
    }
Exemplo n.º 2
0
  private static Object[] obj_deserialize_int (byte [] in_bytes, Int32 asem_type, String assem, String atype, IFormatter bf)
  {
    Object [] ret = new Object[2];
    System.IO.MemoryStream mem_strim = new System.IO.MemoryStream ();

    Type type = new VInvoke().get_type (asem_type, assem, atype);

    mem_strim.Seek(0, SeekOrigin.Begin);
    mem_strim.Write (in_bytes, 0, (int) in_bytes.Length);

    mem_strim.Seek(0, SeekOrigin.Begin);
    Object org_obj = bf.Deserialize(mem_strim);

    if (!(type.IsInstanceOfType (org_obj) || (org_obj != null && type == org_obj.GetType())))
      throw new Exception ("The deserialized object is not an instance of " + type.FullName);

    return res_to_ptr (org_obj);
  }