tnunnink / L5Sharp

A library for intuitively interacting with Rockwell's L5X import/export files.
MIT License
55 stars 6 forks source link

Subtag Descriptions In UDTs only returning base tag. #8

Closed JakeSmithQUT closed 1 year ago

JakeSmithQUT commented 1 year ago

When Looping through each members in a tag, the descriptions of those sub-tags only returns the description of the highest level tag when using the .Description function

foreach (var subtag in tag.Members()) {
    Console.Writeline(subtag.Description);
}

Will always return the same description

tnunnink commented 1 year ago

That's correct. The way Rockwell serializes tag descriptions is weird. If you look at the underlying XML, nested tag comments are stored in a different element tree, whereas the tag description is stored in the normal description element like other components. The API was intended to mimic this by providing both Description and Comment properties. So, in your case you would want Comment not Description.

However, I see how this is confusing and a detail that we probably don't care about. There is no reason I couldn't combine these properties and just work out the details internally. I went ahead and updated the code to consolidate to a single Description property which internally will figure out which value to get/set based on if the tag is a nested member or the root tag.

I will push the updates out once I finish fixing some tests later today.

tnunnink commented 1 year ago

Fixed with version 0.14.0

JakeSmithQUT commented 1 year ago

This is outstanding! Thank you so much for the hard work!