private void EditAttributeValue() { ListViewItem selectedItem = WinFormsUtils.GetSingleSelectedItem(ListViewAttributes); if (selectedItem == null) { return; } IObjectAttribute objectAttribute = (IObjectAttribute)selectedItem.Tag; string attributeName = selectedItem.Text; byte[] attributeValue = (objectAttribute.CannotBeRead) ? new byte[0] : objectAttribute.GetValueAsByteArray(); using (HexEditor hexEditor = new HexEditor(attributeName, attributeValue)) { if (hexEditor.ShowDialog() == DialogResult.OK) { AttributeModified = true; IObjectAttribute updatedObjectAttribute = Pkcs11Admin.Instance.Factories.ObjectAttributeFactory.Create(objectAttribute.Type, hexEditor.Bytes); _pkcs11Slot.SaveObjectAttributes(_pkcs11ObjectInfo, new List <IObjectAttribute>() { updatedObjectAttribute }); selectedItem.Tag = updatedObjectAttribute; ReloadListView(); } } }
private void EditAttributeValue() { ListView activeListView = GetActiveListView(); ListViewItem selectedItem = WinFormsUtils.GetSingleSelectedItem(activeListView); if (selectedItem == null) { return; } ObjectAttribute objectAttribute = (ObjectAttribute)selectedItem.Tag; string attributeName = selectedItem.Text; byte[] attributeValue = objectAttribute.GetValueAsByteArray() ?? new byte[0]; using (HexEditor hexEditor = new HexEditor(attributeName, attributeValue)) { if (hexEditor.ShowDialog() == DialogResult.OK) { ObjectAttribute updatedObjectAttribute = new ObjectAttribute(objectAttribute.Type, hexEditor.Bytes); selectedItem.Tag = updatedObjectAttribute; ReloadListView(activeListView); } } }
private void EditAttributeValue() { ListViewItem selectedItem = WinFormsUtils.GetSingleSelectedItem(ListViewAttributes); if (selectedItem == null) { return; } IObjectAttribute objectAttribute = (IObjectAttribute)selectedItem.Tag; string attributeName = selectedItem.Text; byte[] attributeValue = objectAttribute.GetValueAsByteArray() ?? new byte[0]; using (HexEditor hexEditor = new HexEditor(attributeName, attributeValue)) { if (hexEditor.ShowDialog() == DialogResult.OK) { IObjectAttribute updatedObjectAttribute = Pkcs11Admin.Instance.Factories.ObjectAttributeFactory.Create(objectAttribute.Type, hexEditor.Bytes); selectedItem.Tag = updatedObjectAttribute; ReloadListView(); } } }