private void LoadItemsWorker(string FileName, ItemEditor IE) { ThingList<Item> TL = new ThingList<Item>(); if (TL.Load(FileName)) { if (IE == this.ieLeft) { this.LeftItems = TL; } else { this.RightItems = TL; } } this.LeftItemsShown = null; this.RightItemsShown = null; if (this.RightItems == null && this.LeftItems == null) { this.CurrentItem = -1; } else { this.CurrentItem = 0; } // In general, this tool supports comparing heterogenic item sets (as useless as that may be). // However, the 2010-09-09 patch prepended a range of 1024 armor pieces to the previous range (so 0x2800-0x4000 instead of 0x2C00-0x4000). // So we detect that specific case and cope with it padding the shorter set at the front (with nulls); this also means we should drop leading null entries whenever // a new set is loaded. while (this.LeftItems != null && this.LeftItems.Count > 0 && this.LeftItems[0] == null) { this.LeftItems.RemoveAt(0); } while (this.RightItems != null && this.RightItems.Count > 0 && this.RightItems[0] == null) { this.RightItems.RemoveAt(0); } if (this.RightItems != null && this.LeftItems != null) { if (this.LeftItems.Count != this.RightItems.Count) { uint LID = (uint)this.LeftItems[0].GetFieldValue("id"); uint RID = (uint)this.RightItems[0].GetFieldValue("id"); if (LID == 0x2800 && RID == 0x2c00) { this.RightItems.InsertRange(0, new Item[0x400]); } if (LID == 0x2c00 && RID == 0x2800) { this.LeftItems.InsertRange(0, new Item[0x400]); } } this.btnRemoveUnchanged.Invoke(new AnonymousMethod(delegate() { this.btnRemoveUnchanged.Enabled = true; })); } this.PWD.Invoke(new AnonymousMethod(delegate() { this.PWD.Close(); })); }
private void LoadItems(string FileName, ItemEditor IE) { this.PWD = new PleaseWaitDialog(I18N.GetText("Dialog:LoadItems")); Thread T = new Thread(new ThreadStart(delegate() { this.LoadItemsWorker(FileName, IE); })); T.CurrentUICulture = Thread.CurrentThread.CurrentUICulture; T.Start(); PWD.ShowDialog(this); this.Activate(); this.PWD.Dispose(); this.PWD = null; this.EnableNavigation(); this.MarkItemChanges(); }