2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using libsecondlife;
|
|
|
|
|
|
|
|
|
|
namespace Key2Name
|
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
2007-07-31 10:29:38 +00:00
|
|
|
static System.Threading.AutoResetEvent NameEvent = new System.Threading.AutoResetEvent(false);
|
|
|
|
|
|
2007-04-28 20:54:02 +00:00
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length < 4)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Usage: Key2Name [loginfirstname] [loginlastname] [password] [key]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SecondLife client = new SecondLife();
|
2007-07-31 10:29:38 +00:00
|
|
|
client.Avatars.OnAvatarNames += new AvatarManager.AvatarNamesCallback(Avatars_OnAvatarNames);
|
|
|
|
|
|
2007-04-28 20:54:02 +00:00
|
|
|
Console.WriteLine("Attempting to connect and login to Second Life.");
|
|
|
|
|
|
|
|
|
|
// Login to Second Life
|
|
|
|
|
if (!client.Network.Login(args[0], args[1], args[2], "key2name", "jessemalthus@gmail.com"))
|
|
|
|
|
{
|
|
|
|
|
// Login failed
|
2007-05-14 07:33:57 +00:00
|
|
|
Console.WriteLine("Error logging in: " + client.Network.LoginMessage);
|
2007-04-28 20:54:02 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LLUUID lookup = new LLUUID();
|
|
|
|
|
LLUUID.TryParse(args[3], out lookup);
|
|
|
|
|
|
2007-11-30 13:15:31 +00:00
|
|
|
Console.WriteLine("Looking up name for " + lookup.ToString());
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-07-31 10:29:38 +00:00
|
|
|
client.Avatars.RequestAvatarName(lookup);
|
|
|
|
|
|
|
|
|
|
if (!NameEvent.WaitOne(15 * 1000, false))
|
|
|
|
|
Console.WriteLine("Name lookup timed out.");
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-07-31 10:29:38 +00:00
|
|
|
Console.WriteLine("Press enter to logout.");
|
2007-04-28 20:54:02 +00:00
|
|
|
Console.ReadLine();
|
|
|
|
|
|
|
|
|
|
client.Network.Logout();
|
|
|
|
|
}
|
2007-07-31 10:29:38 +00:00
|
|
|
|
|
|
|
|
static void Avatars_OnAvatarNames(System.Collections.Generic.Dictionary<LLUUID, string> names)
|
|
|
|
|
{
|
|
|
|
|
foreach (string name in names.Values)
|
|
|
|
|
Console.WriteLine("Name: " + name);
|
|
|
|
|
|
|
|
|
|
NameEvent.Set();
|
|
|
|
|
}
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|