public void Stop() { NativeIPCClientImpl.StopLoop(thread); NativeIPCClientImpl.Release(handle); handle = IntPtr.Zero; }
public void Start() { handle = NativeIPCClientImpl.CreateIPCClient(onIncomingMessage, onConnected, onDisconnected); thread = NativeIPCClientImpl.StartLoop(handle); NativeIPCClientImpl.Connect(handle, "org.cloudveil.filterserviceprovider"); }
public void PushMessage(BaseMessage msg) { IFormatter formatter = new BinaryFormatter(); using (MemoryStream stream = new MemoryStream()) { formatter.Serialize(stream, msg); byte[] arr = stream.ToArray(); bool isBroadcast = msg is ClientToClientMessage; NativeIPCClientImpl.Send(handle, arr, arr.Length, isBroadcast); } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). } if (handle != IntPtr.Zero) { NativeIPCClientImpl.Release(handle); handle = IntPtr.Zero; } disposedValue = true; } }