From 2a5af21d064896b2bc7cf7b83be60af81e85413e Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 16 Apr 2022 11:23:35 -0400 Subject: [PATCH] IMPORTANT: avoid calling base.MakeReferenceInternal on derived DataFormats because this will overwrite the base DataFormatReference --- .../FamilyTreeMaker/Windows/FTWDataFormat.cs | 11 +++++++++++ .../CompoundDocument/CompoundDocumentDataFormat.cs | 2 +- .../DataFormats/Text/Formatted/DOC/DOCDataFormat.cs | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Plugins/UniversalEditor.Plugins.Genealogy/DataFormats/FamilyTreeMaker/Windows/FTWDataFormat.cs b/Plugins/UniversalEditor.Plugins.Genealogy/DataFormats/FamilyTreeMaker/Windows/FTWDataFormat.cs index 9ceeaf94..6773e27e 100644 --- a/Plugins/UniversalEditor.Plugins.Genealogy/DataFormats/FamilyTreeMaker/Windows/FTWDataFormat.cs +++ b/Plugins/UniversalEditor.Plugins.Genealogy/DataFormats/FamilyTreeMaker/Windows/FTWDataFormat.cs @@ -8,6 +8,17 @@ namespace UniversalEditor.Plugins.Genealogy.DataFormats.FamilyTreeMaker.Windows { public class FTWDataFormat : CompoundDocumentDataFormat { + private static DataFormatReference _dfr = null; + protected override DataFormatReference MakeReferenceInternal() + { + if (_dfr == null) + { + _dfr = new DataFormatReference(GetType()); + _dfr.Capabilities.Add(typeof(FamilyTreeObjectModel), DataFormatCapabilities.All); + } + return _dfr; + } + protected override void BeforeLoadInternal (Stack objectModels) { base.BeforeLoadInternal (objectModels); diff --git a/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/FileSystem/Microsoft/CompoundDocument/CompoundDocumentDataFormat.cs b/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/FileSystem/Microsoft/CompoundDocument/CompoundDocumentDataFormat.cs index 3e88af18..21262783 100644 --- a/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/FileSystem/Microsoft/CompoundDocument/CompoundDocumentDataFormat.cs +++ b/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/FileSystem/Microsoft/CompoundDocument/CompoundDocumentDataFormat.cs @@ -39,7 +39,7 @@ namespace UniversalEditor.DataFormats.FileSystem.Microsoft.CompoundDocument { if (_dfr == null) { - _dfr = base.MakeReferenceInternal(); + _dfr = new DataFormatReference(GetType()); _dfr.Capabilities.Add(typeof(FileSystemObjectModel), DataFormatCapabilities.All); _dfr.ExportOptions.SettingsGroups[0].Settings.Add(new RangeSetting(nameof(SectorSize), "_Sector size (in bytes)", 512, 128)); _dfr.ExportOptions.SettingsGroups[0].Settings.Add(new RangeSetting(nameof(ShortSectorSize), "S_hort sector size (in bytes)", 64)); diff --git a/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/DOC/DOCDataFormat.cs b/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/DOC/DOCDataFormat.cs index eb77e45b..64b419ba 100644 --- a/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/DOC/DOCDataFormat.cs +++ b/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Text/Formatted/DOC/DOCDataFormat.cs @@ -36,7 +36,7 @@ namespace UniversalEditor.DataFormats.Text.Formatted.DOC { if (_dfr == null) { - _dfr = base.MakeReferenceInternal(); + _dfr = new DataFormatReference(GetType()); _dfr.Capabilities.Add(typeof(FormattedTextObjectModel), DataFormatCapabilities.All); } return _dfr;