using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
namespace Vestris.ResourceLib
{
///
/// Resource utilities.
///
public abstract class ResourceUtil
{
///
/// Get a string representation of flags.
///
/// Flag collection type.
/// Flag vlaue
/// String representation of flags in the f1 | ... | fn format.
internal static string FlagsToString(UInt32 flagValue)
{
List flags = new List();
flags.AddRange(FlagsToList(flagValue));
return String.Join(" | ", flags.ToArray());
}
///
/// Get a collection of flags from a flag value.
///
/// Flag collection type.
/// Flag value.
/// Collection of flags.
internal static List FlagsToList(UInt32 flagValue)
{
List flags = new List();
foreach (T f in Enum.GetValues(typeof(T)))
{
UInt32 f_ui = Convert.ToUInt32(f);
if ((flagValue & f_ui) > 0 || flagValue == f_ui)
{
flags.Add(f.ToString());
}
}
return flags;
}
}
}