private static string GetData(params string[] name) { ConfigLevel <string, string> tmp = mConfig; bool found = true; for (int i = 0; i < name.Length - 1; ++i) { if (name[i] == "") { break; } if (tmp.ContainsLevel(name[i])) { tmp = tmp.GetLevel(name[i]); } else { found = false; break; } } if (found) { return(tmp.Get(name[name.Length - 1])); } else { return(""); } }
public static Color GetColor(params string[] name) { Color def = Color.White; ConfigLevel <string, string> tmp = mConfig; bool found = true; for (int i = 0; i < name.Length - 1; ++i) { if (name[i] == "") { break; } if (tmp.ContainsLevel(name[i])) { tmp = tmp.GetLevel(name[i]); } else { found = false; break; } } if (found) { if (tmp.ContainsKey(name[name.Length - 1])) { Color output; string[] parts = tmp.Get(name[name.Length - 1]).Split(space); if (parts.Length == 3) { if (Util.TryParseColor(parts[0], parts[1], parts[2], "255", out output)) { return(output); } else if (parts.Length >= 4) { if (Util.TryParseColor(parts[0], parts[1], parts[2], parts[3], out output)) { return(output); } } } } } return(def); }
public static Vector4 GetVector4(params string[] name) { Vector4 def = Vector4.Zero; ConfigLevel <string, string> tmp = mConfig; bool found = true; for (int i = 0; i < name.Length - 1; ++i) { if (name[i] == "") { break; } if (tmp.ContainsLevel(name[i])) { tmp = tmp.GetLevel(name[i]); } else { found = false; break; } } if (found) { if (tmp.ContainsKey(name[name.Length - 1])) { Vector4 output; string[] parts = tmp.Get(name[name.Length - 1]).Split(space); if (parts.Length >= 4) { if (Util.TryParseVector4(parts[0], parts[1], parts[2], parts[3], out output)) { return(output); } } } } return(def); }
public static float GetFloat(params string[] name) { float def = 0.0f; ConfigLevel <string, string> tmp = mConfig; bool found = true; for (int i = 0; i < name.Length - 1; ++i) { if (name[i] == "") { break; } if (tmp.ContainsLevel(name[i])) { tmp = tmp.GetLevel(name[i]); } else { found = false; break; } } if (found) { if (tmp.ContainsKey(name[name.Length - 1])) { float output; string str = tmp.Get(name[name.Length - 1]); if (Util.TryParseFloat(str, out output)) { return(output); } } } return(def); }