public void refreshGrid() { this.grid.clear(); if (this.Item == null) { return; } foreach (string str in this.Item.referenceLists()) { GameData.Desc desc = GameData.getDesc(this.Item.type, str); TripleIntProperty tripleIntProperty = new TripleIntProperty(desc.flags); foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in this.Item.referenceData(str, false)) { if (this.Exclusions.Contains(str)) { continue; } GameData.Item item = this.nav.ou.gameData.getItem(keyValuePair.Key); GameData.State state = this.Item.getState(str, keyValuePair.Key); string str1 = (item != null ? item.Name : keyValuePair.Key); Color stateColor = StateColours.GetStateColor(state); PropertyGrid.PropertyGrid.Item key = this.grid.addItem(str, str1, keyValuePair.Value, desc.description, new Color?(stateColor), desc.flags > 0); key.Property = tripleIntProperty; key.Data = keyValuePair.Key; key.Editable = state != GameData.State.LOCKED; } } foreach (KeyValuePair <string, GameData.Instance> keyValuePair1 in this.Item.instanceData()) { bool flag = (keyValuePair1.Value.getState() == GameData.State.LOCKED ? false : !this.readOnly); Color color = StateColours.GetStateColor(keyValuePair1.Value.getState()); this.grid.addItem("Instances", keyValuePair1.Key, keyValuePair1.Value, "Object instances", new Color?(color), flag); } this.grid.AutosizeDivider(); }
public void refreshReferenceList() { KeyValuePair <string, GameData.Desc> keyValuePair; this.referenceList.clear(); foreach (string str in this.Item.referenceLists()) { GameData.Desc desc = GameData.getDesc(this.Item.type, str); int num = (desc == GameData.nullDesc ? 3 : desc.flags); TripleIntProperty tripleIntProperty = new TripleIntProperty(num); foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair1 in this.Item.referenceData(str, false)) { GameData.Item item = this.nav.ou.gameData.getItem(keyValuePair1.Key); GameData.State state = this.Item.getState(str, keyValuePair1.Key); string str1 = (item != null ? item.Name : keyValuePair1.Key); Color stateColor = StateColours.GetStateColor(state); PropertyGrid.PropertyGrid.Item key = this.referenceList.addItem(str, str1, keyValuePair1.Value, desc.description, new Color?(stateColor), num > 0); key.Property = tripleIntProperty; key.Data = keyValuePair1.Key; key.Editable = state != GameData.State.LOCKED; } } if (this.Item.HasInstances) { Dictionary <itemType, KeyValuePair <string, GameData.Desc> > itemTypes = new Dictionary <itemType, KeyValuePair <string, GameData.Desc> >(); if (GameData.desc.ContainsKey(this.Item.type)) { foreach (KeyValuePair <string, GameData.Desc> item1 in GameData.desc[this.Item.type]) { if (!(item1.Value.defaultValue is GameData.Instance)) { continue; } itemTypes.Add(item1.Value.list, item1); } } if (itemTypes.Count != 0) { foreach (KeyValuePair <string, GameData.Instance> keyValuePair2 in this.Item.instanceData()) { if (keyValuePair2.Value.getState() == GameData.State.REMOVED) { continue; } GameData.Item item2 = this.nav.ou.gameData.getItem(keyValuePair2.Value.sdata["ref"]); Color color = StateColours.GetStateColor(keyValuePair2.Value.getState()); bool flag = keyValuePair2.Value.getState() != GameData.State.LOCKED; if (item2 == null || !itemTypes.TryGetValue(item2.type, out keyValuePair)) { this.referenceList.addItem("Instances", keyValuePair2.Key, keyValuePair2.Value, "Object instances", new Color?(color), flag); } else { this.referenceList.addItem(keyValuePair.Key, keyValuePair2.Key, keyValuePair2.Value, keyValuePair.Value.description, new Color?(color), flag).Data = item2.type; } } } else { foreach (KeyValuePair <string, GameData.Instance> keyValuePair3 in this.Item.instanceData()) { if (keyValuePair3.Value.getState() == GameData.State.REMOVED) { continue; } bool state1 = keyValuePair3.Value.getState() != GameData.State.LOCKED; Color stateColor1 = StateColours.GetStateColor(keyValuePair3.Value.getState()); this.referenceList.addItem("Instances", keyValuePair3.Key, keyValuePair3.Value, "Object instances", new Color?(stateColor1), state1); } } if (this.nav.FileMode == navigation.ModFileMode.SINGLE) { foreach (KeyValuePair <string, GameData.Instance> keyValuePair4 in this.Item.instanceData()) { if (keyValuePair4.Value.getState() != GameData.State.REMOVED) { continue; } Color color1 = StateColours.GetStateColor(keyValuePair4.Value.getState()); this.referenceList.addItem("Instances", keyValuePair4.Key, keyValuePair4.Value, "Object instances", new Color?(color1), false); } } } this.referenceList.AutosizeDivider(); }