Exemplo n.º 1
0
        public Client(IPAddress address, UInt16 port)
        {
            this.address = address;
            this.port = port;
            fetcher = new ContentFetcher (address, port);

            ContentNode node = ContentParser.Parse (ContentCodeBag.Default, fetcher.Fetch ("/server-info"));
            serverInfo = ServerInfo.FromNode (node);
        }
Exemplo n.º 2
0
        internal static ServerInfo FromNode(ContentNode node)
        {
            ServerInfo info = new ServerInfo ();

            if (node.Name != "dmap.serverinforesponse")
                return null;

            foreach (ContentNode child in (node.Value as ContentNode[])) {
                switch (child.Name) {
                case "dmap.itemname":
                    info.Name = (string) child.Value;
                    break;
                case "dmap.authenticationmethod":
                    info.AuthenticationMethod = (AuthenticationMethod) child.Value;
                    break;
                case "dmap.supportsupdate":
                    info.SupportsUpdate = (byte) child.Value == 1;
                    break;
                }
            }

            return info;
        }