public Option(Parser.Item root) { name = new List <Tuple <LocalisationLink, Trigger> >(); command = new Command(); foreach (Parser.Item item in root.GetChilderen()) { switch (item.name) { case "name": if (item.IsValue()) { name.Add(new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(item.GetString()), null)); } else { name.Add(new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(item.GetString("text")), new Trigger(item.GetItem("trigger")))); } break; case "trigger": trigger = new Trigger(item); break; default: command.Add(item); break; } } }
public void Add(Parser.Item root) { if (iscomplex == false && simpleTitle == null && root.IsValue()) { simpleTitle = LocalisationLink.FromTag(root.GetString()); } else if (iscomplex == false && simpleTitle != null && root.IsValue()) { iscomplex = true; titles = new List <Tuple <LocalisationLink, Trigger> >() { new Tuple <LocalisationLink, Trigger>(simpleTitle, null), new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString()), null) }; } else if (iscomplex == false && simpleTitle == null && root.IsValue() == false) { iscomplex = true; titles = new List <Tuple <LocalisationLink, Trigger> >() { new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString("text")), new Trigger(root.GetItem("trigger"))) }; } else if (iscomplex == false && simpleTitle != null && root.IsValue() == false) { iscomplex = true; titles = new List <Tuple <LocalisationLink, Trigger> >() { new Tuple <LocalisationLink, Trigger>(simpleTitle, null), new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString("text")), new Trigger(root.GetItem("trigger"))) }; } else if (iscomplex && root.IsValue()) { titles.Add(new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString()), null)); } else { titles.Add(new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString("text")), new Trigger(root.GetItem("trigger")))); } }