NBTExplorer/IconRegistry.cs

31 lines
655 B
C#
Raw Normal View History

2012-08-31 05:29:32 +00:00
using System;
using System.Collections.Generic;
namespace NBTExplorer
{
public class IconRegistry
{
private Dictionary<Type, int> _iconRegistry;
2012-08-31 05:29:32 +00:00
public IconRegistry ()
{
_iconRegistry = new Dictionary<Type, int>();
}
public int DefaultIcon { get; set; }
public int Lookup (Type type)
{
if (_iconRegistry.ContainsKey(type))
return _iconRegistry[type];
else
return DefaultIcon;
}
public void Register (Type type, int iconIndex)
{
_iconRegistry[type] = iconIndex;
}
}
}