public LibVncServer(IVncFramebufferSource framebufferSource, IVncRemoteKeyboard keyboard, IVncRemoteController controller, ILogger logger) { this.fbSource = framebufferSource ?? throw new ArgumentNullException(nameof(framebufferSource)); this.keyboard = keyboard; this.controller = controller; this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.passwordChallenge = new VncPasswordChallenge(); this.newClientHook = new NativeMethods.RfbNewClientHookPtr(this.RfbNewClientHook); this.clientGoneHook = new NativeMethods.ClientGoneHookPtr(this.ClientGoneHook); this.clientFramebufferUpdateRequestHook = new NativeMethods.ClientFramebufferUpdateRequestHookPtr(this.ClientFramebufferUpdateRequestHook); this.rfbKbdAddEventHook = new NativeMethods.RfbKbdAddEventProcPtr(this.RfbKbdAddEventHook); this.rfbPtrAddEventProc = new NativeMethods.RfbPtrAddEventProcPtr(this.RfbPtrAddEventHook); this.rfbPasswordCheckProc = new NativeMethods.rfbPasswordCheckProcPtr(this.RfbPasswordCheckHook); this.newClientHookPtr = Marshal.GetFunctionPointerForDelegate(this.newClientHook); this.clientGoneHookPtr = Marshal.GetFunctionPointerForDelegate(this.clientGoneHook); this.clientFramebufferUpdateRequestHookPtr = Marshal.GetFunctionPointerForDelegate(this.clientFramebufferUpdateRequestHook); this.rfbKbdAddEventHookPtr = Marshal.GetFunctionPointerForDelegate(this.rfbKbdAddEventHook); this.rfbPtrAddEventProcPtr = Marshal.GetFunctionPointerForDelegate(this.rfbPtrAddEventProc); this.rfbPasswordCheckProcPtr = Marshal.GetFunctionPointerForDelegate(this.rfbPasswordCheckProc); #if !NETSTANDARD2_0 && !NET45 NativeLogging.Logger = logger; #endif }
/// <summary> /// Initializes a new instance of the <see cref="VncServer"/> class. /// </summary> /// <param name="framebufferSource"> /// The framebuffer source for all sessions which connect to this server. /// </param> /// <param name="keyboard"> /// The keyboard for all sessions which connect to this server. /// </param> /// <param name="controller"> /// The controller for all sessions which connect to this server. /// </param> /// <param name="logger"> /// The logger to use. /// </param> public VncServer(IVncFramebufferSource framebufferSource, IVncRemoteKeyboard keyboard, IVncRemoteController controller, ILogger logger) { this.framebufferSource = framebufferSource ?? throw new ArgumentNullException(nameof(framebufferSource)); this.keyboard = keyboard; this.controller = controller; this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }