using System.Text;

namespace DragonVideoPlayer
{
    class TextListLoader
    {
        public static List<string> Load_no_Contains(string path)
        {
            List<string> list = new List<string>();

            if (!File.Exists(path))
                return list;

            try
            {
                using (StreamReader file = new StreamReader(path, Encoding.UTF8))
                {
                    string line;

                    while ((line = file.ReadLine()) != null)
                    {
                        line = line.Trim();

                        if (!string.IsNullOrEmpty(line) )
                        {
                            list.Add(line);
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }

            return list;
        }
        public static List<string> Load(string path)
        {
            List<string> list = new List<string>();

            if (!File.Exists(path))
                return list;

            try
            {
                using (StreamReader file = new StreamReader(path, Encoding.UTF8))
                {
                    string line;

                    while ((line = file.ReadLine()) != null)
                    {
                        line = line.Trim();

                        if (!string.IsNullOrEmpty(line) && !list.Contains(line))
                        {
                            list.Add(line);
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }

            return list;
        }

    }
}