Esempio n. 1
0
 public override string ToString()
 {
     return
         ($"{nameof(HasSong)}: {HasSong.ToString()}, " +
          $"{nameof(IsPaused)}: {IsPaused.ToString()}, " +
          $"{nameof(VolumePercent)}: {VolumePercent.ToString()}, " +
          $"{nameof(SeekbarCurrentPosition)}: {SeekbarCurrentPosition.ToString()}, " +
          $"{nameof(SeekbarCurrentPositionHuman)}: {SeekbarCurrentPositionHuman}, " +
          $"{nameof(StatePercent)}: {StatePercent.ToString()}, " +
          $"{nameof(LikeStatus)}: {LikeStatus}, " +
          $"{nameof(RepeatType)}: {RepeatType}");
 }
Esempio n. 2
0
        /// <summary>
        /// Serialises the notification.
        /// </summary>
        /// <returns>
        /// The notification serialized as a byte array.
        /// </returns>
        public byte[] SerialiseNotification()
        {
            // Due to a Json.Net bug serialising int[] we construct this message manually
            string playlistString = string.Empty;

            if ((Playlist != null) && (Playlist.Length > 0))
            {
                foreach (int audioFileId in Playlist)
                {
                    playlistString += (!string.IsNullOrEmpty(playlistString) ? ", " : string.Empty) + audioFileId;
                }
            }
            string json = "{\"PlaylistPosition\":" + PlaylistPosition + ", \"Playlist\":[" + playlistString + "], \"IsPaused\":" + IsPaused.ToString().ToLower() + ", \"IsPlaying\":" + IsPlaying.ToString().ToLower() + ", \"Position\":" + Position + ", \"Duration\":" + Duration + ", \"IsRepeatAll\":" + IsRepeatAll.ToString().ToLower() + ", \"IsShuffle\":" + IsShuffle.ToString().ToLower() + ", \"CanMoveNext\":" + CanMoveNext.ToString().ToLower() + ", \"CanMovePrevious\":" + CanMovePrevious.ToString().ToLower() + "}";

            return(System.Text.Encoding.UTF8.GetBytes(json));
        }