Deserialization of BinaryArchive


(Karol Wierzbicki) #1

Hi,

I’ve met some strange behaviour of archive.ReadDictionary.

I have 2 plugins Reading the same document in more or less the same time (managed by rhino3d). One can deserialize data without any problems, on 2nd one readErrorOccured is true. What could be the problem here? Is it access related? Nothing actually changes inside 3dm file after 1st plugin reads data.
This is the code.

    protected override void ReadDocument(RhinoDoc doc, BinaryArchiveReader archive, FileReadOptions options)
    {
        shipData = new ShipData();
        Rhino.Collections.ArchivableDictionary dict = archive.ReadDictionary();
        shipData.VesselName = (string)dict["VesselName"];
        .....
    }

Storing data between different plug-ins
(Menno Deij - van Rijswijk) #2

Both plug-ins should write their own copy of the dictionary. You can’t read the dictionary written by one plugin in another plugin.


(Karol Wierzbicki) #3

Is there a way to go around?


(Menno Deij - van Rijswijk) #4

Read it in one plugin and share it to the other plugin via a common dependency. That is the way we do it too.

DLL A - contains the shared object, in your case a dictionary.
Plugin 1 - has a dependency on A and reads/writes the object from/to 3dm file
Plugin 2 - has a dependency on A and can get access to the shared object after it has been read.


(Karol Wierzbicki) #5

This is good to know menno, thanks.