Read() public method

Load the object from an XML node
public Read ( XmlNode user ) : bool
user XmlNode
return bool
コード例 #1
0
ファイル: Filezilla.cs プロジェクト: sancsoft/FileZilla.NET
	/// <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;
	}
コード例 #2
0
ファイル: Filezilla.cs プロジェクト: sancsoft/FileZilla.NET
	/// <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;
	}