mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-31 13:21:05 +00:00
Added EnumValue.(cs) class and file. Changed TargetHost.VMWare to TargetHost.VMWareWorkStation, and TargetHost.VMWareServer. Added Architecture enum. Added Framework enum. Added VMQemuNetworkCard enum. Added VMQemuAudioCard enum. Added DebugQemuCommuincation enum. Added DescriptionAttribute class.
41 lines
851 B
C#
41 lines
851 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Cosmos.Builder.Common
|
|
{
|
|
|
|
public class EnumValue
|
|
{
|
|
|
|
public static EnumValue[] GetEnumValues(Type enumType)
|
|
{
|
|
if (enumType.IsEnum == false)
|
|
{ throw new Exception("Invalid type, only enum types allowed."); }
|
|
|
|
List<EnumValue> list = new List<EnumValue>();
|
|
|
|
foreach (Object value in Enum.GetValues(enumType))
|
|
{ list.Add(new EnumValue((Enum)value)); }
|
|
|
|
return list.ToArray();
|
|
}
|
|
|
|
public EnumValue()
|
|
{ }
|
|
|
|
public EnumValue(Enum value)
|
|
{ this.Value = value; }
|
|
|
|
public Enum Value
|
|
{ get; set; }
|
|
|
|
public override string ToString()
|
|
{
|
|
if (this.Value != null)
|
|
{ return Cosmos.Builder.Common.DescriptionAttribute.GetDescription(this.Value); }
|
|
return base.ToString();
|
|
}
|
|
}
|
|
}
|