| 1 |
using System.Collections.Generic; |
| 2 |
using System.Text; |
| 3 |
|
| 4 |
namespace Lextm.SharpSnmpLib.Mib |
| 5 |
{ |
| 6 |
public class ObjectIdentifier: List<KeyValuePair<string, uint>> |
| 7 |
{ |
| 8 |
public void Add(string name, uint oid) |
| 9 |
{ |
| 10 |
this.Add(new KeyValuePair<string, uint>(name, oid)); |
| 11 |
} |
| 12 |
|
| 13 |
public void Prepend(string name, uint oid) |
| 14 |
{ |
| 15 |
this.Insert(0, new KeyValuePair<string, uint>(name, oid)); |
| 16 |
} |
| 17 |
|
| 18 |
public void Insert(int index, string name, uint oid) |
| 19 |
{ |
| 20 |
this.Insert(index, new KeyValuePair<string, uint>(name, oid)); |
| 21 |
} |
| 22 |
|
| 23 |
public string GetOidString() |
| 24 |
{ |
| 25 |
StringBuilder result = new StringBuilder(); |
| 26 |
|
| 27 |
foreach (KeyValuePair<string, uint> level in this) |
| 28 |
{ |
| 29 |
result.Append(level.Value); |
| 30 |
result.Append('.'); |
| 31 |
} |
| 32 |
|
| 33 |
if (result.Length > 0) |
| 34 |
{ |
| 35 |
result.Length--; |
| 36 |
} |
| 37 |
|
| 38 |
return result.ToString(); |
| 39 |
} |
| 40 |
|
| 41 |
public uint[] GetOidValues() |
| 42 |
{ |
| 43 |
List<uint> result = new List<uint>(); |
| 44 |
|
| 45 |
foreach (KeyValuePair<string, uint> level in this) |
| 46 |
{ |
| 47 |
result.Add(level.Value); |
| 48 |
} |
| 49 |
|
| 50 |
return result.ToArray(); |
| 51 |
} |
| 52 |
|
| 53 |
} |
| 54 |
} |