Skip to content

Commit

Permalink
jankily reimplement gif parser using gwaredd/mgGif
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor committed Dec 21, 2021
1 parent ef32137 commit 1efccbd
Show file tree
Hide file tree
Showing 6 changed files with 1,162 additions and 5 deletions.
30 changes: 30 additions & 0 deletions MelonStartScreen/EnumExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;

namespace MelonLoader.MelonStartScreen
{
/// <summary>
/// Extentions for enums.
/// </summary>
public static class EnumExtensions
{
/// <summary>
/// A FX 3.5 way to mimic the FX4 "HasFlag" method.
/// </summary>
/// <param name="variable">The tested enum.</param>
/// <param name="value">The value to test.</param>
/// <returns>True if the flag is set. Otherwise false.</returns>
public static bool HasFlag(this Enum variable, Enum value)
{
// check if from the same type.
if (variable.GetType() != value.GetType())
{
throw new ArgumentException("The checked flag is not from the same type as the checked variable.");
}

ulong num = Convert.ToUInt64(value);
ulong num2 = Convert.ToUInt64(variable);

return (num2 & num) == num;
}
}
}
Loading

0 comments on commit 1efccbd

Please sign in to comment.