csharp 如何查找任何Hypergrid用户的UUID Per:http://opensimulator.org/pipermail/opensim-dev/2013-December/02448

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 如何查找任何Hypergrid用户的UUID Per:http://opensimulator.org/pipermail/opensim-dev/2013-December/02448相关的知识,希望对你有一定的参考价值。

using System;
using OpenMetaverse;
using System.Collections;
using Nwc.XmlRpc;

namespace Name2Key
{
	class MainClass
	{
		static string m_ServerURL = "http://grid.kitely.com:8002/user/";//"http://hg.osgrid.org:80/user/";
		static string m_ServerURLHost = m_ServerURL;

		public static void Main (string[] args)
		{
			Console.WriteLine ("Hello World! {0}", GetUUID("Techplex", "Engineer"));
		}
		public static UUID GetUUID(String first, String last)
        {
            Hashtable hash = new Hashtable();
            hash["first"] = first;
            hash["last"] = last;

            hash = CallServer("get_uuid", hash);

            if (!hash.ContainsKey("UUID"))
            {
                throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} didn't return a UUID", m_ServerURLHost));
            }

            UUID uuid;
            if (!UUID.TryParse(hash["UUID"].ToString(), out uuid))
            {
                throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} returned an invalid UUID: {1}", m_ServerURLHost, hash["UUID"].ToString()));
            }

            return uuid;
        }
		private static Hashtable CallServer(string methodName, Hashtable hash)
        {
            IList paramList = new ArrayList();
            paramList.Add(hash);

            XmlRpcRequest request = new XmlRpcRequest(methodName, paramList);

            // Send and get reply
            XmlRpcResponse response = null;
            try
            {
                response = request.Send(m_ServerURL, 10000);
            }
            catch (Exception e)
            {
                Console.WriteLine("[USER AGENT CONNECTOR]: {0} call to {1} failed: {2}", methodName, m_ServerURLHost, e.Message);
                throw;
            }

            if (response.IsFault)
            {
                throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned an error: {2}", methodName, m_ServerURLHost, response.FaultString));
            }

            hash = (Hashtable)response.Value;

            if (hash == null)
            {
                throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned null", methodName, m_ServerURLHost));
            }

            return hash;
        }
	}
}

以上是关于csharp 如何查找任何Hypergrid用户的UUID Per:http://opensimulator.org/pipermail/opensim-dev/2013-December/02448的主要内容,如果未能解决你的问题,请参考以下文章

csharp 示例显示如何在补间库之外完全使用ZestKit的核心。它可用于以任何方式为任何方式制作动画

如何查找用户登录的所有计算机

csharp 查找并过滤目录中的文件

csharp 用于查找最大数字的if语句示例。

csharp 用于查找最大数字的if语句示例。

如何使用 Exchange Web 服务为其他用户查找日历项目