public void Remove(T obj)
        {
            T OldChangedObj;
            T OldAddedObj;

            if (EqualityComparer != null)
            {
                OldChangedObj = (from changed in ChangedList
                                 where EqualityComparer.Equals(changed, obj)
                                 select changed).FirstOrDefault();
                OldAddedObj = (from added in AddedList
                               where EqualityComparer.Equals(added, obj)
                               select added).FirstOrDefault();
            }
            else
            {
                OldChangedObj = (from changed in ChangedList
                                 where changed.Equals(obj)
                                 select changed).FirstOrDefault();
                OldAddedObj = (from added in AddedList
                               where added.Equals(obj)
                               select added).FirstOrDefault();
            }

            if (OldAddedObj != null)
            {
                AddedList.Remove(OldAddedObj);
                ResultingList.Remove(OldAddedObj);
            }
            else if (OldChangedObj != null)
            {
                RemovedList.Add(OldChangedObj);
                ResultingList.Remove(OldChangedObj);
            }
        }
예제 #2
0
 public void ReplaceSubfile(int index, Component file, NotLoaded replaced)
 {
     if (index >= 0)
     {
         Components.RemoveAt(index);
         replaced.replacement = file;
         RemovedList.Add(replaced);
     }
     else
     {
         /*for (int i = Components.Count - 1; i >= 0; i--)
          * {
          *      if (Components[i].classID1 == file.classID1)
          *      {
          *              index = i + 1;
          *              break;
          *      }
          * }
          * if (index < 0)*/
         {
             index = Components.Count;
         }
     }
     Components.Insert(index, file);
 }