Axiom.ParticleSystems.ParticleEmitter.RegisterCommands C# (CSharp) Method

RegisterCommands() protected method

Registers all attribute names with their respective parser.
Methods meant to serve as attribute parsers should use a method attribute to
protected RegisterCommands ( ) : void
return void
		protected void RegisterCommands()
		{
			Type baseType = GetType();

			do
			{
				Type[] types = baseType.GetNestedTypes( BindingFlags.NonPublic | BindingFlags.Public );

				// loop through all methods and look for ones marked with attributes
				for ( int i = 0; i < types.Length; i++ )
				{
					// get the current method in the loop
					Type type = types[ i ];

					// get as many command attributes as there are on this type
					ScriptablePropertyAttribute[] commandAtts =
						(ScriptablePropertyAttribute[])type.GetCustomAttributes( typeof( ScriptablePropertyAttribute ), true );

					// loop through each one we found and register its command
					for ( int j = 0; j < commandAtts.Length; j++ )
					{
						ScriptablePropertyAttribute commandAtt = commandAtts[ j ];

						commandTable.Add( commandAtt.ScriptPropertyName, (IPropertyCommand)Activator.CreateInstance( type ) );
					} // for
				} // for

				// get the base type of the current type
				baseType = baseType.BaseType;
			}
			while ( baseType != typeof( object ) );
		}