AssetPackager.Helpers.AssetListTypeHelper.GetTypeByName C# (CSharp) Method

GetTypeByName() public static method

Gets an asset list type from string.
public static GetTypeByName ( string shortName ) : AssetListType
shortName string Asset type (full or short name).
return AssetListType
		public static AssetListType GetTypeByName(string shortName)
		{
			if (String.IsNullOrEmpty(shortName)) return AssetListType.Undefined;

			shortName = shortName.ToUpperInvariant();
			foreach (FieldInfo field in typeof(AssetListType).GetFields())
			{
				object[] attributes = field.GetCustomAttributes(typeof(ShortNameAttribute), false);

				foreach (ShortNameAttribute shortNameAttribute in attributes)
				{
					if (String.CompareOrdinal(shortName, shortNameAttribute.Name.ToUpperInvariant()) == 0)
						return (AssetListType) field.GetValue(null);
				}
				if (String.CompareOrdinal(shortName, field.Name.ToUpperInvariant()) == 0)
					return (AssetListType)field.GetValue(null);
			}
			return AssetListType.Undefined;
		}
AssetListTypeHelper