Get() private method

private Get ( Tag tag, ByteVector ident ) : TextInformationFrame
tag Tag
ident ByteVector
return TextInformationFrame
Beispiel #1
0
        public string GetTextAsString(ByteVector ident)
        {
            Frame frame;

            if (ident[0] == 'W')
            {
                frame = UrlLinkFrame.Get(this, ident, false);
            }
            else
            {
                frame = TextInformationFrame.Get(this, ident, false);
            }
            string result = frame == null?null:frame.ToString();

            return(string.IsNullOrEmpty(result)?null:result);
        }
Beispiel #2
0
        public void SetTextFrame(ByteVector ident, params string[] text)
        {
            if (ident == null)
            {
                throw new ArgumentNullException("ident");
            }
            if (ident.Count != 4)
            {
                throw new ArgumentException("Identifier must be four bytes long.", "ident");
            }
            bool empty = true;

            if (text != null)
            {
                for (int i = 0; empty && i < text.Length; i++)
                {
                    if (!string.IsNullOrEmpty(text[i]))
                    {
                        empty = false;
                    }
                }
            }
            if (empty)
            {
                RemoveFrames(ident);
                return;
            }
            if (ident[0] == 'W')
            {
                UrlLinkFrame urlFrame = UrlLinkFrame.Get(this, ident, true);
                urlFrame.Text         = text;
                urlFrame.TextEncoding = DefaultEncoding;
                return;
            }
            TextInformationFrame frame = TextInformationFrame.Get(this, ident, true);

            frame.Text         = text;
            frame.TextEncoding = DefaultEncoding;
        }
Beispiel #3
0
        private string[] GetTextAsArray(ByteVector ident)
        {
            TextInformationFrame frame = TextInformationFrame.Get(this, ident, false);

            return(frame == null?new string[0]:frame.Text);
        }