public void visitAddSystemCapabilities(XCProjectSystemCapabilitiesType type, bool enabled)
        {
            if (weakProject == null)
            {
                Debug.Log("weakProject must not be null");
                return;
            }
            string destributeType = getEnumType(type);

            Debug.Log("Add System Capabilities " + destributeType);

            PBXDictionary _Attributes       = (PBXDictionary)weakProject.data ["attributes"];
            PBXDictionary _TargetAttributes = (PBXDictionary)_Attributes ["TargetAttributes"];
            PBXList       _targets          = (PBXList)weakProject.data ["targets"];
            PBXDictionary targetDict        = null;

            if (_TargetAttributes.ContainsKey((string)_targets [0]))
            {
                targetDict = (PBXDictionary)_TargetAttributes [(string)_targets [0]];
            }
            else
            {
                //不会发生
                //return;
                targetDict = new PBXDictionary();
            }
            //			Debug.Log ("targetDict:" + targetDict);

            PBXDictionary SystemCapabilities = null;

            if (targetDict != null && targetDict.ContainsKey("SystemCapabilities"))
            {
                //				Debug.Log ("xxxxxxxxxxxxxxxxxxx");
                SystemCapabilities = (PBXDictionary)targetDict ["SystemCapabilities"];
            }
            else
            {
                SystemCapabilities = new PBXDictionary();
            }

            Debug.Log("before SystemCapabilities:" + SystemCapabilities);
            if (SystemCapabilities != null && SystemCapabilities.ContainsKey(destributeType))
            {
                SystemCapabilities.Remove(destributeType);
            }
            Debug.Log("after SystemCapabilities:" + SystemCapabilities);
            PBXDictionary enableDict = new PBXDictionary();

            enableDict.Add("enabled", enabled?"1":"0");
            SystemCapabilities.Add(destributeType, enableDict);

            if (!targetDict.ContainsKey("SystemCapabilities"))
            {
                targetDict.Add("SystemCapabilities", SystemCapabilities);
            }
            if (!_TargetAttributes.ContainsKey((string)_targets [0]))
            {
                _TargetAttributes.Add((string)_targets [0], targetDict);
            }
        }
Ejemplo n.º 2
0
        public void AddSystemCapabilities(string capabilities, bool isEnabled)
        {
            string enabled;

            if (isEnabled)
            {
                enabled = "1";
            }
            else
            {
                enabled = "0";
            }

            Debug.Log("in AddSystemCapabilities");

            PBXDictionary _Attributes       = (PBXDictionary)_project.data ["attributes"];
            PBXDictionary _TargetAttributes = (PBXDictionary)_Attributes ["TargetAttributes"];
            PBXList       _targets          = (PBXList)_project.data ["targets"];
            PBXDictionary targetDict        = null;

            Debug.Log("_TargetAttributes:" + _TargetAttributes);

            if (_TargetAttributes.ContainsKey((string)_targets [0]))
            {
                targetDict = (PBXDictionary)_TargetAttributes [(string)_targets [0]];
            }
            else                //不会发生
                                //				Debug.Log ("AddSystemCapabilities error");
                                //				return;
            {
                targetDict = new PBXDictionary();
            }
            Debug.Log("targetDict:" + targetDict);

            PBXDictionary SystemCapabilities = null;

            if (targetDict != null && targetDict.ContainsKey("SystemCapabilities"))
            {
                Debug.Log("xxxxxxxxxxxxxxxxxxx");
                SystemCapabilities = (PBXDictionary)targetDict ["SystemCapabilities"];
            }
            else
            {
                SystemCapabilities = new PBXDictionary();
            }

            Debug.Log("before SystemCapabilities:" + SystemCapabilities);
            if (SystemCapabilities != null && SystemCapabilities.ContainsKey(capabilities))
            {
                SystemCapabilities.Remove(capabilities);
            }
            Debug.Log("after SystemCapabilities:" + SystemCapabilities);
            PBXDictionary enable = new PBXDictionary();

            enable.Add("enabled", enabled);

            SystemCapabilities.Add(capabilities, enable);
            Debug.Log("after SystemCapabilities:" + SystemCapabilities);


            if (!targetDict.ContainsKey("SystemCapabilities"))
            {
//				Debug.Log ("rrrrrrrrrrrrrrrrrrrrrr");
                targetDict.Add("SystemCapabilities", SystemCapabilities);
            }
            if (!_TargetAttributes.ContainsKey((string)_targets [0]))
            {
//				Debug.Log ("hhhhhhhhhhhhhhhhhhhhh");
                _TargetAttributes.Add((string)_targets [0], targetDict);
            }

            Debug.Log("after attributes:" + _TargetAttributes);
            Debug.Log("AddSystemCapabilities done");
        }