public static PBXElementDict ParseTreeAST(TreeAST ast, TokenList tokens, string text) { var el = new PBXElementDict(); foreach (var kv in ast.values) { PBXElementString key = ParseIdentifierAST(kv.key, tokens, text); PBXElement value = ParseValueAST(kv.value, tokens, text); el[key.value] = value; } return(el); }
public override void UpdateProps() { this.SetPropertyString("fileRef", this.fileRef); PBXElementDict settings = (PBXElementDict)null; if (this.m_Properties.Contains("settings")) { settings = this.m_Properties["settings"].AsDict(); } if (this.compileFlags != null && this.compileFlags != "") { if (settings == null) { settings = this.m_Properties.CreateDict("settings"); } settings.SetString("COMPILER_FLAGS", this.compileFlags); } else { if (settings != null) { settings.Remove("COMPILER_FLAGS"); } } PBXElementDict pbxElementDict = this.UpdatePropsAttribute(this.UpdatePropsAttribute(this.UpdatePropsAttribute(settings, this.weak, "Weak"), this.codeSignOnCopy, "CodeSignOnCopy"), this.removeHeadersOnCopy, "RemoveHeadersOnCopy"); if (this.assetTags.Count > 0) { if (pbxElementDict == null) { pbxElementDict = this.m_Properties.CreateDict("settings"); } PBXElementArray array = pbxElementDict.CreateArray("ASSET_TAGS"); foreach (string assetTag in this.assetTags) { array.AddString(assetTag); } } else { if (pbxElementDict != null) { pbxElementDict.Remove("ASSET_TAGS"); } } if (pbxElementDict == null || pbxElementDict.values.Count != 0) { return; } this.m_Properties.Remove("settings"); }
public override void UpdateVars() { this.fileRef = this.GetPropertyString("fileRef"); this.compileFlags = (string)null; this.weak = false; this.assetTags = new List <string>(); if (!this.m_Properties.Contains("settings")) { return; } PBXElementDict pbxElementDict = this.m_Properties["settings"].AsDict(); if (pbxElementDict.Contains("COMPILER_FLAGS")) { this.compileFlags = pbxElementDict["COMPILER_FLAGS"].AsString(); } if (pbxElementDict.Contains("ATTRIBUTES")) { foreach (PBXElement pbxElement in pbxElementDict["ATTRIBUTES"].AsArray().values) { if (pbxElement is PBXElementString && pbxElement.AsString() == "Weak") { this.weak = true; } if (pbxElement is PBXElementString && pbxElement.AsString() == "CodeSignOnCopy") { this.codeSignOnCopy = true; } if (pbxElement is PBXElementString && pbxElement.AsString() == "RemoveHeadersOnCopy") { this.removeHeadersOnCopy = true; } } } if (pbxElementDict.Contains("ASSET_TAGS")) { foreach (PBXElement pbxElement in pbxElementDict["ASSET_TAGS"].AsArray().values) { this.assetTags.Add(pbxElement.AsString()); } } }
private PBXElementDict UpdatePropsAttribute( PBXElementDict settings, bool value, string attributeName) { PBXElementArray pbxElementArray = (PBXElementArray)null; if (value && settings == null) { settings = this.m_Properties.CreateDict("settings"); } if (settings != null && settings.Contains("ATTRIBUTES")) { pbxElementArray = settings["ATTRIBUTES"].AsArray(); } if (value) { if (pbxElementArray == null) { pbxElementArray = settings.CreateArray("ATTRIBUTES"); } if (!pbxElementArray.values.Any <PBXElement>((Func <PBXElement, bool>)(attr => attr is PBXElementString && attr.AsString() == attributeName))) { pbxElementArray.AddString(attributeName); } } else if (pbxElementArray != null) { pbxElementArray.values.RemoveAll((Predicate <PBXElement>)(el => el is PBXElementString && el.AsString() == attributeName)); if (pbxElementArray.values.Count == 0) { settings.Remove("ATTRIBUTES"); } } return(settings); }
internal void SetPropertiesWhenSerializing(PBXElementDict props) { m_Properties = props; }
public abstract void AddObject(string key, PBXElementDict value);