/* This file is part of AHD ID3 Tag Editor (AITE)
   A program can create and edit ID3 Tag for mp3 files

   Copyright © Ala I.Hadid 2012

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AHD.ID3Tag.TextFrames
{
    public class TFLT : TextFrame
    {
        public TFLT()
            : base("TFLT", 0, 0, null)
        { }
        public TFLT(int size, ushort flags, byte[] data)
            : base("TFLT", size, flags, data)
        { }
        public override string Name
        {
            get { return "File type"; }
        }
        string[] codes =
        {
"MPG",
"MPG/1",
"MPG/2",
"MPG/3",
"MPG/2.5",
"MPG/AAC",
"VQF",
"PCM",
        };
        public override TextFrameType FrameType
        {
            get
            {
                return TextFrameType.TypeOfTypesNotEditable;
            }
        }
        public override string Text
        {
            get
            {
                for (int i = 0; i < codes.Length; i++)
                {
                    if (base.Text == codes[i])
                    {
                        return Consts.FileTypes[i];
                    }
                }
                return base.Text;
            }
            set
            {
                for (int i = 0; i < Consts.FileTypes.Length; i++)
                {
                    if (value == Consts.FileTypes[i])
                    {
                        base.Text = codes[i];
                        return;
                    }
                }
                base.Text = "";
            }
        }
    }
}
