package com.ehfscliax;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import org.xvolks.jnative.JNative;
import org.xvolks.jnative.Type;
import org.xvolks.jnative.exceptions.NativeException;
import org.xvolks.jnative.pointers.Pointer;
import org.xvolks.jnative.pointers.memory.MemoryBlockFactory;
import org.xvolks.jnative.util.ole.*;
public class Helper {
/**
* @param args
* @throws NativeException
*/
public static void main(String[] args) throws NativeException {
JNative.setLoggingEnabled(true);
try {
JNative getUrl = new JNative("EhfscliaxDll.dll", "getUrl");
getUrl.setRetVal(Type.STRING);
getUrl.setParameter(0, "127.0.0.1");
getUrl.setParameter(1, 10087);
getUrl.setParameter(2, 123);
getUrl.invoke();
System.out.println(getUrl.getRetVal());
} catch (IllegalAccessException e) {
e.printStackTrace();
}
try {
JNative getPlayUrl = new JNative("EhfscliaxDll.dll", "getPlayUrl");
getPlayUrl.setRetVal(Type.INT);
String mgrIp = "127.0.0.1";
/*
try {
mgrIp = new String(mgrIp.getBytes(), "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}*/
Pointer ptr = Pointer.createPointerFromString(mgrIp);
getPlayUrl.setParameter(0, mgrIp);
getPlayUrl.setParameter(1, 10087);
getPlayUrl.setParameter(2, 123);
getPlayUrl.invoke();
String url = JNative.getMemoryAsString(getPlayUrl.getRetValAsInt());
//url = JNative.getMemoryAsString(getPlayUrl.getRetValAsInt(), 260, true);
/*try {
url = new String(url.getBytes(), "utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
System.out.println(url);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}