/// <summary> /// Add the users in the file to a list of users /// </summary> /// <param name="userList">list to receive users</param> /// <returns>count of users added</returns> public int AddUsersToList(ref List<FilezillaUser> userList) { int count = 0; /// get a collection of all users XmlNodeList users = config.SelectNodes("/FileZillaServer/Users/User"); // walk the collection of accessible folders foreach (XmlNode user in users) { FilezillaUser fzu = new FilezillaUser(); if (fzu.Read(user)) { userList.Add(fzu); count++; } } return count; }
/// <summary> /// Retrieve a user object by user name. This will throw if the /// user cannot be found /// </summary> /// <param name="userName">target user</param> /// <returns>filezilla user object</returns> public FilezillaUser GetUser(string userName) { FilezillaUser fzu = new FilezillaUser(); // look up the user in the configuration XmlNode userNode = config.SelectSingleNode("/FileZillaServer/Users/User[@Name='" + userName + "']"); if (!fzu.Read(userNode)) { throw new Exception("Unable to parse user record"); } return fzu; }