Exemplo n.º 1
0
        void AddArray(PListDictionary dic)
        {
            string settingName, displayName, group;

            ExtractCommon(dic, out settingName, out displayName, out group);
            bool inherited = dic.BoolValue(INHERIT_KEY);
            bool path      = dic.BoolValue(PATH_KEY);

            _settings[settingName] = new ArrayBuildSetting(settingName, displayName, group, path, inherited);
        }
Exemplo n.º 2
0
        void AddArrayBuildSetting(ArrayBuildSetting arraySetting, string[] values, MergeMethod mergeMethod)
        {
            var          settings = BuildSettings;
            PBXProjArray array    = null;

            //TODO check conditionals, as will have to run for each conditional variant

            //handle appending
            if (mergeMethod == MergeMethod.Append)
            {
                array = settings.Element <PBXProjArray>(arraySetting.BuildSettingName);

                //single entry may have been parsed as a string
                if (array == null)
                {
                    var str = settings.Element <PBXProjString>(arraySetting.BuildSettingName);

                    if (str != null)
                    {
                        array = new PBXProjArray();
                        array.Add(str.Value);
                        settings[arraySetting.BuildSettingName] = array;
                    }
                }
            }

            //handles null case and replace case
            if (array == null)
            {
                array = new PBXProjArray();
                settings[arraySetting.BuildSettingName] = array;
            }

            // handle settings that need inherit string being added
            if (arraySetting.AddInherited)
            {
                string inherited = INHERITED.EncloseInQuotes();

                if (array.Where(o => (o as PBXProjString).Value.Equals(inherited)).Count() <= 0)
                {
                    array.Add(inherited);
                }
            }

            foreach (var v in values)
            {
                string quoted;

                if (v.Contains(" ") && !v.StartsWith("\"", System.StringComparison.InvariantCultureIgnoreCase))
                {
                    quoted = "\"" + v + "\"";
                }
                else
                {
                    quoted = v;
                }

                quoted = quoted.ToLiteralIfRequired();

                //only add if not present
                if (array.Where(o => (o as PBXProjString).Value.Equals(quoted)).Count() <= 0)
                {
                    array.Add(quoted);
                }
            }
        }