public async Task <Stream> ParseCsvAsync(string csvUri, OutputFormats outputFormat) { try { IReader csvReader = await CsvReaderService.GetCsvReaderAsync(csvUri); if (csvReader != null) { IAsyncEnumerable <ParsedCsvRow> filteredRows = CsvFilterService.FilterCsvOnSumAsync(csvReader); ICsvPrinterService CsvPrinter = Printers[outputFormat]; Stream outputStream = await CsvPrinter.PrintCsvAsync(filteredRows); csvReader.Dispose(); return(outputStream); } return(null); } catch (Exception e) { Logger.LogError($"Error: {e.Message}"); return(null); } }
public void Dispose() { bool isBusy = true; do { idCardReader.Cancelled = true; icCardReaderWriter.Cancelled = true; magneticCardReaderWriter.Cancelled = true; caller.Cancelled = true; evaluator.Cancelled = true; log.Info("set idCardReader, icCardReaderWriter, magneticCardReaderWriter caller, evaluator Cancelled = true"); isBusy = idCardReader.IsBusy || icCardReaderWriter.IsBusy || magneticCardReaderWriter.IsBusy || caller.IsBusy || evaluator.IsBusy; Thread.Sleep(200); }while (isBusy); log.Info("wait idCardReader, icCardReaderWriter, magneticCardReaderWriter caller, evaluator exit loop ok"); magneticCardReaderWriter.Dispose(); icCardReaderWriter.Dispose(); idCardReader.Dispose(); needlePrinter.Dispose(); barScreen.Dispose(); compScreen.Dispose(); caller.Dispose(); //voicePlayer.Dispose(); Thread.Sleep(2000); }
private void dispose(bool disposing) { if (disposing) { parser.Dispose(); } isClosed = true; }
private void CloseReader() { if (_reader != null) { _reader.Dispose(); _reader = null; } }
protected override void OnDoWork(DoWorkEventArgs e) { try { if (!File.Exists(sourceFile)) { e.Result = false; return; } FileInfo fi = new FileInfo(sourceFile); if (fi.Length == 0) { e.Result = false; return; } using (Stream stream = File.OpenRead(sourceFile)) { reader = ReaderFactory.Open(stream); while (reader.MoveToNextEntry()) { if (!reader.Entry.IsDirectory) { //Console.WriteLine(reader.Entry.Key); reader.WriteEntryToDirectory(destinationPath, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } else { Directory.CreateDirectory(string.Format("{0}\\{1}", destinationPath, reader.Entry.Key)); } if (CancellationPending) { reader.Dispose(); e.Result = false; break; } else { e.Result = true; } } } } catch { e.Result = false; } }
public void Dispose() { if (_disposed) { return; } _disposed = true; _reader.Dispose(); }
/// <summary> /// Tokenizes the input. /// </summary> public void Tokenize(IReader reader) { this.reader = reader; try { CurrentLine = 1; PositionOnLine = 0; LastToken = null; LastTokenPosition = 0; Tokens.Clear(); CurrentTokenChars.Clear(); TokenizeCore(); } finally { reader.Dispose(); } }
private IArchResult GetResult() { _waitHandle.WaitOne(); _reader.Dispose(); _writer.Dispose(); _scheduler.Dispose(); //Console.WriteLine($"Thread count: {((SimpleAchScheduler)_scheduler).ThreadCount}"); if (IsCancelled) { return(ArchResult.Cancelled()); } if (IsFaulted) { var exception = new AggregateException(exceptions.ToArray()); var message = exception.Flatten().Message; return(ArchResult.Faulted(message)); } return(ArchResult.Success()); }
public void Dispose() { reader.Dispose(); writer.Dispose(); }
public virtual void Dispose() { _underlying.Dispose(); }
public void Dispose() { _reader.Dispose(); }
private void DisconnectScud() { _scudReader.Disconnect(); _scudReader.Dispose(); }
protected override void DisposeCore() { _reader.Dispose(); base.DisposeCore(); }
public void Dispose() { _csvReader.Dispose(); _streamReader.Dispose(); _stream.Dispose(); }
public void Dispose() { _reader?.Dispose(); _writer?.Dispose(); _blocksLimiter?.Dispose(); }
public void Dispose() { _securedReader.Dispose(); }
private void DisconnectIpt() { _iptReader.Disconnect(); _iptReader.Dispose(); _isIptConnected = false; }