mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Fixed the EXISTS condition when using dictionaries.
This commit is contained in:
@@ -221,12 +221,12 @@ namespace RuriLib
|
||||
if (args.Contains("(") && args.Contains(")"))
|
||||
{
|
||||
var dicKey = ParseArguments(args, '(', ')')[0];
|
||||
output = output.Replace(full, v.GetDictValue(dicKey));
|
||||
try { output = output.Replace(full, v.GetDictValue(dicKey)); } catch { }
|
||||
}
|
||||
else if (args.Contains("{") && args.Contains("}"))
|
||||
{
|
||||
var dicVal = ParseArguments(args, '{', '}')[0];
|
||||
output = output.Replace(full, v.GetDictKey(dicVal));
|
||||
try { output = output.Replace(full, v.GetDictKey(dicVal)); } catch { }
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace RuriLib.Models
|
||||
@@ -153,7 +154,7 @@ namespace RuriLib.Models
|
||||
{
|
||||
var dict = Value as Dictionary<string, string>;
|
||||
if (dict.ContainsKey(key)) return dict.First(d => d.Key == key).Value;
|
||||
else return dict.FirstOrDefault(d => d.Key.Contains(key)).Value;
|
||||
else throw new Exception("Key not in dictionary");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -165,7 +166,7 @@ namespace RuriLib.Models
|
||||
{
|
||||
var dict = Value as Dictionary<string, string>;
|
||||
if (dict.ContainsValue(value)) return dict.First(d => d.Value == value).Key;
|
||||
else return dict.FirstOrDefault(d => d.Value.Contains(value)).Key;
|
||||
else throw new Exception("Value not in dictionary");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user