Datamodel - Simplified some things

This commit is contained in:
Robert committed 2020-06-26 13:00:43 +02:00
1 parent e184d8b724
commit 1bc8d65237
10 files changed
+111 -116

No files matched your search

+2 -13
View File
@@ -61,37 +61,26 @@ namespace Artemis.Core.Services
}
}
public DataModelDescription GetMainDataModelDescription()
{
var dataModelDescription = new DataModelDescription();
return dataModelDescription;
}
private void PluginServiceOnPluginEnabled(object sender, PluginEventArgs e)
{
if (e.PluginInfo.Instance is Module module && module.InternalExpandsMainDataModel)
{
if (!module.InternalDataModel.Initialized)
if (module.InternalDataModel.DataModelDescription == null)
{
module.InternalDataModel.DataModelDescription = module.InternalGetDataModelDescription();
if (module.InternalDataModel.DataModelDescription == null)
throw new ArtemisPluginException(module.PluginInfo, "Module overrides GetDataModelDescription but returned null");
module.InternalDataModel.Initialize();
}
_dataModelExpansions.Add(module.InternalDataModel);
}
else if (e.PluginInfo.Instance is BaseDataModelExpansion dataModelExpansion)
{
if (!dataModelExpansion.InternalDataModel.Initialized)
if (dataModelExpansion.InternalDataModel.DataModelDescription == null)
{
dataModelExpansion.InternalDataModel.DataModelDescription = dataModelExpansion.GetDataModelDescription();
if (dataModelExpansion.InternalDataModel.DataModelDescription == null)
throw new ArtemisPluginException(dataModelExpansion.PluginInfo, "Data model expansion overrides GetDataModelDescription but returned null");
dataModelExpansion.InternalDataModel.Initialize();
}
_dataModelExpansions.Add(dataModelExpansion.InternalDataModel);