Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NetworkHook : MarshalByRefObject
- {
- public event EventHandler<HookInstalledEventArgs> Installed;
- public event EventHandler<HookDataRecievedEventArgs> DataRecieved;
- public event EventHandler<HookPingEventArgs> Ping;
- public event EventHandler<HookExceptionEventArgs> Exception;
- public void onIsInstalled(int pid, MessageDirection direction)
- {
- EventHandler<HookInstalledEventArgs> handler = Installed;
- if (null != handler)
- {
- handler(this, new HookInstalledEventArgs(pid, direction));
- }
- }
- public void onDataRecieved(int pid, MessageDirection direction, byte[][] data)
- {
- EventHandler<HookDataRecievedEventArgs> handler = this.DataRecieved;
- if (null != handler)
- {
- foreach(byte[] singledata in data)
- {
- handler(this, new HookDataRecievedEventArgs(pid, direction, singledata));
- }
- }
- }
- public void onException(int pid, MessageDirection direction, Exception exception)
- {
- EventHandler<HookExceptionEventArgs> handler = this.Exception;
- if (null != handler)
- {
- handler(this, new HookExceptionEventArgs(pid, direction, exception));
- }
- }
- public void onPing(int pid, MessageDirection direction)
- {
- EventHandler<HookPingEventArgs> handler = this.Ping;
- if (null != handler)
- {
- handler(this, new HookPingEventArgs(pid, direction));
- }
- }
- public override object InitializeLifetimeService()
- {
- // Make sure the object doesn't end up in garbage collection after 5 minutes
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement