private void ReadLayerToken(string ln) { string s = ln.Substring(6, ln.Length - 6); string[] split = s.Split('='); if (split.Length == 2) { try { string[] key = split[0].Split(':'); Color c; if (key[1].Contains(',')) { //It's a manually defined color string[] cs = key[1].Split(','); int r = int.Parse(cs[0]); int g = int.Parse(cs[1]); int b = int.Parse(cs[2]); c = Color.FromArgb(255, r, g, b); } else { c = CommonSplatmapColors.NameToColor(key[1]); } SplatmapMapping mapping = new SplatmapMapping(key[0], c, int.Parse(split[1])); layers.Add(mapping, "red_wool"); } catch { Program.WriteError("Syntax error in splat layer description: " + s); } } else { Program.WriteError("Syntax error in splat layer description: " + s); } }
Color ParseColor(string input) { Color c; if (input.Contains(",")) { //It's a manually defined color string[] cs = input.Split(','); int r = int.Parse(cs[0]); int g = int.Parse(cs[1]); int b = int.Parse(cs[2]); c = Color.FromArgb(255, r, g, b); } else { c = CommonSplatmapColors.NameToColor(input); } return(c); }
public SplatmapMapping(string map, string cName, int b) { mapName = map; color = CommonSplatmapColors.NameToColor(cName); value = b; }