SkiaGum/Managers/ObjectFinder.cs
/// <summary>
/// Returns a list of Elements that include InstanceSaves that use the argument
/// elementSave as their BaseType, or that use an ElementSave deriving from elementSave
/// as their BaseType.
/// </summary>
/// <param name="elementSave">The ElementSave to search for.</param>
/// <returns>A List containing all Elements</returns>
Returns a list of Elements that include InstanceSaves that use the argument
elementSave as their BaseType, or that use an ElementSave deriving from elementSave
as their BaseType.
Returns a list of Elements that include InstanceSaves that use the argument elementSave as their BaseType or that use an ElementSave deriving from elementSave as their BaseType .
public List<ElementSave> GetElementsReferencing(ElementSave elementSave, List<ElementSave> list = null, List<InstanceSave> foundInstances = null)
        {
            if (list == null)
            {
                list = new List<ElementSave>();
            }
            foreach (ElementSave screen in this.GumProjectSave.Screens)
            {
                foreach (InstanceSave instanceSave in screen.Instances)
                {
                    ElementSave elementForInstance = this.GetElementSave(instanceSave.BaseType);
                    if (elementForInstance != null && elementForInstance.IsOfType(elementSave.Name))
                    {
                        list.Add(screen);
                        if (foundInstances != null)
                        {
                            foundInstances.Add(instanceSave);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            foreach (ComponentSave component in this.GumProjectSave.Components)
            {
                foreach (InstanceSave instanceSave in component.Instances)
                {
                    ElementSave elementForInstance = this.GetElementSave(instanceSave.BaseType);
                    if (elementForInstance != null && elementForInstance.IsOfType(elementSave.Name))
                    {
                        list.Add(component);
                        if (foundInstances != null)
                        {
                            foundInstances.Add(instanceSave);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            return list;
        }
public List < ElementSave > GetElementsReferencing ( ElementSave elementSave , List < ElementSave > list = null , List < InstanceSave > foundInstances = null ) { if ( list == null ) { list = new List < ElementSave > ( ) ; } foreach ( ElementSave screen in this . GumProjectSave . Screens ) { foreach ( InstanceSave instanceSave in screen . Instances ) { ElementSave elementForInstance = this . GetElementSave ( instanceSave . BaseType ) ; if ( elementForInstance != null && elementForInstance . IsOfType ( elementSave . Name ) ) { list . Add ( screen ) ; if ( foundInstances != null ) { foundInstances . Add ( instanceSave ) ; } else { break ; } } } } foreach ( ComponentSave component in this . GumProjectSave . Components ) { foreach ( InstanceSave instanceSave in component . Instances ) { ElementSave elementForInstance = this . GetElementSave ( instanceSave . BaseType ) ; if ( elementForInstance != null && elementForInstance . IsOfType ( elementSave . Name ) ) { list . Add ( component ) ; if ( foundInstances != null ) { foundInstances . Add ( instanceSave ) ; } else { break ; } } } } return list ; }
Returns a list of Elements that include InstanceSaves that use the argument
elementSave as their BaseType, or that use an ElementSave deriving from elementSave
as their BaseType.
Returns a list of Elements that include InstanceSaves that use the argument elementSave as their BaseType or that use an ElementSave deriving from elementSave as their BaseType .
// If we want a list of instances // then we don't want to break on a // found instance - we want to continue // to find all of them. // If we want a list of instances // then we don't want to break on a // found instance - we want to continue // to find all of them.
A List containing all Elements
A List containing all Elements
elementSave
ElementSave
The ElementSave to search for.
The ElementSave to search for .
list
List<ElementSave>
foundInstances
List<InstanceSave>