summaryrefslogtreecommitdiff
path: root/NW4RTools/Util/OrderedDictionary.cs
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-02-18 03:28:31 +0100
committerTreeki <treeki@gmail.com>2011-02-18 03:28:31 +0100
commitb0760b28807b31cc1403584265c07feb87ac4887 (patch)
treedc97346a0c0d0cdcdc066d77df3905a614a858e8 /NW4RTools/Util/OrderedDictionary.cs
parent7d7491feb41bc9724bf63bef545b996226406889 (diff)
downloadnw4rtools-b0760b28807b31cc1403584265c07feb87ac4887.tar.gz
nw4rtools-b0760b28807b31cc1403584265c07feb87ac4887.zip
some collada work, and an unfinished OGL renderer using OpenTK. huge commit
Diffstat (limited to 'NW4RTools/Util/OrderedDictionary.cs')
-rw-r--r--NW4RTools/Util/OrderedDictionary.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/NW4RTools/Util/OrderedDictionary.cs b/NW4RTools/Util/OrderedDictionary.cs
index 98e523a..0463d33 100644
--- a/NW4RTools/Util/OrderedDictionary.cs
+++ b/NW4RTools/Util/OrderedDictionary.cs
@@ -171,6 +171,24 @@ namespace NW4RTools.Util
return List[index].Key;
}
+ public TKey GetKeyForValue(TValue value) {
+ foreach (var kv in List) {
+ if (kv.Value.Equals(value))
+ return kv.Key;
+ }
+ throw new KeyNotFoundException();
+ }
+
+ public int GetIndexForValue(TValue value) {
+ int i = 0;
+ foreach (var kv in List) {
+ if (kv.Value.Equals(value))
+ return i;
+ i += 1;
+ }
+ throw new KeyNotFoundException();
+ }
+
/// <summary>
/// Inserts a new entry into the <see cref="OrderedDictionary{TKey,TValue}">OrderedDictionary&lt;TKey,TValue&gt;</see> collection with the specified key and value at the specified index.
/// </summary>