mirror of
https://github.com/jaquadro/NBTExplorer.git
synced 2025-01-10 01:46:24 +00:00
31 lines
662 B
C#
31 lines
662 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace NBTExplorer
|
|||
|
{
|
|||
|
public class IconRegistry
|
|||
|
{
|
|||
|
private static Dictionary<Type, int> _iconRegistry;
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|