Example #1
0
 public MediaSerializer(string defaultFormat)
 {
     if (defaultFormat?.Contains("json") == true)
     {
         this.defaultFormat = Formats.Json;
     }
     else if (defaultFormat?.Contains("xml") == true)
     {
         this.defaultFormat = Formats.Xml;
     }
     else
     {
         this.defaultFormat = Formats.Json;
     }
 }
Example #2
0
        /// <summary>
        /// Extract text from cliboard object for textual representation.
        /// </summary>
        /// <returns></returns>
        private string ExtractText()
        {
            if (this.Item.ContainsText())
            {
                return(this.Item.GetData(Formats.Contains("System.String") ? "System.String" : Formats[0]).ToString());
            }

            if (this.Item.ContainsImage())
            {
                if (Formats.Contains("Bitmap"))
                {
                    return("Image");
                }
                return("Image");
            }

            if (this.Item.ContainsAudio())
            {
                if (Formats.Contains("Audio"))
                {
                    return("Audio");
                }
                return("Audio");
            }

            if (this.Item.GetDataPresent(DataFormats.FileDrop, false) == true)
            {
                string[] fileNames = (string[])this.Item.GetData(DataFormats.FileDrop);
                return(FileNamesToString(fileNames));
            }

            else if (this.Item.GetDataPresent("FileGroupDescriptorW"))
            {
                FileDataObject dataObject = new FileDataObject(this.Item);
                string[]       fileNames  = (string[])dataObject.GetData("FileGroupDescriptorW");
                return(FileNamesToString(fileNames));
            }


            return(this.Item.ToString());
        }
Example #3
0
 public static bool IsFormatSupported(string format)
 {
     return(!string.IsNullOrEmpty(format) && Formats.Contains(format, StringComparer.OrdinalIgnoreCase));
 }
Example #4
0
        public RadioTimeOutline(XmlNode node)
        {
            if (node.Attributes["type"] != null)
            {
                switch (node.Attributes["type"].Value)
                {
                case "link":
                    Type = OutlineType.link;
                    break;

                case "audio":
                    Type = OutlineType.audio;
                    break;

                default:
                    Type = OutlineType.unknow;
                    break;
                }
            }

            Text = node.Attributes["text"] != null ? node.Attributes["text"].Value : string.Empty;

            if (node.Attributes["url"] != null)
            {
                Url = node.Attributes["url"].Value;
            }

            if (node.Attributes["URL"] != null)
            {
                Url = node.Attributes["URL"].Value;
            }

            Image = node.Attributes["image"] != null ? node.Attributes["image"].Value : string.Empty;

            Bitrate = node.Attributes["bitrate"] != null ? node.Attributes["bitrate"].Value : string.Empty;

            Subtext = node.Attributes["subtext"] != null ? node.Attributes["subtext"].Value : string.Empty;

            if (node.Attributes["formats"] != null)
            {
                Formats = node.Attributes["formats"].Value;
                if (Formats.Contains(","))
                {
                    Formats = Formats.Split(',')[0];
                }
            }
            else
            {
                Formats = string.Empty;
            }

            Duration = node.Attributes["duration"] != null ? node.Attributes["duration"].Value : string.Empty;

            Start = node.Attributes["start"] != null ? node.Attributes["start"].Value : string.Empty;

            GuidId = node.Attributes["guide_id"] != null ? node.Attributes["guide_id"].Value : string.Empty;

            PresetId = node.Attributes["preset_id"] != null ? node.Attributes["preset_id"].Value : string.Empty;

            CurrentTrack = node.Attributes["current_track"] != null ? node.Attributes["current_track"].Value : string.Empty;

            Key = node.Attributes["key"] != null ? node.Attributes["key"].Value : string.Empty;

            GenreId = node.Attributes["genre_id"] != null ? node.Attributes["genre_id"].Value : string.Empty;

            Remain = node.Attributes["seconds_remaining"] != null ? node.Attributes["seconds_remaining"].Value : string.Empty;

            Reliability = node.Attributes["reliability"] != null ? node.Attributes["reliability"].Value : string.Empty;

            PresetNumber = node.Attributes["preset_number"] != null ? node.Attributes["preset_number"].Value : string.Empty;

            //Now_playing_id = Type == OutlineType.audio ? node.Attributes["now_playing_id"].Value : string.Empty;
        }