当前位置: 首页>>代码示例>>C#>>正文


C# TestClient.ToString方法代码示例

本文整理汇总了C#中libsecondlife.TestClient.TestClient.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TestClient.ToString方法的具体用法?C# TestClient.ToString怎么用?C# TestClient.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在libsecondlife.TestClient.TestClient的用法示例。


在下文中一共展示了TestClient.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Login

        /// <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;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:74,代码来源:ClientManager.cs

示例2: Login

        /// <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", "[email protected]");

            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;
        }
开发者ID:BackupTheBerlios,项目名称:libsecondlife-svn,代码行数:44,代码来源:ClientManager.cs

示例3: Login


//.........这里部分代码省略.........
                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;
        }
开发者ID:chrbayer84,项目名称:SLAgentCSServer,代码行数:101,代码来源:ClientManager.cs


注:本文中的libsecondlife.TestClient.TestClient.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。