示例#1
0
        public void BinarySerialization_Model()
        {
            var model = new Karamba.Models.Model();

            model.in_materials.Add(new FemMaterial_Isotrop("test", "", 1, 2, 3, 4, 5, -6,
                                                           FemMaterial.FlowHypothesis.mises, 8, null));
            model.initMaterialCroSecLists();

            var formatter = ModelSerializer.GetInstance().Formatter;
            var stream    = new MemoryStream();

            formatter.Serialize(stream, model);
            var data        = Convert.ToBase64String(stream.ToArray());
            var stream_dser = new MemoryStream(Convert.FromBase64String(data));
            var model_dser  = (Karamba.Models.Model)formatter.Deserialize(stream_dser);
        }