using System; using System.Text; using Crosstales.Radio.Model.Enum; using Crosstales.Radio.Util; using UnityEngine; namespace Crosstales.Radio.Model.Entry { [Serializable] public abstract class BaseRadioEntry { [Tooltip("Name of the radio station.")] [Header("General Settings")] public string Name; [Tooltip("Force the name of the station to this name (default: false).")] public bool ForceName; [Tooltip("Enable the source in this provider (default: true).")] public bool EnableSource = true; [Tooltip("Provider of the radio stations (optional).")] [Header("Meta Data")] public string Station; [Tooltip("Genres of the radios (optional).")] public string Genres; [Tooltip("Your rating of the radios.")] [Range(0f, 5f)] public float Rating; [Multiline] [Tooltip("Description of the radio stations (optional).")] public string Description; [Tooltip("Icon to represent the radio stations (optional).")] public Sprite Icon; [Tooltip("Default audio format of the stations (default: AudioFormat.MP3).")] [Header("Stream Settings")] public AudioFormat Format = AudioFormat.MP3; [Tooltip("Default bitrate in kbit/s (default: 128).")] public int Bitrate = 128; [Tooltip("Default size of the streaming-chunk in KB (default: 32).")] public int ChunkSize = 32; [Tooltip("Default size of the local buffer in KB (default: 48).")] public int BufferSize = 48; [Tooltip("Exclude this station if the current RadioPlayer codec is equals this one (default: AudioCodec.None).")] [Header("Codec Settings")] public AudioCodec ExcludedCodec; [HideInInspector] public bool isInitalized; public BaseRadioEntry() { } public BaseRadioEntry(string name, bool forceName, bool enableSource, string station, string genres, float rating, string desc, Sprite icon, AudioFormat format, int bitrate, int chunkSize, int bufferSize, AudioCodec excludeCodec) { Name = name; ForceName = forceName; EnableSource = enableSource; Station = station; Genres = genres; Rating = rating; Description = desc; Icon = icon; Format = format; Bitrate = bitrate; ChunkSize = chunkSize; BufferSize = bufferSize; ExcludedCodec = excludeCodec; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(GetType().Name); stringBuilder.Append(Constants.TEXT_TOSTRING_START); stringBuilder.Append("Name='"); stringBuilder.Append(Name); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("ForceName='"); stringBuilder.Append(ForceName); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("EnableSource='"); stringBuilder.Append(EnableSource); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("Station='"); stringBuilder.Append(Station); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("Genres='"); stringBuilder.Append(Genres); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("Rating='"); stringBuilder.Append(Rating); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("Description='"); stringBuilder.Append(Description); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("Icon='"); stringBuilder.Append(Icon); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("AudioFormat='"); stringBuilder.Append(Format); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("Bitrate='"); stringBuilder.Append(Bitrate); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("ChunkSize='"); stringBuilder.Append(ChunkSize); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("BufferSize='"); stringBuilder.Append(BufferSize); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("ExcludedCodec='"); stringBuilder.Append(ExcludedCodec); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER); stringBuilder.Append("isInitalized='"); stringBuilder.Append(isInitalized); stringBuilder.Append(Constants.TEXT_TOSTRING_DELIMITER_END); stringBuilder.Append(Constants.TEXT_TOSTRING_END); return stringBuilder.ToString(); } } }