public void Close() { _terminal?.ConsoleOutStream?.Close(); _reader?.Dispose(); ConnectionClosed?.Invoke(this, _terminal.ExitCode); }
public void Close() { _reader?.Dispose(); int exitCode = -1; if (_shellProcess != null && _shellProcess.HasExited) { exitCode = _shellProcess.ExitCode; } ConnectionClosed?.Invoke(this, exitCode); }
public async static Task <String> ReadFile(File file) { using (AtomicFile mFile = new AtomicFile(file)) { // Wait for file to be free while (IsFileLocked(file)) { await Task.Delay(100); } String data; using (BufferedReader reader = new BufferedReader(new InputStreamReader(mFile.OpenRead()))) { String line = await reader.ReadLineAsync(); StringBuilder sBuilder = new StringBuilder(); while (line != null) { sBuilder.Append(line).Append("\n"); line = await reader.ReadLineAsync(); } reader.Dispose(); data = sBuilder.ToString(); } return(data); } }
public string getAsString(string key) { File file = mCache.get(key); if (!file.Exists()) { return(null); } bool removeFile = false; BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); string readString = ""; string currentLine; while ((currentLine = reader.ReadLine()) != null) { readString += currentLine; } if (!Utils.isDue(readString)) { return(Utils.clearDateInfo(readString)); } else { removeFile = true; return(null); } } catch (IOException ex) { ex.PrintStackTrace(); return(null); } finally { if (reader != null) { try { reader.Dispose(); } catch (IOException ex) { ex.PrintStackTrace(); } } if (removeFile) { remove(key); } } }
public void Dispose() { if (_reader != null) { _reader.Dispose(); _reader = null; } }
public void Dispose() { if (_reader != null) { _reader.Dispose(); _reader = null; } if (_compressor != null) { _compressor.Dispose(); _compressor = null; } }
public void Close() { _reader?.Dispose(); ConnectionClosed?.Invoke(this, _terminal.ExitCode); }