PKISolutions / Asn1Editor.WPF

Graphical WPF-based Abstract Syntax Notation One (ASN.1) DER editor
Microsoft Public License
189 stars 59 forks source link

Add ability to load custom OID maps #32

Closed ralienpp closed 9 months ago

ralienpp commented 10 months ago

A small usability improvement would be to let the user right-click on an object identifier and give it a human-readable alias.

image

This would make it easier to orient oneself within the data structure.

Perhaps the program could load these from a CSV file located in a particular place - this way the feature could work without having to make any changes in the GUI. Thus, everyone could maintain their own library of proprietary OIDs or share the list within a working group.

Crypt32 commented 10 months ago

Actually, it is already there. See "OID lookup" section in latest release notes: https://github.com/PKISolutions/Asn1Editor.WPF/releases/tag/v23.10.24

Currently, I ship a pre-created OID.txt file and it is placed along with executable. It is not recommended to update it, because your edits will be lost with upgrade, this is why I've added a custom location in roaming user profile folder to store custom OID lookup table.

Speaking about a context-menu: maybe it is a good idea.

ralienpp commented 10 months ago

Thanks for the tip, this is very helpful.

Exposing this option in the context menu would improve discoverability, in my opinion; because this is the natural place for one to stumble upon it.

Crypt32 commented 10 months ago

Wouldn't you mind to test the implementation of OID mapping editor? Here is what I've come right now. On OBJECT_IDENTIFIER tree node's context menu there is a new menu item: image which will invoke the editor dialog: image and pre-populate OID Value field with OID OID value from selected element. Here you can provide friendly name and save. Save button will attempt to save OID.txt in your user's %appdata% folder immediately.

Current logic is that if both OID.txt files (in application and in %appdata%) contain same definition, user-defined mapping will take precedence (overwrite value from application's OID.txt).

In addition to that, you can view and search existing OID lookup by either OID (or its beginning) or friendly name (contains part) in either, application or user lookups, or both.

There is no Edit action. If you want to override existing mapping (say, provide a different name to an OID registered in application's OID.txt), you should remove existing OID, it will copy oid into editor for recovery purposes and save it again. Any edits will save OID in %appdata%.

Note: edits will not affect existing opened tabs, only newly opened tabs. Reloading all tabs can be somewhat problematic if there are unsaved changes.

Any time, you can invoke this editor from main toolbar: image Currently, without an icon.

And as the last note: it seems OID DB is quite large and WPF UI may struggle a little-bit on this. This is why I set default source to User-Defined, it is supposed to contain only custom OIDs and overrides and have less impact on a UI.

ralienpp commented 10 months ago

Thanks for the feedback, I'd be happy to test it. Where can I download the binary?

Crypt32 commented 10 months ago

Asn1Editor-23.11.22.zip Here is the build to test.

ralienpp commented 10 months ago

It works, thanks a lot!

edits will not affect existing opened tabs, only newly opened tabs. Reloading all tabs can be somewhat problematic if there are unsaved changes.

Understood, that's fine by me; though a low-hanging fruit would be to reload automatically for tabs that do not have edits.

Some other points:

Crypt32 commented 10 months ago
  • If I right-click on an OID node with a known name, the menu option could be called "Edit Object Identifier", rather than "Register Object Identifier"

sounds reasonable.

  • However, if you insist on having an icon - I would consider having a picture of a book - a dictionary.

Ok, will find something in my collection.

You can make the "Friendly Name" column wider by default

Ok. I just checked the most comfortable width for OID column by measuring existing OID list plus some extra space and set Friendly name column to fit column in normal window size plus scrollbar.

At a minimum - make the field widths "sticky"; i.e., if I manually resize it once - then use the same widths the next time the dialog is shown.

well, I can try to implement this within current session. I mean, they won't be saved in settings file. The reason is how settings are handled: I'm trying to overwrite the file immediately when setting is changed. When you resize the column, it will flood with width changed events and with every event it will try to overwrite the file and will eventually crash because previous event handler didn't finish and the file will be locked.

  • Accessing the OID editor through the main menu only is also fine

I think it can be accessed from both places, context menu and main toolbar. The behavior will be slightly different, from context menu the OID value is automatically copied to editor form.

Crypt32 commented 10 months ago

Asn1Editor-23.11.22.zip Ok, here is another build which addresses most of your feedback.

Crypt32 commented 10 months ago

There is one more update: OID Editor window respects font size settings. If you set it to 16, then all controls in the window will receive new font size.

Crypt32 commented 9 months ago

Here is the official release with requested functionality: https://github.com/PKISolutions/Asn1Editor.WPF/releases/tag/v23.11.24