public virtual void Dispose() { if (IsDisposed) { return; } IsDisposed = true; if (Socket != default(Socket)) { PodeSocket.CloseSocket(Socket); } if (InputStream != default(Stream)) { InputStream.Dispose(); } if (BufferStream != default(MemoryStream)) { BufferStream.Dispose(); } PodeHelpers.WriteErrorMessage($"Request disposed", Context.Listener, PodeLoggingLevel.Verbose, Context); }
public int Parse(IVisitor statsCollector) { #endif var nodes = 0; var readerSettings = new XmlReaderSettings { Async = true }; InputStream inputStream = GetInputStream(); try { using (var reader = XmlReader.Create(inputStream.ReadStream, readerSettings)) { reader.ReadToFollowing(MainNodeName); T current = new T(); string lastElement = null; #if ASYNC while (await reader.ReadAsync()) #else while (reader.Read()) #endif { Read(reader, ref current, ref lastElement, statsCollector); nodes++; } if (current != null) { CollectStats(statsCollector, current); } } } finally { inputStream.Dispose(); } return(nodes); }
/// <summary> /// Releases the unmanaged resources used by the <see cref="TnefReader"/> and /// optionally releases the managed resources. /// </summary> /// <remarks> /// Releases the unmanaged resources used by the <see cref="TnefReader"/> and /// optionally releases the managed resources. /// </remarks> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; /// <c>false</c> to release only the unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (disposing && !closed) { InputStream.Dispose(); } }
/// <summary> /// Closes and clears the connected socket channel. /// </summary> public void Clear() { Connection = null; OutputStream?.Dispose(); InputStream?.Dispose(); Socket?.Close(); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (InputStream != null) { InputStream.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { try { Close(); if (envelopeReceiver != null) { try { envelopeReceiver.Abort(); envelopeReceiver = null; } catch (Exception) { throw; } } } catch (Exception) { } if (InputStream != null) { InputStream.Dispose(); } if (OutputStream != null) { OutputStream.Dispose(); } OutputStream = null; InputStream = null; ChangeState(ConnectorState.Disposed); } }
private void DisposeInternal() { if (InputStream != null) { InputStream.Dispose(); InputStream = null; } }
protected override void FreeCodecs() { base.FreeCodecs(); if (_stream != null) { _stream.Dispose(); } }
/// <inheritdoc/> void IDisposable.Dispose() { lock (syncLock) { stream.Dispose(); frame.Dispose(); converter.Dispose(); } }
public void Dispose() { if (input != null) { input.Dispose(); } nextRec = null; afterNextRec = null; }
public override void Dispose() { Utilities.NeedsReview(); mStream.Dispose(); mDecoder.Dispose(); mOutput.Dispose(); mInput?.Dispose(); }
/// <summary> /// Disposes the context /// </summary> public void Dispose() { if (_cts != null) { InputStream.Dispose(); _cts.Dispose(); _cts = null; } }
/// <inheritdoc/> void IDisposable.Dispose() { lock (syncLock) { stream.Dispose(); frame.Dispose(); scaler.Dispose(); } }
/// <summary> /// Releases the unmanaged resources used by the <see cref="DuplexStream"/> and /// optionally releases the managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; /// <c>false</c> to release only the unmanaged resources.</param> protected override void Dispose(bool disposing) { if (disposing && !disposed) { OutputStream.Dispose(); InputStream.Dispose(); disposed = true; } base.Dispose(disposing); }
/// <inheritdoc/> void IDisposable.Dispose() { lock (syncLock) { stream.Dispose(); frame.Dispose(); if (converter.IsValueCreated) { converter.Value.Dispose(); } } }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously public async ValueTask DisposeAsync() #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously { #if NETSTANDARD2_1 || NETCOREAPP3_1 await OutputStream.DisposeAsync(); await InputStream.DisposeAsync(); #else OutputStream.Dispose(); InputStream.Dispose(); #endif }
public void Dispose() { if (InputStream != null) { InputStream.Dispose(); InputStream = null; } try { if (OutputStream != null) { OutputStream.Dispose(); OutputStream = null; } } catch { } }
public static bool BinaryToObject(byte[] Data, ref object obj, bool IsCompressed) { obj = null; MemoryStream MemStream = null; MemoryStream InputStream = null; DeflateStream DStream = null; BinaryFormatter BinFormatter = default(BinaryFormatter); byte[] B = null; try { MemStream = new MemoryStream(Data); BinFormatter = new BinaryFormatter(); BinFormatter.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; if (IsCompressed) { DStream = new DeflateStream(MemStream, CompressionMode.Decompress, false); B = ReadFullStream(DStream); DStream.Flush(); InputStream = new MemoryStream(B); obj = BinFormatter.Deserialize(InputStream); } else { obj = BinFormatter.Deserialize(MemStream); } return(true); } finally { if ((DStream != null)) { DStream.Dispose(); } if ((InputStream != null)) { InputStream.Dispose(); } if ((MemStream != null)) { MemStream.Dispose(); } } }
private bool isDisposed = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!isDisposed) { if (disposing) { InputStream.Dispose(); // TODO: dispose managed state (managed objects). } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. isDisposed = true; } }
public virtual void Dispose() { if (Socket != default(Socket)) { PodeSocket.CloseSocket(Socket); } if (InputStream != default(Stream)) { InputStream.Dispose(); } if (BufferStream != default(MemoryStream)) { BufferStream.Dispose(); } }
// IDisposable protected override void Dispose(bool disposing) { if (!_IsDisposed) { if (disposing) { if (InputStream != null) { InputStream.Dispose(); } if (OutputStream != null) { OutputStream.Dispose(); } } } _IsDisposed = true; }
public void OnDeviceSelected(int index) { // Stop and destroy the current stream. if (_stream != null) { _stream.Dispose(); _stream = null; } // Reset the UI elements. _channelList.ClearOptions(); _channelList.RefreshShownValue(); _statusText.text = ""; // Break if the null device option was selected. if (_deviceList.value == 0) { return; } // Open a new stream. try { _stream = DeviceDriver.OpenInputStream(_deviceList.value - 1); } catch (System.InvalidOperationException e) { _statusText.text = $"Error: {e.Message}"; return; } // Construct the channel list. _channelList.options = Enumerable.Range(0, _stream.ChannelCount). Select(i => $"Channel {i + 1}"). Select(text => new Dropdown.OptionData() { text = text }). ToList(); _channelList.RefreshShownValue(); }
private void Reset() { _state = ClientState.ReadingProlog; // _context = null; if (_parser != null) { _parser.Dispose(); _parser = null; } if (_writeStream != null) { _writeStream.Dispose(); _writeStream = null; } if (InputStream != null) { InputStream.Dispose(); InputStream = null; } ReadBuffer.Reset(); Method = null; Protocol = null; Request = null; Headers = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); PostParameters = new NameValueCollection(); if (MultiPartItems != null) { foreach (var item in MultiPartItems) { if (item.Stream != null) { item.Stream.Dispose(); } } MultiPartItems = null; } }
public void Dispose() { if (!_isDisposed) { if (_objectsToDispose != null) { foreach (var h in _objectsToDispose) { h.Dispose(); } } _inputReadPipe?.Dispose(); _outputWritePipe?.Dispose(); _errorWritePipe?.Dispose(); InputStream?.Dispose(); OutputStream?.Dispose(); ErrorStream?.Dispose(); _isDisposed = true; } }
public void Dispose() { _source.Dispose(); }
/// <summary> /// Releases the unmanaged resources used by the <see cref="TnefReader"/> and /// optionally releases the managed resources. /// </summary> /// <remarks> /// Releases the unmanaged resources used by the <see cref="TnefReader"/> and /// optionally releases the managed resources. /// </remarks> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; /// <c>false</c> to release only the unmanaged resources.</param> protected virtual void Dispose(bool disposing) { InputStream.Dispose(); }
public void Dispose() { CancelRead(); InputStream.Dispose(); }
void OnDestroy() { _stream?.Dispose(); _audioData.Dispose(); }
void OnDestroy() { _stream?.Dispose(); }
public void Dispose() { InputStream?.Dispose(); }