Catrobat.IDE.Core.Utilities.Helpers.ReferenceHelper.UpdateSoundReference C# (CSharp) Method

UpdateSoundReference() private static method

private static UpdateSoundReference ( XmlSprite oldSprite, XmlSprite newSprite, int scriptCount, int brickCount ) : void
oldSprite Catrobat.IDE.Core.Xml.XmlObjects.XmlSprite
newSprite Catrobat.IDE.Core.Xml.XmlObjects.XmlSprite
scriptCount int
brickCount int
return void
        private static void UpdateSoundReference(XmlSprite oldSprite, XmlSprite newSprite, int scriptCount, int brickCount)
        {
            var oldSoundReference = (oldSprite.Scripts.Scripts[scriptCount].Bricks.Bricks[brickCount] as XmlPlaySoundBrick).XmlSoundReference;
            var newSoundReference = (newSprite.Scripts.Scripts[scriptCount].Bricks.Bricks[brickCount] as XmlPlaySoundBrick).XmlSoundReference;

            var soundCount = 0;
            foreach (var sound in oldSprite.Sounds.Sounds)
            {
                if (sound == oldSoundReference.Sound)
                {
                    newSoundReference.Sound = newSprite.Sounds.Sounds[soundCount];
                    return;
                }

                soundCount++;
            }
        }