Package net.sphene.goim.ingame.directx

Source Code of net.sphene.goim.ingame.directx.DXInGameMessageBridge

package net.sphene.goim.ingame.directx;

import java.io.IOException;
import java.net.URL;

import net.sphene.libs.SpheneEvent;

import org.eclipse.core.runtime.FileLocator;

public abstract class DXInGameMessageBridge {
  public DXInGameMessageBridge() {
    URL ret = DXInGameMessenger.getDefault().getBundle().getResource("dxhook.dll");
    String dllname = null;
    try {
      ret = FileLocator.resolve(ret);
      dllname = ret.getFile();
      if(dllname.startsWith("/"))
        dllname = dllname.substring(1);
      System.out.println(dllname);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    //URL ret = DXInGameMessenger.getDefault().find(new Path("hook.dll"));
    init(dllname);//"hook.dll");
    new Thread() {
      public void run() {
        startListening();
      }
    }.start();
    DXInGameMessenger.getDefault().fireIsHookedStateChangedEvent(new SpheneEvent(isHooked()));
  }
  public void hook() {
    nativeHook();
    DXInGameMessenger.getDefault().fireIsHookedStateChangedEvent(new SpheneEvent(isHooked()));
  }
  public void unHook() {
    nativeUnHook();
    DXInGameMessenger.getDefault().fireIsHookedStateChangedEvent(new SpheneEvent(isHooked()));
  }
  public boolean isHooked() {
    return nativeIsHooked();
  }

  static {
    System.loadLibrary("DXInGameMessageBridge");
  }
  protected native String init(String lib);
  protected native void startListening();
  public native void sendMessage(String jabberId, String nick, String msg);
  private native void nativeHook();
  private native void nativeUnHook();
  private native boolean nativeIsHooked();
 
//  public abstract void gameLaunched(String fullexepath);
//  public abstract void gameTerminated(String fullexepath);
  public abstract void replyMessage(String id, String msg);
}
TOP

Related Classes of net.sphene.goim.ingame.directx.DXInGameMessageBridge

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.