Ejemplo n.º 1
0
    public static List <AdminPanelControlAccount> GetControlAccounts()
    {
        List <AdminPanelControlAccount> cAccounts = new List <AdminPanelControlAccount>();

        try
        {
            XMLayer xm  = XMServer.CreateXMLayer();
            string  raw = string.Empty;
            string  line;
            xm.Login();
            raw = xm.GetCtrlAccounts();
            xm.Logout();
            using (StringReader sr = new StringReader(raw))
            {
                string[] data;
                AdminPanelControlAccount cAccount = new AdminPanelControlAccount();
                while ((line = sr.ReadLine()) != null)
                {
                    line = line.Trim();
                    if (line == ".")
                    {
                        break;
                    }
                    data              = extractCtrlAccounts(line);
                    cAccount.Name     = data[0];
                    cAccount.Password = AdminPanelUtils.DecryptPassword(data[1]);
                    cAccounts.Add(cAccount);
                }
            }
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            throw new WebMail.WebMailException(error);
        }
        return(cAccounts);
    }