So in simplest form it looks like regular code it just serialize an array of strings on save and deserialize on readdocument. Other than that it’s regular code. It works fine when document is saved and opened in rhino 8 but when document is saved in rhino 7 and opened in rhino 8 it’s not reaching the ReadDocument. I hope this is enough if not I can try to prepare an example hoping it’s reproducible
public partial class PlugIn : PlugIn
{
public static List<string> Foo { get; set; }
public PlugIn()
{
Instance = this;
}
public static PlugIn Instance
{
get;
private set;
}
protected override void ReadDocument(RhinoDoc doc, FileIO.BinaryArchiveReader archive, FileIO.FileReadOptions options)
{
ReadWrite.DeSerializeShipData(archive);
...
}
protected override bool ShouldCallWriteDocument(FileIO.FileWriteOptions options)
{
return true;
}
protected override void WriteDocument(RhinoDoc doc, FileIO.BinaryArchiveWriter archive, FileIO.FileWriteOptions options)
{
ReadWrite.SerializeShipData(Foo , archive);
}
///<returns>The command name as it appears on the Rhino command line.</returns>
protected override LoadReturnCode OnLoad(ref string errorMessage)
{
// Get MyPanel class type
Type panelType = typeof(MainPanel);
Panels.RegisterPanel(this, panelType, "TEST", Properties.Resources.FemTools32x32, PanelType.System);
return base.OnLoad(ref errorMessage);
}
}
Method used to serialize
public static void SerializeShipData(List<string> log, FileIO.BinaryArchiveWriter archive)
{
if (log != null)
{
var dictionary = new Collections.ArchivableDictionary(archive.Archive3dmVersion, "Test");
var byteArray = StringToByteArray(log);
dictionary.Set("Test", byteArray);
archive.WriteDictionary(dictionary);
}
}