1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-10-17 03:42:50 +02:00
Minecraft-Phantom-Panel/Common/Phantom.Common.Data/Backups/BackupCreationWarnings.cs
2023-02-24 17:22:19 +01:00

22 lines
672 B
C#

using System.Numerics;
namespace Phantom.Common.Data.Backups;
[Flags]
public enum BackupCreationWarnings : byte {
None = 0,
CouldNotDeleteTemporaryFolder = 1 << 0,
CouldNotCompressWorldArchive = 1 << 1,
CouldNotRestoreAutomaticSaving = 1 << 2
}
public static class BackupCreationWarningsExtensions {
public static int Count(this BackupCreationWarnings warnings) {
return BitOperations.PopCount((byte) warnings);
}
public static IEnumerable<BackupCreationWarnings> ListFlags(this BackupCreationWarnings warnings) {
return Enum.GetValues<BackupCreationWarnings>().Where(warning => warning != BackupCreationWarnings.None && warnings.HasFlag(warning));
}
}