Exemple #1
0
        protected T PopulateObject <T>(string id, Dictionary <string, PBXBaseObject> allObjects) where T : PBXBaseObject
        {
            if (string.IsNullOrEmpty(id))
            {
                return(null);
            }

            PBXBaseObject obj = null;

            if (allObjects.TryGetValue(id, out obj))
            {
                if (obj is T)
                {
                    return(obj as T);
                }
                else
                {
                    Debug.LogWarning("EgoXproject: The project.pbxproj file has possibly been corrupted by another plugin. " + id + " should be a " + typeof(T) + " but is a " + obj.GetType());
                    throw new System.Exception("Referenced object is unexpected type: " + obj.GetType());
                }
            }
            else
            {
                Debug.LogWarning("EgoXproject: The project.pbxproj file has possibly been corrupted by another plugin. The referenced id cannot be found: " + id + ".");
                return(null);
            }
        }
Exemple #2
0
        public static PBXBuildFile Create(string uid, PBXBaseObject fileRef)    //should be a file ref, or a variant group or a version group
        {
            if (fileRef == null)
            {
                throw new System.ArgumentNullException((fileRef).ToString(), "fileRef cannot be null");
            }

            return(CreateCommon(uid, fileRef.UID));
        }
Exemple #3
0
        public void RemoveChild(PBXBaseObject child)
        {
            if (child == null)
            {
                return;
            }

            RemoveChild(child.UID);
        }
Exemple #4
0
        public void AddChild(PBXBaseObject obj)
        {
            if (obj == null)
            {
                return;
            }

            if (ChildrenIDs.Contains(obj.UID))
            {
                return;
            }

            _children.Add(obj);
            ChildrenUIDs.Add(obj.UID);
        }
Exemple #5
0
        public PBXGroup GroupContainingObject(PBXBaseObject obj)
        {
            if (_children.Contains(obj))
            {
                return(this);
            }

            foreach (var g in ChildGroups)
            {
                var containing = g.GroupContainingObject(obj);

                if (containing != null)
                {
                    return(containing);
                }
            }

            return(null);
        }