mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-13 05:35:26 +00:00
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using MPF.Core.Converters;
|
|
using MPF.Core.Data;
|
|
using SabreTools.RedumpLib.Data;
|
|
|
|
namespace MPF.Core.Utilities
|
|
{
|
|
public static class EnumExtensions
|
|
{
|
|
/// <summary>
|
|
/// Determine if the media supports drive speeds
|
|
/// </summary>
|
|
/// <param name="type">MediaType value to check</param>
|
|
/// <returns>True if the media has variable dumping speeds, false otherwise</returns>
|
|
public static bool DoesSupportDriveSpeed(this MediaType? type)
|
|
{
|
|
return type switch
|
|
{
|
|
MediaType.CDROM
|
|
or MediaType.DVD
|
|
or MediaType.GDROM
|
|
or MediaType.HDDVD
|
|
or MediaType.BluRay
|
|
or MediaType.NintendoGameCubeGameDisc
|
|
or MediaType.NintendoWiiOpticalDisc => true,
|
|
_ => false,
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// List all programs with their short usable names
|
|
/// </summary>
|
|
public static List<string> ListPrograms()
|
|
{
|
|
var programs = new List<string>();
|
|
|
|
foreach (var val in Enum.GetValues(typeof(InternalProgram)))
|
|
{
|
|
if (((InternalProgram)val!) == InternalProgram.NONE)
|
|
continue;
|
|
|
|
programs.Add($"{((InternalProgram?)val).LongName()}");
|
|
}
|
|
|
|
return programs;
|
|
}
|
|
}
|
|
}
|