namespace AIStudio.Tools.PluginSystem; public abstract partial class PluginBase { private const string DEFAULT_ICON_SVG = """ """; #region Initialization-related methods /// /// Tries to initialize the icon of the plugin. /// /// /// When no icon is specified, the default icon will be used. /// /// The error message, when the icon could not be read. /// The read icon as SVG. /// True, when the icon could be read successfully. // ReSharper disable once OutParameterValueIsAlwaysDiscarded.Local // ReSharper disable once UnusedMethodReturnValue.Local private bool TryInitIconSVG(out string message, out string iconSVG) { if (!this.state.Environment["ICON_SVG"].TryRead(out iconSVG)) { iconSVG = DEFAULT_ICON_SVG; message = "The field ICON_SVG does not exist or is not a valid string."; return true; } if (string.IsNullOrWhiteSpace(iconSVG)) { iconSVG = DEFAULT_ICON_SVG; message = "The field ICON_SVG is empty. The icon must be a non-empty string."; return true; } message = string.Empty; return true; } #endregion }