Ejemplo n.º 1
0
 private void CheckAllDirectoryContents(DirectoryEntry dir)
 {
     IEnumerator<Entry> it = dir.Entries;
     //foreach (Entry entry in dir)
     while (it.MoveNext())
     {
         Entry entry = it.Current;
         if (entry is DirectoryEntry)
         {
             CheckAllDirectoryContents((DirectoryEntry)entry);
         }
         else
         {
             DocumentNode doc = (DocumentNode)entry;
             DocumentInputStream dis = new DocumentInputStream(doc);
             try
             {
                 int numBytes = dis.Available();
                 byte[] data = new byte[numBytes];
                 dis.Read(data);
             }
             finally
             {
                 dis.Close();
             }
         }
     }
 }
Ejemplo n.º 2
0
        public void TestAvailable()
        {
            DocumentInputStream ostream = new DocumentInputStream(_workbook_o);
            DocumentInputStream nstream = new NDocumentInputStream(_workbook_n);

            Assert.AreEqual(_workbook_size, ostream.Available());
            Assert.AreEqual(_workbook_size, nstream.Available());
            ostream.Close();
            nstream.Close();

            try
            {
                ostream.Available();
                Assert.Fail("Should have caught IOException");
            }
            catch (InvalidOperationException)
            {
                // as expected
            }
            try
            {
                nstream.Available();
                Assert.Fail("Should have caught IOException");
            }
            catch (InvalidOperationException)
            {
                // as expected
            }
        }
Ejemplo n.º 3
0
 public override int Available()
 {
     return(delegate1.Available());
 }
Ejemplo n.º 4
0
        public void TestConstructor()
        {
            DocumentInputStream ostream = new DocumentInputStream(_workbook_o);
            DocumentInputStream nstream = new NDocumentInputStream(_workbook_n);

            Assert.AreEqual(_workbook_size, _workbook_o.Size);
            Assert.AreEqual(_workbook_size, _workbook_n.Size);
            Assert.AreEqual(_workbook_size, ostream.Available());
            Assert.AreEqual(_workbook_size, nstream.Available());
        }