//-----------------------------------------------------------------------------
        // Property Find Methods
        //-----------------------------------------------------------------------------

        // Return an enumerable lits of properties found with the given find settings.
        private IEnumerable <Property> GetProperties(PropertyFindSettings findSettings)
        {
            foreach (IPropertyObject propertyObject in GetPropertyObjects(findSettings.Scope))
            {
                foreach (Property property in propertyObject.Properties.GetProperties())
                {
                    if (property.Name == findSettings.PropertyName)
                    {
                        yield return(property);
                    }
                }
            }
        }
        // Find All.
        private void buttonFindAll_Click(object sender, EventArgs e)
        {
            // Create the find settings.
            PropertyFindSettings findSettings = new PropertyFindSettings()
            {
                PropertyName = textBoxFindName.Text,
                Scope        = (ObjectFindScope)comboBoxLookIn.SelectedIndex
            };

            Console.WriteLine("Finding properties with the name {0}:", findSettings.PropertyName);

            // Search through object's properties.
            int resultCount = 0;

            foreach (Property property in GetProperties(findSettings))
            {
                IPropertyObject propertyObject = property.Properties.PropertyObject;

                if (propertyObject is BaseTileData)
                {
                    Console.WriteLine(" - {0}", ((BaseTileData)propertyObject).Name);
                }
                else if (propertyObject is BaseTileDataInstance)
                {
                    Type type = ((BaseTileDataInstance)propertyObject).Type;

                    if (type != null)
                    {
                        Console.WriteLine(" - {0}", type.Name);
                    }
                    else
                    {
                        Console.WriteLine(" - Tile");
                    }
                }
                resultCount++;
            }

            Console.WriteLine("{0} results found", resultCount);
        }
        // Replace All.
        private void buttonReplaceAll_Click(object sender, EventArgs e)
        {
            // Create the find settings.
            PropertyFindSettings findSettings = new PropertyFindSettings()
            {
                PropertyName = textBoxFindName.Text,
                Scope        = (ObjectFindScope)comboBoxLookIn.SelectedIndex
            };
            string replaceName = textBoxReplaceName.Text;

            Console.WriteLine("Replacing properties with the name {0} to the name {1}:", findSettings.PropertyName, replaceName);

            // Search through object's properties.
            int resultCount = 0;

            foreach (Property property in GetProperties(findSettings))
            {
                IPropertyObject propertyObject = property.Properties.PropertyObject;
                property.Name = replaceName;
                resultCount++;
            }

            Console.WriteLine("{0} properties modified", resultCount);
        }
 //-----------------------------------------------------------------------------
 // Property Find Methods
 //-----------------------------------------------------------------------------
 // Return an enumerable lits of properties found with the given find settings.
 private IEnumerable<Property> GetProperties(PropertyFindSettings findSettings)
 {
     foreach (IPropertyObject propertyObject in GetPropertyObjects(findSettings.Scope)) {
         foreach (Property property in propertyObject.Properties.GetProperties()) {
             if (property.Name == findSettings.PropertyName)
                 yield return property;
         }
     }
 }
        // Replace All.
        private void buttonReplaceAll_Click(object sender, EventArgs e)
        {
            // Create the find settings.
            PropertyFindSettings findSettings = new PropertyFindSettings() {
                PropertyName = textBoxFindName.Text,
                Scope = (ObjectFindScope) comboBoxLookIn.SelectedIndex
            };
            string replaceName = textBoxReplaceName.Text;

            Console.WriteLine("Replacing properties with the name {0} to the name {1}:", findSettings.PropertyName, replaceName);

            // Search through object's properties.
            int resultCount = 0;
            foreach (Property property in GetProperties(findSettings)) {
                IPropertyObject propertyObject = property.Properties.PropertyObject;
                property.Name = replaceName;
                resultCount++;
            }

            Console.WriteLine("{0} properties modified", resultCount);
        }
        // Find All.
        private void buttonFindAll_Click(object sender, EventArgs e)
        {
            // Create the find settings.
            PropertyFindSettings findSettings = new PropertyFindSettings() {
                PropertyName = textBoxFindName.Text,
                Scope = (ObjectFindScope) comboBoxLookIn.SelectedIndex
            };

            Console.WriteLine("Finding properties with the name {0}:", findSettings.PropertyName);

            // Search through object's properties.
            int resultCount = 0;
            foreach (Property property in GetProperties(findSettings)) {
                IPropertyObject propertyObject = property.Properties.PropertyObject;

                if (propertyObject is BaseTileData) {
                    Console.WriteLine(" - {0}", ((BaseTileData) propertyObject).Name);
                }
                else if (propertyObject is BaseTileDataInstance) {
                    Type type = ((BaseTileDataInstance) propertyObject).Type;

                    if (type != null)
                        Console.WriteLine(" - {0}", type.Name);
                    else
                        Console.WriteLine(" - Tile");
                }
                resultCount++;
            }

            Console.WriteLine("{0} results found", resultCount);
        }