mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-11-23 19:42:51 +01:00
22 lines
672 B
C#
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));
|
|
}
|
|
}
|