2015-03-13 22:04:23 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace ScriptTool
|
|
|
|
|
{
|
|
|
|
|
class LabelMap
|
|
|
|
|
{
|
|
|
|
|
public IDictionary<int, string> Labels { get; private set; }
|
2015-03-16 04:16:12 +00:00
|
|
|
|
|
2015-03-13 22:04:23 +00:00
|
|
|
|
private int counter = 0;
|
|
|
|
|
|
|
|
|
|
public LabelMap()
|
|
|
|
|
{
|
|
|
|
|
Labels = new Dictionary<int, string>();
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-16 04:16:12 +00:00
|
|
|
|
public void Add(int address)
|
2015-03-13 22:04:23 +00:00
|
|
|
|
{
|
|
|
|
|
if (!Labels.ContainsKey(address))
|
|
|
|
|
{
|
|
|
|
|
string newLabel = String.Concat("L", counter.ToString());
|
|
|
|
|
Labels.Add(address, newLabel);
|
|
|
|
|
counter++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-16 04:16:12 +00:00
|
|
|
|
|
|
|
|
|
public void AddRange(IEnumerable<int> addresses)
|
2015-03-13 22:04:23 +00:00
|
|
|
|
{
|
2015-03-16 04:16:12 +00:00
|
|
|
|
foreach (int address in addresses)
|
|
|
|
|
Add(address);
|
2015-03-13 22:04:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|