Save class for the EmissionSettings class. This class is used in the .emix (Emitter XML) file.
        public static EmissionSettingsSave FromEmissionSettings(EmissionSettings emissionSettings)
        {
            EmissionSettingsSave emissionSettingsSave = new EmissionSettingsSave();

            emissionSettingsSave.mVelocityRangeType   = emissionSettings.VelocityRangeType;
            emissionSettingsSave.mRadialVelocity      = emissionSettings.RadialVelocity;
            emissionSettingsSave.mRadialVelocityRange = emissionSettings.RadialVelocityRange;

            emissionSettingsSave.mXVelocity = emissionSettings.XVelocity;
            emissionSettingsSave.mYVelocity = emissionSettings.YVelocity;
            emissionSettingsSave.mZVelocity = emissionSettings.ZVelocity;

            emissionSettingsSave.mXVelocityRange = emissionSettings.XVelocityRange;
            emissionSettingsSave.mYVelocityRange = emissionSettings.YVelocityRange;
            emissionSettingsSave.mZVelocityRange = emissionSettings.ZVelocityRange;

            emissionSettingsSave.mWedgeAngle  = emissionSettings.WedgeAngle;
            emissionSettingsSave.mWedgeSpread = emissionSettings.WedgeSpread;

            emissionSettingsSave.Billboarded = emissionSettings.Billboarded;

            emissionSettingsSave.mRotationX              = emissionSettings.RotationX;
            emissionSettingsSave.mRotationXVelocity      = emissionSettings.RotationXVelocity;
            emissionSettingsSave.mRotationXRange         = emissionSettings.RotationXRange;
            emissionSettingsSave.mRotationXVelocityRange = emissionSettings.RotationXVelocityRange;

            emissionSettingsSave.mRotationY              = emissionSettings.RotationY;
            emissionSettingsSave.mRotationYVelocity      = emissionSettings.RotationYVelocity;
            emissionSettingsSave.mRotationYRange         = emissionSettings.RotationYRange;
            emissionSettingsSave.mRotationYVelocityRange = emissionSettings.RotationYVelocityRange;


            emissionSettingsSave.mRotationZ              = emissionSettings.RotationZ;
            emissionSettingsSave.mRotationZVelocity      = emissionSettings.RotationZVelocity;
            emissionSettingsSave.mRotationZRange         = emissionSettings.RotationZRange;
            emissionSettingsSave.mRotationZVelocityRange = emissionSettings.RotationZVelocityRange;

            emissionSettingsSave.mXAcceleration = emissionSettings.XAcceleration;
            emissionSettingsSave.mYAcceleration = emissionSettings.YAcceleration;
            emissionSettingsSave.mZAcceleration = emissionSettings.ZAcceleration;

            emissionSettingsSave.mXAccelerationRange = emissionSettings.XAccelerationRange;
            emissionSettingsSave.mYAccelerationRange = emissionSettings.YAccelerationRange;
            emissionSettingsSave.mZAccelerationRange = emissionSettings.ZAccelerationRange;

            emissionSettingsSave.mScaleX      = emissionSettings.ScaleX;
            emissionSettingsSave.mScaleY      = emissionSettings.ScaleY;
            emissionSettingsSave.mScaleXRange = emissionSettings.ScaleXRange;
            emissionSettingsSave.mScaleYRange = emissionSettings.ScaleYRange;

            emissionSettingsSave.mMatchScaleXToY = emissionSettings.MatchScaleXToY;

            emissionSettingsSave.mScaleXVelocity = emissionSettings.ScaleXVelocity;
            emissionSettingsSave.mScaleYVelocity = emissionSettings.ScaleYVelocity;

            emissionSettingsSave.mScaleXVelocityRange = emissionSettings.ScaleXVelocityRange;
            emissionSettingsSave.mScaleYVelocityRange = emissionSettings.ScaleYVelocityRange;

            if (emissionSettings.TextureScale > 0)
            {
                emissionSettingsSave.TextureScale = emissionSettings.TextureScale;
            }
            else
            {
                emissionSettingsSave.TextureScale = -1;
            }

            int multiple = 255;

            emissionSettingsSave.mFade      = (1 - emissionSettings.Alpha) * 255;
            emissionSettingsSave.mTintRed   = emissionSettings.Red * 255;
            emissionSettingsSave.mTintGreen = emissionSettings.Green * 255;
            emissionSettingsSave.mTintBlue  = emissionSettings.Blue * 255;

            emissionSettingsSave.mFadeRate      = -emissionSettings.AlphaRate * 255;
            emissionSettingsSave.mTintRedRate   = emissionSettings.RedRate * 255;
            emissionSettingsSave.mTintGreenRate = emissionSettings.GreenRate * 255;
            emissionSettingsSave.mTintBlueRate  = emissionSettings.BlueRate * 255;

            emissionSettingsSave.mBlendOperation =
                GraphicalEnumerations.BlendOperationToFlatRedBallMdxString(emissionSettings.BlendOperation);

            emissionSettingsSave.mColorOperation = GraphicalEnumerations.ColorOperationToFlatRedBallMdxString(
                emissionSettings.ColorOperation);

            // preserve animation  and texture settings
            emissionSettingsSave.mAnimate = emissionSettings.Animate;

            // TODO: Justin - not sure if we need to force relative here?
            emissionSettingsSave.AnimationChains  = emissionSettings.AnimationChains.Name;
            emissionSettingsSave.CurrentChainName = emissionSettings.CurrentChainName;

            // TODO: Justin - not sure if we neet to force relative here?
            emissionSettingsSave.Texture = emissionSettings.Texture.Name;

            emissionSettingsSave.Instructions = InstructionBlueprintListSave.FromInstructionBlueprintList(emissionSettings.Instructions);
            foreach (InstructionSave blueprint in emissionSettingsSave.Instructions.Instructions)
            {
                if (GraphicalEnumerations.ConvertableSpriteProperties.Contains(blueprint.Member))
                {
                    blueprint.Value = (float)blueprint.Value * multiple;
                }
            }
            emissionSettingsSave.mDrag = emissionSettings.Drag;

            return(emissionSettingsSave);
        }
        private void UpdateIncludeAndExclude(EmissionSettingsSave emissionSettings)
        {
            ResetToDefault();

            ExcludeMember("Instructions");

            if (emissionSettings != null)
            {

                var rangeType = emissionSettings.VelocityRangeType;
                if (rangeType != RangeType.Component)
                {
                    ExcludeMember("XVelocity");
                    ExcludeMember("YVelocity");
                    ExcludeMember("ZVelocity");
                    ExcludeMember("XVelocityRange");
                    ExcludeMember("YVelocityRange");
                    ExcludeMember("ZVelocityRange");
                }
                if (rangeType != RangeType.Cone &&
                    rangeType != RangeType.Wedge)
                {
                    ExcludeMember("WedgeAngle");
                    ExcludeMember("WedgeSpread");
                }

                if (rangeType == RangeType.Component)
                {
                    ExcludeMember("RadialVelocity");
                    ExcludeMember("RadialVelocityRange");
                }


                EnumToString blendEnumToString = new EnumToString();
                blendEnumToString.EnumType = typeof(BlendOperation);

                IncludeMember(
                    "BlendOperation",
                    containingType: typeof(EmissionSettingsSave),
                    typeConverter: blendEnumToString);

                EnumToString colorEnumToString = new EnumToString();
                colorEnumToString.EnumType = typeof(ColorOperation);

                IncludeMember(
                    "ColorOperation",
                    containingType: typeof(EmissionSettingsSave),
                    typeConverter: colorEnumToString);


                IncludeMember(
                    "Texture",
                    typeof(string),
                    HandleTextureChanged,
                    () =>
                    {
                        return SettingsSaveInstance.Texture;
                    },
                    null,
                    new Attribute[]
                        {
                            PropertyGridDisplayer.FileWindowAttribute, CategoryAttribute("Texture and Animation")[0]
                        }
                );

                IncludeMember(
                    "AnimationChains",
                    typeof(string),
                    HandleAniimationPathChanged,
                    () =>
                    {
                        return SettingsSaveInstance.AnimationChains;
                    },
                null,
                new Attribute[]
                {
                    PropertyGridDisplayer.FileWindowAttribute, CategoryAttribute("Texture and Animation")[0]
                }
                );
            }
        }
        public static EmissionSettingsSave FromEmissionSettings(EmissionSettings emissionSettings)
        {
            EmissionSettingsSave emissionSettingsSave = new EmissionSettingsSave();

            emissionSettingsSave.mVelocityRangeType = emissionSettings.VelocityRangeType;
            emissionSettingsSave.mRadialVelocity = emissionSettings.RadialVelocity;
            emissionSettingsSave.mRadialVelocityRange = emissionSettings.RadialVelocityRange;

            emissionSettingsSave.mXVelocity = emissionSettings.XVelocity;
            emissionSettingsSave.mYVelocity = emissionSettings.YVelocity;
            emissionSettingsSave.mZVelocity = emissionSettings.ZVelocity;

            emissionSettingsSave.mXVelocityRange = emissionSettings.XVelocityRange;
            emissionSettingsSave.mYVelocityRange = emissionSettings.YVelocityRange;
            emissionSettingsSave.mZVelocityRange = emissionSettings.ZVelocityRange;

            emissionSettingsSave.mWedgeAngle = emissionSettings.WedgeAngle;
            emissionSettingsSave.mWedgeSpread = emissionSettings.WedgeSpread;

            emissionSettingsSave.Billboarded = emissionSettings.Billboarded;

            emissionSettingsSave.mRotationX = emissionSettings.RotationX;
            emissionSettingsSave.mRotationXVelocity = emissionSettings.RotationXVelocity;
            emissionSettingsSave.mRotationXRange = emissionSettings.RotationXRange;
            emissionSettingsSave.mRotationXVelocityRange = emissionSettings.RotationXVelocityRange;

            emissionSettingsSave.mRotationY = emissionSettings.RotationY;
            emissionSettingsSave.mRotationYVelocity = emissionSettings.RotationYVelocity;
            emissionSettingsSave.mRotationYRange = emissionSettings.RotationYRange;
            emissionSettingsSave.mRotationYVelocityRange = emissionSettings.RotationYVelocityRange;
            

            emissionSettingsSave.mRotationZ = emissionSettings.RotationZ;
            emissionSettingsSave.mRotationZVelocity = emissionSettings.RotationZVelocity;
            emissionSettingsSave.mRotationZRange = emissionSettings.RotationZRange;
            emissionSettingsSave.mRotationZVelocityRange = emissionSettings.RotationZVelocityRange;

            emissionSettingsSave.mXAcceleration = emissionSettings.XAcceleration;
            emissionSettingsSave.mYAcceleration = emissionSettings.YAcceleration;
            emissionSettingsSave.mZAcceleration = emissionSettings.ZAcceleration;

            emissionSettingsSave.mXAccelerationRange = emissionSettings.XAccelerationRange;
            emissionSettingsSave.mYAccelerationRange = emissionSettings.YAccelerationRange;
            emissionSettingsSave.mZAccelerationRange = emissionSettings.ZAccelerationRange;

            emissionSettingsSave.mScaleX = emissionSettings.ScaleX;
            emissionSettingsSave.mScaleY = emissionSettings.ScaleY;
            emissionSettingsSave.mScaleXRange = emissionSettings.ScaleXRange;
            emissionSettingsSave.mScaleYRange = emissionSettings.ScaleYRange;

            emissionSettingsSave.mMatchScaleXToY = emissionSettings.MatchScaleXToY;

            emissionSettingsSave.mScaleXVelocity = emissionSettings.ScaleXVelocity;
            emissionSettingsSave.mScaleYVelocity = emissionSettings.ScaleYVelocity;

            emissionSettingsSave.mScaleXVelocityRange = emissionSettings.ScaleXVelocityRange;
            emissionSettingsSave.mScaleYVelocityRange = emissionSettings.ScaleYVelocityRange;

            if (emissionSettings.TextureScale > 0)
            {
                emissionSettingsSave.TextureScale = emissionSettings.TextureScale;
            }
            else
            {
                emissionSettingsSave.TextureScale = -1;
            }

#if FRB_MDX
            int multiple = 1;
            emissionSettingsSave.mFade = 255 - emissionSettings.Alpha;
            emissionSettingsSave.mTintRed = emissionSettings.Red;
            emissionSettingsSave.mTintGreen = emissionSettings.Green;
            emissionSettingsSave.mTintBlue = emissionSettings.Blue;

            emissionSettingsSave.mFadeRate = -emissionSettings.AlphaRate;
            emissionSettingsSave.mTintRedRate = emissionSettings.RedRate;
            emissionSettingsSave.mTintGreenRate = emissionSettings.GreenRate;
            emissionSettingsSave.mTintBlueRate = emissionSettings.BlueRate;

#elif FRB_XNA || SILVERLIGHT
            int multiple = 255;
            emissionSettingsSave.mFade = (1 - emissionSettings.Alpha) * 255;
            emissionSettingsSave.mTintRed = emissionSettings.Red * 255;
            emissionSettingsSave.mTintGreen = emissionSettings.Green * 255;
            emissionSettingsSave.mTintBlue = emissionSettings.Blue * 255;

            emissionSettingsSave.mFadeRate = -emissionSettings.AlphaRate*255;
            emissionSettingsSave.mTintRedRate = emissionSettings.RedRate*255;
            emissionSettingsSave.mTintGreenRate = emissionSettings.GreenRate*255;
            emissionSettingsSave.mTintBlueRate = emissionSettings.BlueRate*255;
#endif
            emissionSettingsSave.mBlendOperation =
                GraphicalEnumerations.BlendOperationToFlatRedBallMdxString(emissionSettings.BlendOperation);

#if FRB_MDX
            emissionSettingsSave.mColorOperation = GraphicalEnumerations.TranslateColorOperation(emissionSettings.ColorOperation);
#else
            emissionSettingsSave.mColorOperation = GraphicalEnumerations.ColorOperationToFlatRedBallMdxString(
                emissionSettings.ColorOperation);
            
#endif

            // preserve animation  and texture settings
            emissionSettingsSave.mAnimate = emissionSettings.Animate;

            // TODO: Justin - not sure if we need to force relative here?
            emissionSettingsSave.AnimationChains = emissionSettings.AnimationChains.Name;
            emissionSettingsSave.CurrentChainName = emissionSettings.CurrentChainName;
            
            // TODO: Justin - not sure if we neet to force relative here?
            emissionSettingsSave.Texture = emissionSettings.Texture.Name;

            emissionSettingsSave.Instructions = InstructionBlueprintListSave.FromInstructionBlueprintList(emissionSettings.Instructions);
            foreach (InstructionSave blueprint in emissionSettingsSave.Instructions.Instructions)
            {
                if (GraphicalEnumerations.ConvertableSpriteProperties.Contains(blueprint.Member))
                {
                    blueprint.Value = (float)blueprint.Value * multiple;
                }
            }
            emissionSettingsSave.mDrag = emissionSettings.Drag;

            return emissionSettingsSave;

        }