Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8684

Deserialize inside visual studio

$
0
0

@Petras_Vestartas wrote:

If I have added byte[] file MakaBreps.bin in Visual Studio resources, how can I deserialize it?

Before I followed this grasshopper reference:

But this example works with directories and folders.
I am wondering how it would work if I have the .bin file in project properties.resources?

What I have so far in code:

        protected override void SolveInstance(IGH_DataAccess DA) {

        //////////////////////////////////////////////////

        // Serialized data will write using the current version of Rhino
        // If you want to write data in Rhino 5 that can be read into Rhino 4,
        // then you need to use the SerializationOptions class to enforce this

        var options = new Rhino.FileIO.SerializationOptions();
        options.RhinoVersion = 4;
        var context = new System.Runtime.Serialization.StreamingContext(System.Runtime.Serialization.StreamingContextStates.All, options);
        var bin_formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(null, context);

     //From here I am lost
        bin_formatter.Deserialize(Properties.Resources.MakaBreps);

        //stream.Close();
    }

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8684

Latest Images

Trending Articles



Latest Images