public void Remove_Test()
        {
            IFileObject[] all      = new IFileObject[] { new PDFNumber(1), new PDFNumber(2), new PDFNumber(3) };
            PDFArray      target   = new PDFArray(all);
            IFileObject   toremove = all[1]; //Number 2

            bool expected = true;
            bool actual;

            actual = target.Remove(toremove);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(2, target.Count);

            toremove = new PDFNumber(4);
            expected = false;
            actual   = target.Remove(toremove);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(2, target.Count);
        }
Esempio n. 2
0
 /// <summary>
 /// Removes the page reference
 /// </summary>
 /// <param name="refToPage">Reference to the page to remove</param>
 /// <returns>True if success</returns>
 public bool RemovePageRef(Reference refToPage)
 {
     if (refToPage.ReferredObject.ReferredObject is Page)
     {
         _arrkids.Remove(refToPage);
         return(true);
     }
     else
     {
         return(false);
     }
 }
        protected void _Remove(object obj)
        {
            PDFObject obj1   = this.mBaseDict[this.mBaseKeyName];
            PDFArray  array1 = (obj1 as PDFArray);

            if ((array1 == null) && (obj1 != null))
            {
                this.mBaseDict.Remove(this.mBaseKeyName);
            }
            foreach (DictionaryEntry entry1 in this.mObjectList)
            {
                if (obj != entry1.Value)
                {
                    continue;
                }
                this.mObjectList.Remove(entry1);
                if (array1 == null)
                {
                    return;
                }
                array1.Remove(((PDFObject)entry1.Key));
            }
        }