private bool Init() { lock (_filesSync) { if (_disposed) { return(false); } if (_web == null) { var options = new StartOptions { ServerFactory = "Nowin", Port = _multimediaPort }; try { _web = WebApp.Start <Startup>(options); } catch (TargetInvocationException exc) when(exc.InnerException is SocketException socketException && socketException.NativeErrorCode == AddressIsUsedErrorCode) { throw new PortIsUsedException(); } Current = this; } } return(true); }
public override void Dispose() { lock (_filesSync) { StopURI(_files.Keys.ToArray()); if (_web != null) { _web.Dispose(); _web = null; } _disposed = true; Current = null; } }
private bool Init() { lock (_filesSync) { if (_disposed) { return false; } if (_web == null) { var options = new StartOptions { ServerFactory = "Nowin", Port = _multimediaPort }; _web = WebApp.Start<Startup>(options); Current = this; } } return true; }