static Hashtable CleanArgs(Hashtable args)
{
Hashtable argsCopy = new Hashtable(args.Count);
Hashtable argsCaseUnified = new Hashtable(args.Count);
foreach (DictionaryEntry item in args) {
argsCopy.Add(item.Key, item.Value);
}
foreach (DictionaryEntry item in argsCopy) {
if(item.Value.GetType() == typeof(System.Int32)){
int original = (int)item.Value;
float casted = (float)original;
args[item.Key] = casted;
}
if(item.Value.GetType() == typeof(System.Double)){
double original = (double)item.Value;
float casted = (float)original;
args[item.Key] = casted;
}
}
//unify parameter case:
foreach (DictionaryEntry item in args) {
argsCaseUnified.Add(item.Key.ToString().ToLower(), item.Value);
}
//swap back case unification:
args = argsCaseUnified;
return args;
}