예제 #1
0
        public void AddCodeSignOnCopy()
        {
            codeSignOnCopy      = true;
            removeHeadersOnCopy = true;

            PBXElementDict settings = null;

            if (m_Properties.Contains("settings"))
            {
                settings = m_Properties["settings"].AsDict();
            }
            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() == "CodeSignOnCopy")
                    {
                        exists = true;
                    }
                }
                if (!exists)
                {
                    attrs.AddString("CodeSignOnCopy");
                }
            }
            {
                bool exists = false;
                foreach (var value in attrs.values)
                {
                    if (value is PBXElementString && value.AsString() == "RemoveHeadersOnCopy")
                    {
                        exists = true;
                    }
                }
                if (!exists)
                {
                    attrs.AddString("RemoveHeadersOnCopy");
                }
            }
        }
예제 #2
0
        void UpdatePropsAttribute(PBXElementDict settings, bool v, string attributeName)
        {
            if (v)
            {
                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() == attributeName)
                    {
                        exists = true;
                        break;
                    }
                }
                if (!exists)
                {
                    attrs.AddString(attributeName);
                }
            }
            else
            {
                if (settings != null && settings.Contains("ATTRIBUTES"))
                {
                    var attrs = settings["ATTRIBUTES"].AsArray();
                    attrs.values.RemoveAll(el => (el is PBXElementString && el.AsString() == attributeName));
                    if (attrs.values.Count == 0)
                    {
                        settings.Remove("ATTRIBUTES");
                    }
                }
            }
        }