using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for SafeAccountFilter
/// </summary>
public class SafeAccountFilter
{
    private Dictionary<string, int> _accountFilter = new Dictionary<string, int>();

    public SafeAccountFilter(string cfgFile)
    {
        try
        {
            using (StreamReader sr = new StreamReader(cfgFile))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    int p = line.IndexOf('#');
                    if (p != -1) line = line.Substring(0, p);
                    line = line.Trim();

                    if (line.Length > 3)
                    {
                        _accountFilter.Add(line, 0);
                    }
                }
            }
        }
        catch { }
    }

    public bool Filtered(string account)
    {
        return _accountFilter.ContainsKey(account);
    }
}