2024-10-25 14:31:50 -04:00
|
|
|
// Copyright (C) 2024 Intro-Skipper contributors <intro-skipper.org>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-only.
|
2024-10-25 14:15:12 -04:00
|
|
|
|
2024-10-19 23:50:41 +02:00
|
|
|
namespace IntroSkipper.Data;
|
2024-08-31 16:48:31 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Warning manager.
|
|
|
|
/// </summary>
|
|
|
|
public static class WarningManager
|
|
|
|
{
|
2024-09-10 18:08:42 +02:00
|
|
|
private static PluginWarning _warnings;
|
2024-08-31 16:48:31 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set warning.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="warning">Warning.</param>
|
|
|
|
public static void SetFlag(PluginWarning warning)
|
|
|
|
{
|
2024-09-10 18:08:42 +02:00
|
|
|
_warnings |= warning;
|
2024-08-31 16:48:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Clear warnings.
|
|
|
|
/// </summary>
|
|
|
|
public static void Clear()
|
|
|
|
{
|
2024-09-10 18:08:42 +02:00
|
|
|
_warnings = PluginWarning.None;
|
2024-08-31 16:48:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get warnings.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Warnings.</returns>
|
|
|
|
public static string GetWarnings()
|
|
|
|
{
|
2024-09-10 18:08:42 +02:00
|
|
|
return _warnings.ToString();
|
2024-08-31 16:48:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Check if a specific warning flag is set.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="warning">Warning flag to check.</param>
|
|
|
|
/// <returns>True if the flag is set, otherwise false.</returns>
|
|
|
|
public static bool HasFlag(PluginWarning warning)
|
|
|
|
{
|
2024-09-10 18:08:42 +02:00
|
|
|
return (_warnings & warning) == warning;
|
2024-08-31 16:48:31 +00:00
|
|
|
}
|
|
|
|
}
|