billroper: (Default)
[personal profile] billroper
For the project that I'm working on, I need to retrieve one of the preference settings that is in the registry for our application. This turned out to be -- surprise! -- more difficult than it probably should have been.

The preferences have all been loaded into memory in the COM object using a common DLL. Unfortunately, I needed the value in the C# layer which meant it was time to generate some XML to retrieve the preferences. But all of the preferences were currently keyed by their resource ID in the string table in the resource DLL. (I originally wrote the preference handling code many years ago; someone else removed my original enum indexing and replaced it with this for reasons that are not clear.) Of course, we don't have access to those resource IDs in the C# layer.

So I hand typed all of the actual strings into a C# pref class as const strings so that they'd have symbolic names to retrieve them with. There were a lot of strings. Having done this, I could write the XML that would retrieve a preference -- but after looking at it for a bit, I decided I may as well let it retrieve an arbitrary number of preferences in one call. Mind you, I still haven't written a C# interface that would generate that XML yet, but I've defined it and can parse it on the back end, so it's progress.

I also had to add methods to the C++ preference classes so that we could retrieve them by the name of the preference, but that was fairly straightforward. And while I was there, I added a method to each of the preference types to generate an appropriate XML rendering.

Since I'm still an XML tyro, it took a little time to figure out how to parse the XML using the available tools and MSXML. But I eventually sorted it out, I think. I still need to test the whole thing, but I've touched so many different classes, some of which other people will want shortly, that I'm just going to check it in now that I've gotten it to compile.

If someone else uses it before I do, they can let me know if it doesn't work right. :)

Date: 2012-08-18 12:10 pm (UTC)
From: [identity profile] catsittingstill.livejournal.com
Wow.

I know almost nothing about computer programming / database management. But I know in general that some of the most difficult problems to solve are the ones where you have to make major changes while working around what's already there. That's why it's harder to turn a tuxedo into a party dress than it is to just make a party dress from a bolt of cloth.

Good luck with the project! May all the seams hold.

Profile

billroper: (Default)
billroper

January 2026

S M T W T F S
     1 2 3
4 5 6 7 8910
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 25th, 2026 10:39 am
Powered by Dreamwidth Studios