public PlaySongCommand(Song song, Volume volume)
        {
            song.ThrowIfNull("song");

            _song = song;
            _volume = volume;
        }
        public XElement Serialize(Song song, string elementName = "song")
        {
            song.ThrowIfNull("song");
            elementName.ThrowIfNull("elementName");

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

            var serializer = new CompactSerializer();

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

            return serializer.Serialize();
        }
Exemple #4
0
 public static PlaySongCommand PlaySong(Song song, Volume volume)
 {
     return new PlaySongCommand(song, volume);
 }
Exemple #5
0
 public static PlaySongCommand PlaySong(Song song)
 {
     return new PlaySongCommand(song);
 }
 public PlaySongCommand(Song song)
     : this(song, Volume.Full)
 {
 }