private void FrmEditGundam_Load(object sender, EventArgs e) { List <short> limit = null; if (gundamInfo != null) { limit = new List <short>(); short wid = gundamInfo.WeaponId; if (wid >= 0 && gundamInfo.WeaponCount > 0) { for (short i = 0; i < gundamInfo.WeaponCount; i++) { limit.Add((short)(wid + i)); } } short map = gundamInfo.WeaponMapID; if (map >= 0 && gundamInfo.WeaponMapCount > 0) { for (short i = 0; i < gundamInfo.WeaponMapCount; i++) { limit.Add((short)(map + i + gundamFile.WeaponNormalCount)); } } } bindAll(); weapons = new List <WeaponInfo>(); List <WeaponInfo> allWeapons = gundamFile.ListWeapons(); List <KeyValuePair <string, string> > ranges = GGCRUtil.ListWeaponRange(); Dictionary <short, WeaponInfo> noranges = new Dictionary <short, WeaponInfo>(); foreach (WeaponInfo w in allWeapons) { if (limit == null || limit.Contains(w.ID)) { weapons.Add(w); } bool find = false; foreach (KeyValuePair <string, string> rngs in ranges) { if (rngs.Key == w.Range.ToString()) { find = true; break; } } if (!find) { if (!noranges.ContainsKey(w.Range)) { noranges.Add(w.Range, w); } } } foreach (KeyValuePair <short, WeaponInfo> kv in noranges) { GGCRUtil.AddWeaponRange(kv.Key, kv.Key + " " + (kv.Value.IsMap ? ("MAP " + kv.Value.UnitName) : ("普通 " + kv.Value.UnitName))); } bindAll(); lsGundam.DataSource = weapons; lsGundam.DisplayMember = "UnitName"; lsGundam.ValueMember = "Address"; }