Пример #1
0
    public static string[] GetUserVariables(string dName, string uName)
    {
        string[] userVariables = new string[5];
        for (int i = 0; i < userVariables.Length; i++)
        {
            userVariables[i] = " ";
        }
        try
        {
            XMLayer xm = new XMLayer();
            xm = XMServer.CreateXMLayer();
            string raw = "";
            string line;
            xm.Login();
            raw = xm.ListUserVariables(dName, uName);
            xm.Logout();

            using (StringReader sr = new StringReader(raw))
            {
                while ((line = sr.ReadLine()) != null)
                {
                    line = line.Trim();
                    if (line == ".")
                    {
                        break;
                    }
                    switch (extractUsersVariable(line, false))
                    {
                    case "RealName":
                        userVariables[0] = extractUsersVariable(line, true);
                        break;

                    case "HomePage":
                        userVariables[1] = extractUsersVariable(line, true);
                        break;

                    case "MaxMBSize":
                        userVariables[2] = extractUsersVariable(line, true);
                        break;

                    case "StoreMailLocaly":
                        userVariables[3] = extractUsersVariable(line, true);
                        break;

                    case "ClosedMailList":
                        userVariables[4] = extractUsersVariable(line, true);
                        break;

                    default:

                        break;
                    }
                }
                if (userVariables[3] == " ")
                {
                    userVariables[3] = "1";
                }
            }
        }
        catch (Exception error)
        {
            Log.WriteException(error);
        }
        return(userVariables);
    }