private void ProvideBParamContentList(object osender, EventArgs e) { var sender = osender as ContentSelectorEditor.ComboBoxEditor; uint addr = CurBehavAddr; string bpname = ""; if (sender.Tag == null || (uint)sender.Tag != addr) { if (sender == CbEditorBParam1) { bpname = bParamPropName + Conversions.ToString(1); } else if (sender == CbEditorBParam2) { bpname = bParamPropName + Conversions.ToString(2); } else if (sender == CbEditorBParam3) { bpname = bParamPropName + Conversions.ToString(3); } else if (sender == CbEditorBParam4) { bpname = bParamPropName + Conversions.ToString(4); } if (!string.IsNullOrEmpty(bpname)) { var info = myBehaviors.GetByBehaviorAddress(addr); if (info is object) { BehaviorInfo.BParam param = (BehaviorInfo.BParam)info.GetValue(bpname); if (param is object) { // sender.DataSource = Nothing sender.DataSource = param.Values; } } } sender.Tag = addr; } }
public void ReadFromFile(string fileName) { Clear(); var jarr = JArray.Parse(File.ReadAllText(fileName)); if (jarr is object) { foreach (JObject entry in jarr) { var info = new BehaviorInfo(); info.Name = entry["Name"].Value <string>(); info.BehaviorAddress = Conversions.ToUInteger(TextValueConverter.ValueFromText(entry["Behavior"].Value <string>(), useIVM: 0)); for (int i = 1; i <= 4; i++) { if (entry.ContainsKey($"BP{i} Name")) { info.GetValue <BehaviorInfo.BParam>($"BParam{i}").Name = entry[$"BP{i} Name"].Value <string>(); } if (entry.ContainsKey($"BP{i} Entries")) { BehaviorInfo.BParam param = (BehaviorInfo.BParam)info.GetValue($"BParam{i}"); foreach (JObject kvp in entry[$"BP{i} Entries"]) { param.Values.Add(new BehaviorInfo.BParamValue() { Name = kvp["Name"].Value <string>(), Value = Conversions.ToByte(kvp["Value"].Value <string>()) }); } } } Add(info); } } }