public void Set(ScanFormatted scanf)
{
if (scanf.Results.Count >= 1)
Set(scanf.Results[0]);
if (scanf.Results.Count >= 2)
{
if (Items == null)
Items = new Dictionary<int, string>();
else
Items.Clear();
foreach (string item in ((string)scanf.Results[1]).Split(Common.CHAR_COMMA))
{
string pair = item.Trim();
int value = -1; string key = string.Empty;
int idx;
if (!string.IsNullOrEmpty(pair))
{
if ((idx = pair.IndexOf('=')) >= 0)
{
if (idx > 0)
{
if (!int.TryParse(pair.Substring(0, idx), NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
continue;
}
if (idx + 1 >= pair.Length)
continue;
key = pair.Substring(idx + 1);
if (key.Length > 1)
{
if (key.EndsWith("]"))
key = key.Substring(0, key.Length - 1);
if (!Items.ContainsKey(value))
Items.Add(value, key);
}
}
else
{
if (pair.EndsWith("]"))
pair = pair.Substring(0, pair.Length - 1);
if (!int.TryParse(pair, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
continue;
if (!Items.ContainsKey(value))
Items.Add(value, pair);
}
}
}
}
}