Binary serialization to a shared store, is it possible?

Hi

I am in the middle of writing the second part of my free control library that I hope I will post on my web site at the end of this week, if I solve this problem of course :)

I am trying to create a common theme store component that can be used by the controls in an application; the main idea is to provide the component with the theme data, like images, properties, etc.

My problem now is that I have a collection of objects (inside the theme component), the ixThemeList, this collection when marked as [Serializable], and it is storing the themes to the resource file of the form that the component is put on.

Every form can have one theme store (LTTheme), and using the current binary serialization, every theme component on every form will store a copy of the serialized theme to the resource file of the form.

So if an application has 50 forms, it will have 50 copies of the theme data, which is to much.

So the question is:
Is there is an easy way to tell Microsoft Visual Studio.NET at design time to binary serialize the collection inside a specific resource file? This actually will save me a lot of work.

Otherwise I must create my own binary serializer, and this itself may take a week or more.

Thanks

[1235 byte] By [codefund.com] at [2007-12-16]
# 1
I really can't think of a good way to do this. If you create a serializer, you can probably add a file to the project as an Embedded Resource and use Assembly.GetManifestResourceStream() to get at the data at runtime, which you'll have to generate code for. At design time you'll also need to have the serializer know how to go open that file and get the data out as well.

So you are looking at a decent amount of work here unfortunately.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 2
Thank you for the idea,

I am trying to do something similar using DTE to access the VS.NET files at design time, plus using some other classes like ResXResourceWriter, and ResXResourceSet to store and retrieve the themes.

After 4 days of coding using my way, I end up with more than a thousand lines of code (in multiple classes), most of the code full with design time problems, and I can’t find a way to debug something like designer or converter in VS.NET

Anyway, yesterday I give-up trying to write the code my way, and decided to implement the Microsoft Way ;-) by implementing the serializers (I finally got the idea how they work), and this morning the code shrieked dramatically, one of the classes was more than 500 lines of code, this morning it’s only 30 lines of code :), after implementing the serialization, and the best think was that it works :) (Comparing it to my previous code)

I just realized that the class serialization is one of the best features ever implemented in .NET, it’s wonderful.

I will publish the code on the net as soon as I put the final touches.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...