public PlaySoundEffectCommand(SoundEffect soundEffect, Volume volume)
        {
            soundEffect.ThrowIfNull("soundEffect");

            _soundEffect = soundEffect;
            _volume = volume;
        }
        public XElement Serialize(SoundEffect soundEffect, string elementName = "soundEffect")
        {
            soundEffect.ThrowIfNull("soundEffect");
            elementName.ThrowIfNull("elementName");

            return new XElement(
                elementName,
                new XElement("data", BinarySerializer.Instance.Serialize(soundEffect.Data)),
                new XAttribute("id", soundEffect.Id),
                new XAttribute("name", soundEffect.Name),
                new XAttribute("description", soundEffect.Description));
        }
        public byte[] Serialize(SoundEffect soundEffect)
        {
            soundEffect.ThrowIfNull("soundEffect");

            var serializer = new CompactSerializer();

            serializer[0] = soundEffect.Id.ToByteArray();
            serializer[1] = Encoding.UTF8.GetBytes(soundEffect.Name);
            serializer[2] = Encoding.UTF8.GetBytes(soundEffect.Description);
            serializer[3] = soundEffect.Data;

            return serializer.Serialize();
        }
예제 #4
0
 public static PlaySoundEffectCommand PlaySoundEffect(SoundEffect soundEffect, Volume volume)
 {
     return new PlaySoundEffectCommand(soundEffect, volume);
 }
예제 #5
0
 public static PlaySoundEffectCommand PlaySoundEffect(SoundEffect soundEffect)
 {
     return new PlaySoundEffectCommand(soundEffect);
 }
 public PlaySoundEffectCommand(SoundEffect soundEffect)
     : this(soundEffect, Volume.Full)
 {
 }