Exemplo n.º 1
0
 internal void RemoveChanged(SimPe.Interfaces.Files.IPackedFileDescriptor pfd)
 {
     if (!flat)
     {
         foreach (uint type in index.Keys)
         {
             Hashtable groups = (Hashtable)index[type];
             foreach (uint group in groups.Keys)
             {
                 Hashtable instances = (Hashtable)groups[group];
                 foreach (ulong instance in instances.Keys)
                 {
                     PackedFileDescriptors list = (PackedFileDescriptors)instances[instance];
                     for (int i = list.Count - 1; i >= 0; i--)
                     {
                         if (list[i] == pfd)
                         {
                             RemoveFromList(pfds, list[i]);
                             list.RemoveAt(i);
                         }
                     }
                 }
             }
         }
     }
     else
     {
         RemoveFromList(pfds, pfd);
     }
 }
Exemplo n.º 2
0
        void RemoveFromList(PackedFileDescriptors list, SimPe.Interfaces.Files.IPackedFileDescriptor pfd)
        {
            bool rem = false;

            for (int i = 0; i < list.Count; i++)
            {
                SimPe.Interfaces.Files.IPackedFileDescriptor p = list[i];
                if (p.Equals(pfd))
                {
                    list.RemoveAt(i);
                    rem = true;
                }
            }

            if (!rem)
            {
                throw new Exception("Bugger");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Removes an Item from the Table
        /// </summary>
        /// <param name="pfd">The item you want to remove</param>
        internal PackedFileDescriptors RemoveDeleteMarkedItem()
        {
            PackedFileDescriptors list;
            PackedFileDescriptors removed = new PackedFileDescriptors();

            if (!flat)
            {
                foreach (uint type in index.Keys)
                {
                    Hashtable groups = (Hashtable)index[type];
                    foreach (uint group in groups.Keys)
                    {
                        Hashtable instances = (Hashtable)groups[group];
                        foreach (ulong instance in instances.Keys)
                        {
                            list = (PackedFileDescriptors)instances[instance];
                            for (int i = list.Count - 1; i >= 0; i--)
                            {
                                if (list[i].MarkForDelete)
                                {
                                    pfds.Remove(list[i]);
                                    removed.Add(list[i]);
                                    list.RemoveAt(i);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                for (int i = this.pfds.Count - 1; i >= 0; i--)
                {
                    if (pfds[i].MarkForDelete)
                    {
                        pfds.RemoveAt(i);
                    }
                }
            }

            return(removed);
        }