Exemplo n.º 1
0
        public PBXGroup GetGroup(string name, string path = null, PBXGroup parent = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            if (parent == null)
            {
                parent = rootGroup;
            }

            foreach (KeyValuePair <string, PBXGroup> current in groups)
            {
                if (string.IsNullOrEmpty(current.Value.name))
                {
                    if (current.Value.path.CompareTo(name) == 0 && parent.HasChild(current.Key))
                    {
                        return(current.Value);
                    }
                }
                else if (current.Value.name.CompareTo(name) == 0 && parent.HasChild(current.Key))
                {
                    return(current.Value);
                }
            }

            PBXGroup result = new PBXGroup(name, path);

            groups.Add(result);
            parent.AddChild(result);

            modified = true;
            return(result);
        }
Exemplo n.º 2
0
        public PBXGroup GetGroup(string name, string path = null, PBXGroup parent = null)
        {
//			Debug.Log( "GetGroup: " + name + ", " + path + ", " + parent );
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            if (parent == null)
            {
                parent = rootGroup;
            }

            foreach (KeyValuePair <string, PBXGroup> current in groups)
            {
//				Debug.Log( "current: " + current.Value.guid + ", " + current.Value.name + ", " + current.Value.path + " - " + parent.HasChild( current.Key ) );
                if (string.IsNullOrEmpty(current.Value.name))
                {
                    if (current.Value.path.CompareTo(name) == 0 && parent.HasChild(current.Key))
                    {
                        return(current.Value);
                    }
                }
                else if (current.Value.name.CompareTo(name) == 0 && parent.HasChild(current.Key))
                {
                    return(current.Value);
                }
            }

            PBXGroup result = new PBXGroup(name, path);

            groups.Add(result);
            parent.AddChild(result);

            modified = true;
            return(result);

//		def get_or_create_group(self, name, path=None, parent=None):
//        if not name:
//            return None
//
//        if not parent:
//            parent = self.root_group
//        elif not isinstance(parent, PBXGroup):
//            # assume it's an id
//            parent = self.objects.get(parent, self.root_group)
//
//        groups = self.get_groups_by_name(name)
//
//        for grp in groups:
//            if parent.has_child(grp.id):
//                return grp
//
//        grp = PBXGroup.Create(name, path)
//        parent.add_child(grp)
//
//        self.objects[grp.id] = grp
//
//        self.modified = True
//
//        return grp
        }
Exemplo n.º 3
0
        public PBXGroup GetGroup( string name, string path = null, PBXGroup parent = null )
        {
            if( string.IsNullOrEmpty( name ) )
                return null;

            if( parent == null ) parent = rootGroup;

            foreach( KeyValuePair<string, PBXGroup> current in groups ) {
                if( string.IsNullOrEmpty( current.Value.name ) ) {
                    if( current.Value.path.CompareTo( name ) == 0 && parent.HasChild( current.Key ) ) {
                        return current.Value;
                    }
                } else if( current.Value.name.CompareTo( name ) == 0 && parent.HasChild( current.Key ) ) {
                    return current.Value;
                }
            }

            PBXGroup result = new PBXGroup( name, path );
            groups.Add( result );
            parent.AddChild( result );

            modified = true;
            return result;
        }
Exemplo n.º 4
0
        public PBXGroup GetGroup( string name, string path = null, PBXGroup parent = null )
        {
            //			Debug.Log( "GetGroup: " + name + ", " + path + ", " + parent );
            if( string.IsNullOrEmpty( name ) )
                return null;

            if( parent == null )
                parent = rootGroup;

            foreach( KeyValuePair<string, PBXGroup> current in groups ) {

            //				Debug.Log( "current: " + current.Value.guid + ", " + current.Value.name + ", " + current.Value.path + " - " + parent.HasChild( current.Key ) );
                if( string.IsNullOrEmpty( current.Value.name ) ) {
                    if( current.Value.path.CompareTo( name ) == 0 && parent.HasChild( current.Key ) ) {
                        return current.Value;
                    }
                }
                else if( current.Value.name.CompareTo( name ) == 0 && parent.HasChild( current.Key ) ) {
                    return current.Value;
                }
            }

            PBXGroup result = new PBXGroup( name, path );
            groups.Add( result );
            parent.AddChild( result );

            modified = true;
            return result;

            //		def get_or_create_group(self, name, path=None, parent=None):
            //        if not name:
            //            return None
            //
            //        if not parent:
            //            parent = self.root_group
            //        elif not isinstance(parent, PBXGroup):
            //            # assume it's an id
            //            parent = self.objects.get(parent, self.root_group)
            //
            //        groups = self.get_groups_by_name(name)
            //
            //        for grp in groups:
            //            if parent.has_child(grp.id):
            //                return grp
            //
            //        grp = PBXGroup.Create(name, path)
            //        parent.add_child(grp)
            //
            //        self.objects[grp.id] = grp
            //
            //        self.modified = True
            //
            //        return grp
        }