HasChild() public méthode

public HasChild ( string id ) : bool
id string
Résultat bool
        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
        }
Exemple #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
        }