Пример #1
0
        private void ProcessLines()
        {
            try
            {
                using (SftpFileStream stream = this.Client.OpenRead(this.Path))
                {
                    stream.Seek(0, SeekOrigin.End);

                    using (StreamReader reader = new StreamReader(stream))
                    {
                        while (!this.CancellationTokenSource.IsCancellationRequested)
                        {
                            String line = reader.ReadLine();

                            if (!String.IsNullOrEmpty(line))
                            {
                                this.LineQueue.Enqueue(line);

                                if (this.LineQueue.Count > this.LineCapacity)
                                {
                                    this.LineQueue.TryDequeue(out line);
                                }
                            }
                        }
                    }
                }
            }
            catch { }
        }
Пример #2
0
 protected override void Act()
 {
     try
     {
         _target.Seek(_offset, SeekOrigin.Begin);
         Assert.Fail();
     }
     catch (EndOfStreamException ex)
     {
         _actualException = ex;
     }
 }
Пример #3
0
        public void SeekTest()
        {
            SftpSession    session  = null;                                    // TODO: Initialize to an appropriate value
            string         path     = string.Empty;                            // TODO: Initialize to an appropriate value
            FileMode       mode     = new FileMode();                          // TODO: Initialize to an appropriate value
            SftpFileStream target   = new SftpFileStream(session, path, mode); // TODO: Initialize to an appropriate value
            long           offset   = 0;                                       // TODO: Initialize to an appropriate value
            SeekOrigin     origin   = new SeekOrigin();                        // TODO: Initialize to an appropriate value
            long           expected = 0;                                       // TODO: Initialize to an appropriate value
            long           actual;

            actual = target.Seek(offset, origin);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #4
0
 protected override void Act()
 {
     _actual = _target.Seek(0L, SeekOrigin.Begin);
 }
Пример #5
0
 public override long Seek(long offset, SeekOrigin origin)
 {
     return(_fs.Seek(offset, origin));
 }