using System;
using System.ComponentModel;
using System.Reflection;

namespace QCRPG.Framework;

public static class HelperUtils
{
	public static string GetDescriptionOfEnum(Enum value)
	{
		FieldInfo field = value.GetType().GetField(value.ToString());
		object[] customAttributes = field.GetCustomAttributes(inherit: false);
		object[] array = customAttributes;
		foreach (object obj in array)
		{
			if (obj is DescriptionAttribute)
			{
				return ((DescriptionAttribute)obj).Description;
			}
		}
		return value.ToString();
	}
}
