private bool EditData() { if (SelectedEntry != null) { UserDataParser parser = new UserDataParser(); parser.UserDataName = SelectedEntry.Name; parser.Type = SelectedEntry.Type; switch (SelectedEntry.Type) { case UserDataType.String: if (SelectedEntry.GetString() != null) { parser.LoadValues(SelectedEntry.GetString()); } break; case UserDataType.Float: if (SelectedEntry.GetString() != null) { parser.LoadValues(SelectedEntry.GetFloats()); } break; case UserDataType.Int: if (SelectedEntry.GetInts() != null) { parser.LoadValues(SelectedEntry.GetInts()); } break; } if (parser.ShowDialog() == DialogResult.OK) { SelectedEntry.Name = parser.UserDataName; if (parser.Type == UserDataType.Float) { SelectedEntry.SetValue(parser.GetFloats()); } if (parser.Type == UserDataType.Int) { SelectedEntry.SetValue(parser.GetInts()); } if (parser.Type == UserDataType.String) { SelectedEntry.SetValue(parser.GetStringASCII()); } if (ActiveUserData == null) { ActiveUserData = activePane.CreateUserData(); } ActiveUserData.Edited = true; LoadUserData(activePane, ActiveUserData); return(true); } } return(false); }
private void LoadUserData(UserDataEntry item) { ListViewItem listItem = new ListViewItem(); listItem.Text = item.Name; listItem.SubItems.Add(item.Type.ToString()); string value = ""; switch (item.Type) { case UserDataType.String: if (item.GetString() != null) { value += $" {item.GetString()}"; } break; case UserDataType.Float: if (item.GetFloats() != null) { foreach (var val in item.GetFloats()) { value += $" {val}"; } } break; case UserDataType.Int: if (item.GetInts() != null) { foreach (var val in item.GetInts()) { value += $" {val}"; } } break; } listItem.SubItems.Add(value); listViewCustom1.Items.Add(listItem); }