/// <summary> /// Called whenever a Rhino document is being loaded and plug-in user data was /// encountered written by a plug-in with this plug-in's GUID. /// </summary> protected override void ReadDocument(RhinoDoc doc, BinaryArchiveReader archive, FileReadOptions options) { archive.Read3dmChunkVersion(out var major, out var minor); if (MAJOR == major && MINOR == minor) { // Always read user data even though you might not use it. var string_table = new SampleCsStringDocumentData(); string_table.ReadDocument(archive); var simple_table = new SampleCsSimpleDocumentDataTable(); simple_table.ReadDocument(archive); var dictionary = archive.ReadDictionary(); if (!options.ImportMode && !options.ImportReferenceMode) { if (string_table.Count > 0) { StringDocumentDataTable.AddRange(string_table.ToArray()); } if (simple_table.Count > 0) { SimpleDocumentDataTable.AddRange(simple_table.ToArray()); } if (null != dictionary && dictionary.Count > 0) { Dictionary = dictionary; } } } }
/// <summary> /// Constructor /// </summary> public SampleCsUserDataPlugIn() { Instance = this; StringDocumentDataTable = new SampleCsStringDocumentData(); SimpleDocumentDataTable = new SampleCsSimpleDocumentDataTable(); Dictionary = new ArchivableDictionary(MAJOR, "SampleCsDictionary"); }