public PBXElementArray AddArray() { var v = new PBXElementArray(); values.Add(v); return(v); }
public PBXElementArray CreateArray(string key) { var v = new PBXElementArray(); values[key] = v; return(v); }
public static PBXElementArray ParseArrayAST(ArrayAST ast, TokenList tokens, string text) { var el = new PBXElementArray(); foreach (var v in ast.values) { el.values.Add(ParseValueAST(v, tokens, text)); } return(el); }
PBXElementDict UpdatePropsAttribute(PBXElementDict settings, bool value, string attributeName) { PBXElementArray attrs = null; if (value) { if (settings == null) { settings = m_Properties.CreateDict("settings"); } } if (settings != null && settings.Contains("ATTRIBUTES")) { attrs = settings["ATTRIBUTES"].AsArray(); } if (value) { if (attrs == null) { attrs = settings.CreateArray("ATTRIBUTES"); } bool exists = attrs.values.Any(attr => { return(attr is PBXElementString && attr.AsString() == attributeName); }); if (!exists) { attrs.AddString(attributeName); } } else { if (attrs != null) { attrs.values.RemoveAll(el => (el is PBXElementString && el.AsString() == attributeName)); if (attrs.values.Count == 0) { settings.Remove("ATTRIBUTES"); } } } return(settings); }
public static void WriteArray(StringBuilder sb, PBXElementArray el, int indent, bool compact, PropertyCommentChecker checker, GUIDToCommentMap comments) { sb.Append("("); foreach (var value in el.values) { if (!compact) { sb.Append("\n"); sb.Append(GetIndent(indent + 1)); } if (value is PBXElementString) { WriteStringImpl(sb, value.AsString(), checker.CheckStringValueInArray(value.AsString()), comments); } else if (value is PBXElementDict) { WriteDict(sb, value.AsDict(), indent + 1, compact, checker.NextLevel("*"), comments); } else if (value is PBXElementArray) { WriteArray(sb, value.AsArray(), indent + 1, compact, checker.NextLevel("*"), comments); } sb.Append(","); if (compact) { sb.Append(" "); } } if (!compact) { sb.Append("\n"); sb.Append(GetIndent(indent)); } sb.Append(")"); }