Beispiel #1
0
        private void RemoveImageImpl(Image image, int id, int width, int height)
        {
            MediaEntry cur  = Head;
            MediaEntry prev = null;

            while (cur != null)
            {
                MediaEntry next = cur.Next;
                if (cur.ID == id && cur is ImageMediaEntry && ((ImageMediaEntry)cur).Matches(image, width, height))
                {
                    if (prev == null)
                    {
                        Head = next;
                    }
                    else
                    {
                        prev.Next = next;
                    }
                    cur.Cancel();
                }
                else
                {
                    prev = cur;
                }
                cur = next;
            }
        }
Beispiel #2
0
 /// <summary>
 /// Returns a list of media with the specified ID that
 /// have encountered an error. </summary>
 /// <param name="id">   the identifier of the images to check </param>
 /// <returns>      an array of media objects tracked by this media
 ///                       tracker with the specified identifier
 ///                       that have encountered an error, or
 ///                       <code>null</code> if there are none with errors </returns>
 /// <seealso cref=         java.awt.MediaTracker#isErrorID </seealso>
 /// <seealso cref=         java.awt.MediaTracker#isErrorAny </seealso>
 /// <seealso cref=         java.awt.MediaTracker#getErrorsAny </seealso>
 public virtual Object[] GetErrorsID(int id)
 {
     lock (this)
     {
         MediaEntry cur       = Head;
         int        numerrors = 0;
         while (cur != null)
         {
             if (cur.ID == id && (cur.GetStatus(false, true) & ERRORED) != 0)
             {
                 numerrors++;
             }
             cur = cur.Next;
         }
         if (numerrors == 0)
         {
             return(null);
         }
         Object[] errors = new Object[numerrors];
         cur       = Head;
         numerrors = 0;
         while (cur != null)
         {
             if (cur.ID == id && (cur.GetStatus(false, false) & ERRORED) != 0)
             {
                 errors[numerrors++] = cur.Media;
             }
             cur = cur.Next;
         }
         return(errors);
     }
 }
Beispiel #3
0
        private void RemoveImageImpl(Image image, int id)
        {
            MediaEntry cur  = Head;
            MediaEntry prev = null;

            while (cur != null)
            {
                MediaEntry next = cur.Next;
                if (cur.ID == id && cur.Media == image)
                {
                    if (prev == null)
                    {
                        Head = next;
                    }
                    else
                    {
                        prev.Next = next;
                    }
                    cur.Cancel();
                }
                else
                {
                    prev = cur;
                }
                cur = next;
            }
        }
Beispiel #4
0
        internal static MediaEntry Insert(MediaEntry head, MediaEntry me)
        {
            MediaEntry cur  = head;
            MediaEntry prev = null;

            while (cur != null)
            {
                if (cur.ID_Renamed > me.ID_Renamed)
                {
                    break;
                }
                prev = cur;
                cur  = cur.Next;
            }
            me.Next = cur;
            if (prev == null)
            {
                head = me;
            }
            else
            {
                prev.Next = me;
            }
            return(head);
        }
Beispiel #5
0
 private int StatusAll(bool load, bool verify)
 {
     lock (this)
     {
         MediaEntry cur    = Head;
         int        status = 0;
         while (cur != null)
         {
             status = status | cur.GetStatus(load, verify);
             cur    = cur.Next;
         }
         return(status);
     }
 }
Beispiel #6
0
 /// <summary>
 /// Checks the error status of all of the images tracked by this
 /// media tracker with the specified identifier. </summary>
 /// <param name="id">   the identifier of the images to check </param>
 /// <returns>       <code>true</code> if any of the images with the
 ///                          specified identifier had an error during
 ///                          loading; <code>false</code> otherwise </returns>
 /// <seealso cref=          java.awt.MediaTracker#isErrorAny </seealso>
 /// <seealso cref=          java.awt.MediaTracker#getErrorsID </seealso>
 public virtual bool IsErrorID(int id)
 {
     lock (this)
     {
         MediaEntry cur = Head;
         while (cur != null)
         {
             if (cur.ID == id && (cur.GetStatus(false, true) & ERRORED) != 0)
             {
                 return(true);
             }
             cur = cur.Next;
         }
         return(false);
     }
 }
Beispiel #7
0
 private bool CheckID(int id, bool load, bool verify)
 {
     lock (this)
     {
         MediaEntry cur  = Head;
         bool       done = true;
         while (cur != null)
         {
             if (cur.ID == id && (cur.GetStatus(load, verify) & DONE) == 0)
             {
                 done = false;
             }
             cur = cur.Next;
         }
         return(done);
     }
 }
Beispiel #8
0
 private void AddImageImpl(Image image, int id, int w, int h)
 {
     Head = MediaEntry.Insert(Head, new ImageMediaEntry(this, image, id, w, h));
 }