how about don't clear out the aliases? now I can configure more aliases
This commit is contained in:
parent
894b536c04
commit
451ace753d
@ -57,18 +57,21 @@ namespace vassago.Conversion
|
|||||||
if(currencyConf != null)
|
if(currencyConf != null)
|
||||||
{
|
{
|
||||||
knownConversions.RemoveAll(kc => kc.Item1 == currencyConf.Base);
|
knownConversions.RemoveAll(kc => kc.Item1 == currencyConf.Base);
|
||||||
knownAliases.Remove(knownAliases.FirstOrDefault(kvp => kvp.Value == currencyConf.Base).Key);
|
|
||||||
foreach (var rate in currencyConf.rates)
|
|
||||||
knownAliases.Remove(knownAliases.FirstOrDefault(kvp => kvp.Value == rate.Key).Key);
|
|
||||||
}
|
}
|
||||||
if (File.Exists(currencyPath))
|
if (File.Exists(currencyPath))
|
||||||
{
|
{
|
||||||
currencyConf = JsonConvert.DeserializeObject<ExchangePairs>(File.ReadAllText(currencyPath));
|
currencyConf = JsonConvert.DeserializeObject<ExchangePairs>(File.ReadAllText(currencyPath));
|
||||||
|
|
||||||
|
if(!knownAliases.ContainsValue(currencyConf.Base))
|
||||||
|
{
|
||||||
knownAliases.Add(new List<string>() { currencyConf.Base.ToLower() }, currencyConf.Base);
|
knownAliases.Add(new List<string>() { currencyConf.Base.ToLower() }, currencyConf.Base);
|
||||||
|
}
|
||||||
foreach (var rate in currencyConf.rates)
|
foreach (var rate in currencyConf.rates)
|
||||||
|
{
|
||||||
|
if(!knownAliases.ContainsValue(rate.Key))
|
||||||
{
|
{
|
||||||
knownAliases.Add(new List<string>() { rate.Key.ToLower() }, rate.Key);
|
knownAliases.Add(new List<string>() { rate.Key.ToLower() }, rate.Key);
|
||||||
|
}
|
||||||
AddLinearPair(currencyConf.Base, rate.Key, rate.Value);
|
AddLinearPair(currencyConf.Base, rate.Key, rate.Value);
|
||||||
Console.WriteLine($"{rate.Key.ToLower()} alias of {rate.Key}");
|
Console.WriteLine($"{rate.Key.ToLower()} alias of {rate.Key}");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user