IMPORTANT: avoid calling base.MakeReferenceInternal on derived DataFormats because this will overwrite the base DataFormatReference

This commit is contained in:
Michael Becker 2022-04-16 11:23:35 -04:00
parent 2723f02ecf
commit 2a5af21d06
No known key found for this signature in database
GPG Key ID: DA394832305DA332
3 changed files with 13 additions and 2 deletions

View File

@ -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<ObjectModel> objectModels)
{
base.BeforeLoadInternal (objectModels);

View File

@ -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));

View File

@ -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;