コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            client.SimPrims = SimPrims;
            client.Master   = account.Master;

            bool login = client.Network.Login(account.FirstName, account.LastName, account.Password,
                                              "TestClient", "*****@*****.**");

            if (client.Network.Connected)
            {
                Clients[client.Network.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());

                // Throttle the connection to not receive LayerData or asset packets
                client.Throttle.Total = 0.0f;
                client.Throttle.Task  = 1536000.0f;
                client.Throttle.Set();
            }
            else
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName +
                                  ": " + client.Network.LoginError);
            }

            return(client);
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            client.SimPrims = SimPrims;
            client.Master = account.Master;

            bool login = client.Network.Login(account.FirstName, account.LastName, account.Password,
                "TestClient", "*****@*****.**");

            if (client.Network.Connected)
            {
                Clients[client.Network.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());

                // Throttle the connection to not receive LayerData or asset packets
                client.Throttle.Total = 0.0f;
                client.Throttle.Task = 1536000.0f;
                client.Throttle.Set();
            }
            else
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName +
                    ": " + client.Network.LoginError);
            }

            return client;
        }
コード例 #3
0
ファイル: ClientManager.cs プロジェクト: RavenB/gridsearch
        /// <summary>
        /// 
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            // Optimize the throttle
            client.Throttle.Wind = 0;
            client.Throttle.Cloud = 0;
            client.Throttle.Land = 1000000;
            client.Throttle.Task = 1000000;

			client.MasterName = account.MasterName;
            client.MasterKey = account.MasterKey;

            NetworkManager.LoginParams loginParams = client.Network.DefaultLoginParams(
                    account.FirstName, account.LastName, account.Password, "TestClient", contactPerson);

            if (!String.IsNullOrEmpty(account.StartLocation))
                loginParams.Start = account.StartLocation;

            if (!String.IsNullOrEmpty(account.URI))
                loginParams.URI = account.URI;
            
            if (!client.Network.Login(loginParams))
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
                    client.Network.LoginMessage);
            }

            if (client.Network.Connected)
            {
                if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
                {
                    Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
                    // Find master's key from name
                    DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler);
                    client.Directory.OnDirPeopleReply += callback;
                    client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName, 0);
                    if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
                    {
                        account.MasterKey = resolvedMasterKey;
                        Console.WriteLine("\"{0}\" resolved to {1}", account.MasterName, account.MasterKey);
                    }
                    else
                    {
                        Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
                    }
                    client.Directory.OnDirPeopleReply -= callback;
                    keyResolution.Reset();
                }

                client.MasterKey = account.MasterKey;

                Clients[client.Self.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());
            }

            return client;
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            // Optimize the throttle
            client.Throttle.Wind  = 0;
            client.Throttle.Cloud = 0;
            client.Throttle.Land  = 1000000;
            client.Throttle.Task  = 1000000;

            client.GroupCommands = account.GroupCommands;
            client.MasterName    = account.MasterName;
            client.MasterKey     = account.MasterKey;

            LoginParams loginParams = client.Network.DefaultLoginParams(
                account.FirstName, account.LastName, account.Password, "TestClient", version);

            if (!String.IsNullOrEmpty(account.StartLocation))
            {
                loginParams.Start = account.StartLocation;
            }

            if (!String.IsNullOrEmpty(account.URI))
            {
                loginParams.URI = account.URI;
            }

            if (client.Network.Login(loginParams))
            {
                if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
                {
                    // To prevent security issues, we must resolve the specified master name to a key.
                    ManualResetEvent keyResolution = new ManualResetEvent(false);
                    List <DirectoryManager.AgentSearchData> masterMatches = new List <DirectoryManager.AgentSearchData>();

                    // Set up the callback that handles the search results:
                    DirectoryManager.DirPeopleReplyCallback callback =
                        delegate(LLUUID queryID, List <DirectoryManager.AgentSearchData> matches) {
                        // This may be called several times with additional search results.
                        if (matches.Count > 0)
                        {
                            lock (masterMatches)
                            {
                                masterMatches.AddRange(matches);
                            }
                        }
                        else
                        {
                            // No results to show.
                            keyResolution.Set();
                        }
                    };
                    // Find master's key from name
                    Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
                    client.Directory.OnDirPeopleReply += callback;
                    client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName, 0);
                    keyResolution.WaitOne(TimeSpan.FromSeconds(30), false);
                    client.Directory.OnDirPeopleReply -= callback;

                    LLUUID masterKey  = LLUUID.Zero;
                    string masterName = account.MasterName;
                    lock (masterMatches) {
                        if (masterMatches.Count == 1)
                        {
                            masterKey  = masterMatches[0].AgentID;
                            masterName = masterMatches[0].FirstName + " " + masterMatches[0].LastName;
                        }
                        else if (masterMatches.Count > 0)
                        {
                            // Print out numbered list of masters:
                            Console.WriteLine("Possible masters:");
                            for (int i = 0; i < masterMatches.Count; ++i)
                            {
                                Console.WriteLine("{0}: {1}", i, masterMatches[i].FirstName + " " + masterMatches[i].LastName);
                            }
                            Console.Write("Ambiguous master, choose one: ");
                            // Read number from the console:
                            string read = null;
                            do
                            {
                                read = Console.ReadLine();
                                int choice = 0;
                                if (int.TryParse(read, out choice))
                                {
                                    if (choice == -1)
                                    {
                                        break;
                                    }
                                    else if (choice < masterMatches.Count)
                                    {
                                        masterKey  = masterMatches[choice].AgentID;
                                        masterName = masterMatches[choice].FirstName + " " + masterMatches[choice].LastName;
                                        break;
                                    }
                                    else
                                    {
                                        Console.WriteLine("Please type a number from the above list, -1 to cancel.");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("You didn't type a number.");
                                    Console.WriteLine("Please type a number from the above list, -1 to cancel.");
                                }
                            } while (read != null); // Do it until the user selects a master.
                        }
                    }
                    if (masterKey != LLUUID.Zero)
                    {
                        Console.WriteLine("\"{0}\" resolved to {1} ({2})", account.MasterName, masterName, masterKey);
                        account.MasterName = masterName;
                        account.MasterKey  = masterKey;
                    }
                    else
                    {
                        Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
                    }
                }

                client.MasterKey             = account.MasterKey;
                Clients[client.Self.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());
            }
            else
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
                                  client.Network.LoginMessage);
            }

            return(client);
        }
コード例 #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            // Optimize the throttle
            client.Throttle.Wind = 0;
            client.Throttle.Cloud = 0;
            client.Throttle.Land = 1000000;
            client.Throttle.Task = 1000000;

            client.GroupCommands = account.GroupCommands;
			client.MasterName = account.MasterName;
            client.MasterKey = account.MasterKey;

            LoginParams loginParams = client.Network.DefaultLoginParams(
                    account.FirstName, account.LastName, account.Password, "TestClient", version);

            if (!String.IsNullOrEmpty(account.StartLocation))
                loginParams.Start = account.StartLocation;

            if (!String.IsNullOrEmpty(account.URI))
                loginParams.URI = account.URI;
            
            if (client.Network.Login(loginParams))
            {
                if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
                {
                    // To prevent security issues, we must resolve the specified master name to a key.
                    ManualResetEvent keyResolution = new ManualResetEvent(false);
                    List<DirectoryManager.AgentSearchData> masterMatches = new List<DirectoryManager.AgentSearchData>();
                    
                    // Set up the callback that handles the search results:
                    DirectoryManager.DirPeopleReplyCallback callback = 
                        delegate (LLUUID queryID, List<DirectoryManager.AgentSearchData> matches) {
                            // This may be called several times with additional search results.
                            if (matches.Count > 0)
                            {
                                lock (masterMatches)
                                {
                                    masterMatches.AddRange(matches);
                                }
                            }
                            else
                            {
                                // No results to show.
                                keyResolution.Set();
                            }
                        };
                    // Find master's key from name
                    Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
                    client.Directory.OnDirPeopleReply += callback;
                    client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName, 0);
                    keyResolution.WaitOne(TimeSpan.FromSeconds(30), false);
                    client.Directory.OnDirPeopleReply -= callback;

                    LLUUID masterKey = LLUUID.Zero;
                    string masterName = account.MasterName;
                    lock (masterMatches) {
                        if (masterMatches.Count == 1) {
                            masterKey = masterMatches[0].AgentID;
                            masterName = masterMatches[0].FirstName + " " + masterMatches[0].LastName;
                        } else if (masterMatches.Count > 0) {
                            // Print out numbered list of masters:
                            Console.WriteLine("Possible masters:");
                            for (int i = 0; i < masterMatches.Count; ++i)
                            {
                                Console.WriteLine("{0}: {1}", i, masterMatches[i].FirstName + " " + masterMatches[i].LastName);
                            }
                            Console.Write("Ambiguous master, choose one: ");
                            // Read number from the console:
                            string read = null;
                            do
                            {
                                read = Console.ReadLine();
                                int choice = 0;
                                if (int.TryParse(read, out choice))
                                {
                                    if (choice == -1)
                                    {
                                        break;
                                    } 
                                    else if (choice < masterMatches.Count)
                                    {
                                        masterKey = masterMatches[choice].AgentID;
                                        masterName = masterMatches[choice].FirstName + " " + masterMatches[choice].LastName;
                                        break;
                                    }
                                    else
                                    {
                                        Console.WriteLine("Please type a number from the above list, -1 to cancel.");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("You didn't type a number.");
                                    Console.WriteLine("Please type a number from the above list, -1 to cancel.");
                                }
                            } while (read != null); // Do it until the user selects a master.
                        }
                    }
                    if (masterKey != LLUUID.Zero)
                    {
                        Console.WriteLine("\"{0}\" resolved to {1} ({2})", account.MasterName, masterName, masterKey);
                        account.MasterName = masterName;
                        account.MasterKey = masterKey;
                    }
                    else
                    {
                        Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
                    }
                }

                client.MasterKey = account.MasterKey;
                Clients[client.Self.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());
            }
            else
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
                    client.Network.LoginMessage);
            }

            return client;
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public TestClient Login(LoginDetails account)
        {
            // Check if this client is already logged in
            foreach (TestClient c in Clients.Values)
            {
                if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
                {
                    Logout(c);
                    break;
                }
            }

            TestClient client = new TestClient(this);

            // Optimize the throttle
            client.Throttle.Wind  = 0;
            client.Throttle.Cloud = 0;
            client.Throttle.Land  = 1000000;
            client.Throttle.Task  = 1000000;

            client.MasterName = account.MasterName;
            client.MasterKey  = account.MasterKey;

            LoginParams loginParams = client.Network.DefaultLoginParams(
                account.FirstName, account.LastName, account.Password, "TestClient", version);

            if (!String.IsNullOrEmpty(account.StartLocation))
            {
                loginParams.Start = account.StartLocation;
            }

            if (!String.IsNullOrEmpty(account.URI))
            {
                loginParams.URI = account.URI;
            }

            if (!client.Network.Login(loginParams))
            {
                Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
                                  client.Network.LoginMessage);
            }

            if (client.Network.Connected)
            {
                if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
                {
                    Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
                    // Find master's key from name
                    DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler);
                    client.Directory.OnDirPeopleReply += callback;
                    client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName, 0);
                    if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
                    {
                        account.MasterKey = resolvedMasterKey;
                        Console.WriteLine("\"{0}\" resolved to {1}", account.MasterName, account.MasterKey);
                    }
                    else
                    {
                        Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
                    }
                    client.Directory.OnDirPeopleReply -= callback;
                    keyResolution.Reset();
                }

                client.MasterKey = account.MasterKey;

                Clients[client.Self.AgentID] = client;

                Console.WriteLine("Logged in " + client.ToString());
            }

            return(client);
        }