Exemple #1
0
        public void Close()
        {
            _terminal?.ConsoleOutStream?.Close();
            _reader?.Dispose();

            ConnectionClosed?.Invoke(this, _terminal.ExitCode);
        }
Exemple #2
0
        public void Close()
        {
            _reader?.Dispose();

            int exitCode = -1;

            if (_shellProcess != null && _shellProcess.HasExited)
            {
                exitCode = _shellProcess.ExitCode;
            }
            ConnectionClosed?.Invoke(this, exitCode);
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
        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);
                }
            }
        }
Exemple #5
0
 public void Dispose()
 {
     if (_reader != null)
     {
         _reader.Dispose();
         _reader = null;
     }
 }
Exemple #6
0
        public void Dispose()
        {
            if (_reader != null)
            {
                _reader.Dispose();
                _reader = null;
            }

            if (_compressor != null)
            {
                _compressor.Dispose();
                _compressor = null;
            }
        }
Exemple #7
0
        public void Close()
        {
            _reader?.Dispose();

            ConnectionClosed?.Invoke(this, _terminal.ExitCode);
        }