Add maintenance and deprecation message flags to plugins

This commit is contained in:
Thorsten Sommer 2025-03-22 12:21:56 +01:00
parent ff788b33f2
commit 14ce3be083
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -431,5 +431,43 @@ public abstract class PluginBase
return true; return true;
} }
/// <summary>
/// Tries to read the maintenance status of the plugin.
/// </summary>
/// <param name="message">The error message, when the maintenance status could not be read.</param>
/// <param name="isMaintained">The read maintenance status.</param>
/// <returns>True, when the maintenance status could be read successfully.</returns>
private bool TryInitIsMaintained(out string message, out bool isMaintained)
{
if (!this.state.Environment["IS_MAINTAINED"].TryRead(out isMaintained))
{
isMaintained = false;
message = "The field IS_MAINTAINED does not exist or is not a valid boolean.";
return false;
}
message = string.Empty;
return true;
}
/// <summary>
/// Tries to read the deprecation message of the plugin.
/// </summary>
/// <param name="message">The error message, when the deprecation message could not be read.</param>
/// <param name="deprecationMessage">The read deprecation message.</param>
/// <returns>True, when the deprecation message could be read successfully.</returns>
private bool TryInitDeprecationMessage(out string message, out string? deprecationMessage)
{
if (!this.state.Environment["DEPRECATION_MESSAGE"].TryRead(out deprecationMessage))
{
deprecationMessage = null;
message = "The field DEPRECATION_MESSAGE does not exist, is not a valid string. This field is optional: use nil to indicate that the plugin is not deprecated.";
return false;
}
message = string.Empty;
return true;
}
#endregion #endregion
} }