public void newRequest(ScreenshotRequest request) { try { lock (requestLock) { if (request is PauseRequest) { paused = true; } else if (request is StopRequest) { paused = true; if (frameTarget != null) { frameTarget.close(); frameTarget = null; } } else if (request is ResumeRequest) { if (frameTarget != null) { paused = false; } } else if (request is StreamRequest) { StreamRequest streamRequest = (StreamRequest)request; frameTarget = new FrameServer(streamRequest.Host, streamRequest.Port); this.captureRect = streamRequest.Region; this.freq = 1 / streamRequest.Fps; paused = false; } else if (request is CaptureRequest) { CaptureRequest captureRequest = (CaptureRequest)request; frameTarget = new IPCHostSink(ProcessId, request.RequestId, Interface); this.captureRect = captureRequest.Region; this.freq = 1 / captureRequest.Fps; paused = false; } } } catch (Exception e) { paused = true; if (frameTarget != null) { frameTarget.close(); frameTarget = null; } ErrorMessage("Exception when processing request" + request + "\n\r" + e); paused = true; } }
public virtual void Cleanup() { lock (requestLock) { if (frameTarget != null) { frameTarget.close(); frameTarget = null; } } }