/// <summary> /// Sets all variables to the closed state. /// </summary> private void ClosePrivate(ConnectionCloseReason reason, string message, Exception exception) { ConnectionAvailable = false; connectionLost = true; Channel.Shutdown(); FileTransfer?.Dispose(); // Cancel running file transfer OnConnectionClosed(reason, message, exception); }
/// <summary> /// Create FileTransfer /// </summary> public static void Create(bool dispose = false) { if (dispose && _transfer != null) { _transfer.Dispose(); return; } _transfer = new FileTransfer(); _transfer.Listen(InfrastructureRepository.RootPath, (ushort)_config.ListenedAddress.Port); _transfer.Prepare += new EventHandler <TransferEventArgs>(_transfer_Prepare); _transfer.Completed += new EventHandler <TransferEventArgs>(_transfer_Completed); }