36 lines
901 B
C#
Raw Normal View History

2024-07-26 09:14:46 +02:00
namespace CodexPlugin.OverwatchSupport
{
public class NameIdMap
{
private readonly Dictionary<string, string> map = new Dictionary<string, string>();
2024-08-08 10:24:16 +02:00
private readonly Dictionary<string, string> shortToLong = new Dictionary<string, string>();
2024-07-26 09:14:46 +02:00
public void Add(string name, string peerId)
{
map.Add(name, peerId);
2024-08-08 10:24:16 +02:00
shortToLong.Add(CodexUtils.ToShortId(peerId), peerId);
2024-07-26 09:14:46 +02:00
}
public string GetPeerId(string name)
{
return map[name];
}
2024-08-08 10:24:16 +02:00
public string ReplaceShortIds(string value)
{
var result = value;
foreach (var pair in shortToLong)
{
result = result.Replace(pair.Key, pair.Value);
}
return result;
}
public int Size
{
get { return map.Count; }
}
2024-07-26 09:14:46 +02:00
}
}