Contains() public méthode

public Contains ( string key ) : bool
key string
Résultat bool
Exemple #1
0
        public override void UpdateVars()
        {
            projectReferences = new List <ProjectReference>();
            if (m_Properties.Contains("projectReferences"))
            {
                var el = m_Properties["projectReferences"].AsArray();
                foreach (var value in el.values)
                {
                    PBXElementDict dict = value.AsDict();
                    if (dict.Contains("ProductGroup") && dict.Contains("ProjectRef"))
                    {
                        string group      = dict["ProductGroup"].AsString();
                        string projectRef = dict["ProjectRef"].AsString();
                        projectReferences.Add(ProjectReference.Create(group, projectRef));
                    }
                }
            }
            targets         = GetPropertyList("targets");
            buildConfigList = GetPropertyString("buildConfigurationList");

            // update knownAssetTags
            knownAssetTags = new List <string>();
            if (m_Properties.Contains("attributes"))
            {
                var el = m_Properties["attributes"].AsDict();
                if (el.Contains("knownAssetTags"))
                {
                    var tags = el["knownAssetTags"].AsArray();
                    foreach (var tag in tags.values)
                    {
                        knownAssetTags.Add(tag.AsString());
                    }
                }
            }
        }
 public override void UpdateVars()
 {
     this.projectReferences = new List <ProjectReference>();
     if (base.m_Properties.Contains("projectReferences"))
     {
         PBXElementArray array = base.m_Properties["projectReferences"].AsArray();
         foreach (PBXElement element in array.values)
         {
             PBXElementDict dict = element.AsDict();
             if (dict.Contains("ProductGroup") && dict.Contains("ProjectRef"))
             {
                 string group      = dict["ProductGroup"].AsString();
                 string projectRef = dict["ProjectRef"].AsString();
                 this.projectReferences.Add(ProjectReference.Create(group, projectRef));
             }
         }
     }
     this.targets         = base.GetPropertyList("targets");
     this.buildConfigList = base.GetPropertyString("buildConfigurationList");
     this.knownAssetTags  = new List <string>();
     if (base.m_Properties.Contains("attributes"))
     {
         PBXElementDict dict2 = base.m_Properties["attributes"].AsDict();
         if (dict2.Contains("knownAssetTags"))
         {
             PBXElementArray array2 = dict2["knownAssetTags"].AsArray();
             foreach (PBXElement element2 in array2.values)
             {
                 this.knownAssetTags.Add(element2.AsString());
             }
         }
     }
 }
Exemple #3
0
        public override void UpdateVars()
        {
            projectReferences = new List <ProjectReference>();
            if (m_Properties.Contains("projectReferences"))
            {
                var el = m_Properties["projectReferences"].AsArray();
                foreach (var value in el.values)
                {
                    PBXElementDict dict = value.AsDict();
                    if (dict.Contains("ProductGroup") && dict.Contains("ProjectRef"))
                    {
                        string group      = dict["ProductGroup"].AsString();
                        string projectRef = dict["ProjectRef"].AsString();
                        projectReferences.Add(ProjectReference.Create(group, projectRef));
                    }
                }
            }
            targets         = GetPropertyList("targets");
            buildConfigList = GetPropertyString("buildConfigurationList");

            // update knownAssetTags
            knownAssetTags = new List <string>();
            if (m_Properties.Contains("attributes"))
            {
                var el = m_Properties["attributes"].AsDict();
                if (el.Contains("knownAssetTags"))
                {
                    var tags = el["knownAssetTags"].AsArray();
                    foreach (var tag in tags.values)
                    {
                        knownAssetTags.Add(tag.AsString());
                    }
                }

                capabilities = new List <PBXCapabilityType.TargetCapabilityPair>();
                teamIDs      = new Dictionary <string, string>();

                if (el.Contains("TargetAttributes"))
                {
                    var targetAttr = el["TargetAttributes"].AsDict();
                    foreach (var attr in targetAttr.values)
                    {
                        if (attr.Key == "DevelopmentTeam")
                        {
                            teamIDs.Add(attr.Key, attr.Value.AsString());
                        }

                        if (attr.Key == "SystemCapabilities")
                        {
                            var caps = el["SystemCapabilities"].AsDict();
                            foreach (var cap in caps.values)
                            {
                                capabilities.Add(new PBXCapabilityType.TargetCapabilityPair(attr.Key, PBXCapabilityType.StringToPBXCapabilityType(cap.Value.AsString())));
                            }
                        }
                    }
                }
            }
        }
Exemple #4
0
        public override void UpdateProps()
        {
            base.SetPropertyString("fileRef", this.fileRef);
            PBXElementDict dict = null;

            if (base.m_Properties.Contains("settings"))
            {
                dict = base.m_Properties["settings"].AsDict();
            }
            if ((this.compileFlags != null) && (this.compileFlags != ""))
            {
                if (dict == null)
                {
                    dict = base.m_Properties.CreateDict("settings");
                }
                dict.SetString("COMPILER_FLAGS", this.compileFlags);
            }
            else if (dict != null)
            {
                dict.Remove("COMPILER_FLAGS");
            }
            if (this.weak)
            {
                if (dict == null)
                {
                    dict = base.m_Properties.CreateDict("settings");
                }
                PBXElementArray array = null;
                if (dict.Contains("ATTRIBUTES"))
                {
                    array = dict["ATTRIBUTES"].AsArray();
                }
                else
                {
                    array = dict.CreateArray("ATTRIBUTES");
                }
                bool flag = false;
                foreach (PBXElement element in array.values)
                {
                    if ((element is PBXElementString) && (element.AsString() == "Weak"))
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    array.AddString("Weak");
                }
            }
            else if ((dict != null) && dict.Contains("ATTRIBUTES"))
            {
                PBXElementArray array2 = dict["ATTRIBUTES"].AsArray();
                if (< > f__am$cache0 == null)
                {
Exemple #5
0
        public override void UpdateVars()
        {
            this.projectReferences = new List <ProjectReference>();
            if (this.m_Properties.Contains("projectReferences"))
            {
                foreach (PBXElement pbxElement in this.m_Properties["projectReferences"].AsArray().values)
                {
                    PBXElementDict pbxElementDict = pbxElement.AsDict();
                    if (pbxElementDict.Contains("ProductGroup") && pbxElementDict.Contains("ProjectRef"))
                    {
                        this.projectReferences.Add(ProjectReference.Create(pbxElementDict["ProductGroup"].AsString(), pbxElementDict["ProjectRef"].AsString()));
                    }
                }
            }
            this.targets         = this.GetPropertyList("targets");
            this.buildConfigList = this.GetPropertyString("buildConfigurationList");
            this.knownAssetTags  = new List <string>();
            if (!this.m_Properties.Contains("attributes"))
            {
                return;
            }
            PBXElementDict pbxElementDict1 = this.m_Properties["attributes"].AsDict();

            if (pbxElementDict1.Contains("knownAssetTags"))
            {
                foreach (PBXElement pbxElement in pbxElementDict1["knownAssetTags"].AsArray().values)
                {
                    this.knownAssetTags.Add(pbxElement.AsString());
                }
            }
            this.capabilities = new List <PBXCapabilityType.TargetCapabilityPair>();
            this.teamIDs      = new Dictionary <string, string>();
            if (pbxElementDict1.Contains("TargetAttributes"))
            {
                foreach (KeyValuePair <string, PBXElement> keyValuePair1 in (IEnumerable <KeyValuePair <string, PBXElement> >)pbxElementDict1["TargetAttributes"].AsDict().values)
                {
                    if (keyValuePair1.Key == "DevelopmentTeam")
                    {
                        this.teamIDs.Add(keyValuePair1.Key, keyValuePair1.Value.AsString());
                    }
                    if (keyValuePair1.Key == "SystemCapabilities")
                    {
                        foreach (KeyValuePair <string, PBXElement> keyValuePair2 in (IEnumerable <KeyValuePair <string, PBXElement> >)pbxElementDict1["SystemCapabilities"].AsDict().values)
                        {
                            this.capabilities.Add(new PBXCapabilityType.TargetCapabilityPair(keyValuePair1.Key, PBXCapabilityType.StringToPBXCapabilityType(keyValuePair2.Value.AsString())));
                        }
                    }
                }
            }
        }
Exemple #6
0
        public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact,
                                     PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            sb.Append("{");

            if (el.Contains("isa"))
            {
                WriteDictKeyValue(sb, "isa", el["isa"], indent + 1, compact, checker, comments);
            }
            var keys = new List <string>(el.values.Keys);

            keys.Sort(StringComparer.Ordinal);
            foreach (var key in keys)
            {
                if (key != "isa")
                {
                    WriteDictKeyValue(sb, key, el[key], indent + 1, compact, checker, comments);
                }
            }
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(GetIndent(indent));
            }
            sb.Append("}");
        }
Exemple #7
0
        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 (pbxElement is PBXElementString && pbxElement.AsString() == "Public")
                    {
                        this.publicHeader = true;
                    }
                }
            }
            if (pbxElementDict.Contains("ASSET_TAGS"))
            {
                foreach (PBXElement pbxElement in pbxElementDict["ASSET_TAGS"].AsArray().values)
                {
                    this.assetTags.Add(pbxElement.AsString());
                }
            }
        }
Exemple #8
0
 public override void UpdateVars()
 {
     projectReferences = new List <ProjectReference>();
     if (m_Properties.Contains("projectReferences"))
     {
         var el = m_Properties["projectReferences"].AsArray();
         foreach (var value in el.values)
         {
             PBXElementDict dict = value.AsDict();
             if (dict.Contains("ProductGroup") && dict.Contains("ProjectRef"))
             {
                 string group      = dict["ProductGroup"].AsString();
                 string projectRef = dict["ProjectRef"].AsString();
                 projectReferences.Add(ProjectReference.Create(group, projectRef));
             }
         }
     }
     buildConfigList = GetPropertyString("buildConfigurationList");
 }
Exemple #9
0
        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 (!Enumerable.Any <PBXElement>((IEnumerable <PBXElement>)pbxElementArray.values, (Func <PBXElement, bool>)(attr => attr is PBXElementString && attr.AsString() == attributeName)))
                {
                    pbxElementArray.AddString(attributeName);
                }
            }
            else if (pbxElementArray != null)
            {
                pbxElementArray.values.RemoveAll((Predicate <PBXElement>)(el =>
                {
                    if (el is PBXElementString)
                    {
                        return(el.AsString() == attributeName);
                    }
                    return(false);
                }));
                if (pbxElementArray.values.Count == 0)
                {
                    settings.Remove("ATTRIBUTES");
                }
            }
            return(settings);
        }
Exemple #10
0
 public override void UpdateProps()
 {
     this.m_Properties.values.Remove("projectReferences");
     if (this.projectReferences.Count > 0)
     {
         PBXElementArray array = this.m_Properties.CreateArray("projectReferences");
         foreach (ProjectReference projectReference in this.projectReferences)
         {
             PBXElementDict pbxElementDict = array.AddDict();
             pbxElementDict.SetString("ProductGroup", projectReference.group);
             pbxElementDict.SetString("ProjectRef", projectReference.projectRef);
         }
     }
     this.SetPropertyList("targets", this.targets);
     this.SetPropertyString("buildConfigurationList", this.buildConfigList);
     if (this.knownAssetTags.Count > 0)
     {
         PBXElementArray array = (!this.m_Properties.Contains("attributes") ? this.m_Properties.CreateDict("attributes") : this.m_Properties["attributes"].AsDict()).CreateArray("knownAssetTags");
         foreach (string val in this.knownAssetTags)
         {
             array.AddString(val);
         }
     }
     foreach (PBXCapabilityType.TargetCapabilityPair targetCapabilityPair in this.capabilities)
     {
         PBXElementDict pbxElementDict1 = this.m_Properties.Contains("attributes") ? this.m_Properties["attributes"].AsDict() : this.m_Properties.CreateDict("attributes");
         PBXElementDict pbxElementDict2 = pbxElementDict1.Contains("TargetAttributes") ? pbxElementDict1["TargetAttributes"].AsDict() : pbxElementDict1.CreateDict("TargetAttributes");
         PBXElementDict pbxElementDict3 = pbxElementDict2.Contains(targetCapabilityPair.targetGuid) ? pbxElementDict2[targetCapabilityPair.targetGuid].AsDict() : pbxElementDict2.CreateDict(targetCapabilityPair.targetGuid);
         PBXElementDict pbxElementDict4 = pbxElementDict3.Contains("SystemCapabilities") ? pbxElementDict3["SystemCapabilities"].AsDict() : pbxElementDict3.CreateDict("SystemCapabilities");
         string         id = targetCapabilityPair.capability.id;
         (pbxElementDict4.Contains(id) ? pbxElementDict4[id].AsDict() : pbxElementDict4.CreateDict(id)).SetString("enabled", "1");
     }
     foreach (KeyValuePair <string, string> keyValuePair in this.teamIDs)
     {
         PBXElementDict pbxElementDict1 = this.m_Properties.Contains("attributes") ? this.m_Properties["attributes"].AsDict() : this.m_Properties.CreateDict("attributes");
         PBXElementDict pbxElementDict2 = pbxElementDict1.Contains("TargetAttributes") ? pbxElementDict1["TargetAttributes"].AsDict() : pbxElementDict1.CreateDict("TargetAttributes");
         (pbxElementDict2.Contains(keyValuePair.Key) ? pbxElementDict2[keyValuePair.Key].AsDict() : pbxElementDict2.CreateDict(keyValuePair.Key)).SetString("DevelopmentTeam", keyValuePair.Value);
     }
 }
Exemple #11
0
        public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact, PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            sb.Append("{");
            if (el.Contains("isa"))
            {
                Serializer.WriteDictKeyValue(sb, "isa", el["isa"], indent + 1, compact, checker, comments);
            }
            List <string> list = new List <string>((IEnumerable <string>)el.values.Keys);

            list.Sort((IComparer <string>)StringComparer.Ordinal);
            foreach (string key in list)
            {
                if (key != "isa")
                {
                    Serializer.WriteDictKeyValue(sb, key, el[key], indent + 1, compact, checker, comments);
                }
            }
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(Serializer.GetIndent(indent));
            }
            sb.Append("}");
        }
        public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact, 
                                     PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            sb.Append("{");

            if (el.Contains("isa"))
                WriteDictKeyValue(sb, "isa", el["isa"], indent+1, compact, checker, comments);
            var keys = new List<string>(el.values.Keys);
            keys.Sort(StringComparer.Ordinal);
            foreach (var key in keys)
            {
                if (key != "isa")
                    WriteDictKeyValue(sb, key, el[key], indent+1, compact, checker, comments);
            }
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(GetIndent(indent));
            }
            sb.Append("}");
        }
Exemple #13
0
        public override void UpdateProps()
        {
            SetPropertyString("fileRef", fileRef);

            PBXElementDict settings = null;

            if (m_Properties.Contains("settings"))
            {
                settings = m_Properties["settings"].AsDict();
            }

            if (compileFlags != null && compileFlags != "")
            {
                if (settings == null)
                {
                    settings = m_Properties.CreateDict("settings");
                }
                settings.SetString("COMPILER_FLAGS", compileFlags);
            }
            else
            {
                if (settings != null)
                {
                    settings.Remove("COMPILER_FLAGS");
                }
            }

            if (weak)
            {
                if (settings == null)
                {
                    settings = m_Properties.CreateDict("settings");
                }
                PBXElementArray attrs = null;
                if (settings.Contains("ATTRIBUTES"))
                {
                    attrs = settings["ATTRIBUTES"].AsArray();
                }
                else
                {
                    attrs = settings.CreateArray("ATTRIBUTES");
                }

                bool exists = false;
                foreach (var value in attrs.values)
                {
                    if (value is PBXElementString && value.AsString() == "Weak")
                    {
                        exists = true;
                    }
                }
                if (!exists)
                {
                    attrs.AddString("Weak");
                }
            }
            else
            {
                if (settings != null && settings.Contains("ATTRIBUTES"))
                {
                    var attrs = settings["ATTRIBUTES"].AsArray();
                    attrs.values.RemoveAll(el => (el is PBXElementString && el.AsString() == "Weak"));
                    if (attrs.values.Count == 0)
                    {
                        settings.Remove("ATTRIBUTES");
                    }
                }
            }

            if (assetTags.Count > 0)
            {
                if (settings == null)
                {
                    settings = m_Properties.CreateDict("settings");
                }
                var tagsArray = settings.CreateArray("ASSET_TAGS");
                foreach (string tag in assetTags)
                {
                    tagsArray.AddString(tag);
                }
            }
            else
            {
                if (settings != null)
                {
                    settings.Remove("ASSET_TAGS");
                }
            }

            if (settings != null && settings.values.Count == 0)
            {
                m_Properties.Remove("settings");
            }
        }
 public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact, PropertyCommentChecker checker, GUIDToCommentMap comments)
 {
     sb.Append("{");
     if (el.Contains("isa"))
     {
         WriteDictKeyValue(sb, "isa", el["isa"], indent + 1, compact, checker, comments);
     }
     List<string> list = new List<string>(el.values.Keys);
     list.Sort(StringComparer.Ordinal);
     foreach (string str in list)
     {
         if (str != "isa")
         {
             WriteDictKeyValue(sb, str, el[str], indent + 1, compact, checker, comments);
         }
     }
     if (!compact)
     {
         sb.Append("\n");
         sb.Append(GetIndent(indent));
     }
     sb.Append("}");
 }