コード例 #1
0
        private static void Replace(PListDict dict, String key, String value)
        {
            if (value == null)
            {
                if (dict.ContainsKey(key))
                {
                    dict.Remove(key);
                }
                return;
            }

            if (!dict.ContainsKey(key))
            {
                dict[key] = new PListString(value);
                return;
            }

            PListString pListString = dict[key] as PListString;

            if (pListString == null)
            {
                dict[key] = new PListString(value);
                return;
            }

            String currentValue = pListString.Value;

            if (currentValue.StartsWith("${") && currentValue.EndsWith("}"))
            {
                dict[key] = new PListString(value);
                return;
            }
        }
コード例 #2
0
        private static void Replace(PListDict dict, String key, String value)
        {
            if (value == null)
            {
                if (dict.ContainsKey(key))
                {
                    dict.Remove(key);
                }
                return;
            }

            if (!dict.ContainsKey(key))
            {
                dict[key] = new PListString(value);
                return;
            }

            PListString pListString = dict[key] as PListString;
            if (pListString == null)
            {
                dict[key] = new PListString(value);
                return;
            }

            String currentValue = pListString.Value;
            if (currentValue.StartsWith("${") && currentValue.EndsWith("}"))
            {
                dict[key] = new PListString(value);
                return;
            }
        }