public TestClient Login(string[] args) { if (args.Length < 3) { Console.WriteLine("Usage: login firstname lastname password [simname] [login server url]"); return(null); } LoginDetails account = new LoginDetails { FirstName = args[0], LastName = args[1], Password = args[2] }; if (args.Length > 3) { // If it looks like a full starting position was specified, parse it if (args[3].StartsWith("http")) { account.URI = args[3]; } else { if (args[3].IndexOf('/') >= 0) { char sep = '/'; string[] startbits = args[3].Split(sep); try { account.StartLocation = NetworkManager.StartLocation(startbits[0], int.Parse(startbits[1]), int.Parse(startbits[2]), int.Parse(startbits[3])); } catch (FormatException) { } } // Otherwise, use the center of the named region if (account.StartLocation == null) { account.StartLocation = NetworkManager.StartLocation(args[3], 128, 128, 40); } } } if (args.Length > 4) { if (args[4].StartsWith("http")) { account.URI = args[4]; } } if (string.IsNullOrEmpty(account.URI)) { account.URI = Program.LoginURI; } Logger.Log("Using login URI " + account.URI, Helpers.LogLevel.Info); return(Login(account)); }
public TestClient Login(string[] args) { if (args.Length < 3) { Console.WriteLine("Usage: login firstname lastname password [simname] [login server url]"); return null; } LoginDetails account = new LoginDetails(); account.FirstName = args[0]; account.LastName = args[1]; account.Password = args[2]; if (args.Length > 3) { // If it looks like a full starting position was specified, parse it if (args[3].StartsWith("http")) { account.URI = args[3]; } else { if (args[3].IndexOf('/') >= 0) { char sep = '/'; string[] startbits = args[3].Split(sep); try { account.StartLocation = NetworkManager.StartLocation(startbits[0], Int32.Parse(startbits[1]), Int32.Parse(startbits[2]), Int32.Parse(startbits[3])); } catch (FormatException) { } } // Otherwise, use the center of the named region if (account.StartLocation == null) account.StartLocation = NetworkManager.StartLocation(args[3], 128, 128, 40); } } if (args.Length > 4) if (args[4].StartsWith("http")) account.URI = args[4]; if (string.IsNullOrEmpty(account.URI)) account.URI = Program.LoginURI; Logger.Log("Using login URI " + account.URI, Helpers.LogLevel.Info); return Login(account); }
/// <summary> /// /// </summary> /// <param name="args"></param> /// <returns></returns> public TestClient Login(string[] args) { LoginDetails account = new LoginDetails(); account.FirstName = args[0]; account.LastName = args[1]; account.Password = args[2]; if (args.Length > 3) { account.StartLocation = NetworkManager.StartLocation(args[3], 128, 128, 40); } if (args.Length > 4) { account.URI = args[4]; } return(Login(account)); }
static void Main(string[] args) { Arguments arguments = new Arguments(args); ClientManager manager; List<LoginDetails> accounts = new List<LoginDetails>(); LoginDetails account; bool groupCommands = false; string masterName = String.Empty; UUID masterKey = UUID.Zero; string file = String.Empty; string loginuri = String.Empty; try { if (arguments["groupcommands"] != null) { groupCommands = true; } if (arguments["masterkey"] != null) { masterKey = UUID.Parse(arguments["masterkey"]); } if (arguments["master"] != null) { masterName = arguments["master"]; } if (arguments["loginuri"] != null) { loginuri = arguments["loginuri"]; } if (arguments["file"] != null) { file = arguments["file"]; if (!File.Exists(file)) { Console.WriteLine("File {0} Does not exist", file); return; } // Loading names from a file try { using (StreamReader reader = new StreamReader(file)) { string line; int lineNumber = 0; while ((line = reader.ReadLine()) != null) { lineNumber++; string[] tokens = line.Trim().Split(new char[] { ' ', ',' }); if (tokens.Length >= 3) { account = new LoginDetails(); account.FirstName = tokens[0]; account.LastName = tokens[1]; account.Password = tokens[2]; accounts.Add(account); // Leaving this out until we have per-account masters (if that // is desirable). For now the command-line option can // specify the single master that TestClient supports //if (tokens.Length == 5) //{ // master = tokens[3] + " " + tokens[4]; //} } else { Console.WriteLine("Invalid data on line " + lineNumber + ", must be in the format of: FirstName LastName Password"); } } } } catch (Exception e) { Console.WriteLine("Error reading from " + args[1]); Console.WriteLine(e.ToString()); return; } } else if (arguments["first"] != null && arguments["last"] != null && arguments["pass"] != null) { // Taking a single login off the command-line account = new LoginDetails(); account.FirstName = arguments["first"]; account.LastName = arguments["last"]; account.Password = arguments["pass"]; accounts.Add(account); } else { throw new CommandLineArgumentsException(); } } catch (CommandLineArgumentsException) { Usage(); return; } foreach (LoginDetails a in accounts) { a.GroupCommands = groupCommands; a.MasterName = masterName; a.MasterKey = masterKey; a.URI = loginuri; } // Login the accounts and run the input loop if (arguments["startpos"] != null) { manager = new ClientManager(accounts, arguments["startpos"]); } else { manager = new ClientManager(accounts); } manager.Run(); }
static void Main(string[] args) { Arguments arguments = new Arguments(args); ClientManager manager; List<LoginDetails> accounts = new List<LoginDetails>(); LoginDetails account; bool groupCommands = false; string masterName = String.Empty; Guid masterKey = Guid.Empty; string file = String.Empty; string loginuri = String.Empty; bool getTextures = false; string scriptFile = String.Empty; if (arguments["groupcommands"] != null) groupCommands = true; if (arguments["masterkey"] != null) masterKey = Guid.Parse(arguments["masterkey"]); if (arguments["master"] != null) masterName = arguments["master"]; if (arguments["loginuri"] != null) loginuri = arguments["loginuri"]; if (arguments["gettextures"] != null) getTextures = true; if (arguments["scriptfile"] != null) { scriptFile = arguments["scriptfile"]; if (!File.Exists(scriptFile)) { Console.WriteLine("File {0} Does not exist", scriptFile); return; } } if (arguments["file"] != null) { file = arguments["file"]; if (!File.Exists(file)) { Console.WriteLine("File {0} Does not exist", file); return; } // Loading names from a file try { using (StreamReader reader = new StreamReader(file)) { string line; int lineNumber = 0; while ((line = reader.ReadLine()) != null) { lineNumber++; string[] tokens = line.Trim().Split(new char[] { ' ', ',' }); if (tokens.Length >= 3) { account = new LoginDetails(); account.FirstName = tokens[0]; account.LastName = tokens[1]; account.Password = tokens[2]; if (tokens.Length >= 4) // Optional starting position { char sep = '/'; string[] startbits = tokens[3].Split(sep); account.StartLocation = NetworkManager.StartLocation(startbits[0], Int32.Parse(startbits[1]), Int32.Parse(startbits[2]), Int32.Parse(startbits[3])); } accounts.Add(account); } else { Logger.Log("Invalid data on line " + lineNumber + ", must be in the format of: FirstName LastName Password [Sim/StartX/StartY/StartZ]", Helpers.LogLevel.Warning); } } } } catch (Exception e) { Console.WriteLine("Error reading from " + args[1]); Console.WriteLine(e.ToString()); return; } } else if (arguments["first"] != null && arguments["last"] != null && arguments["pass"] != null) { // Taking a single login off the command-line account = new LoginDetails(); account.FirstName = arguments["first"]; account.LastName = arguments["last"]; account.Password = arguments["pass"]; accounts.Add(account); } else if (arguments["help"] != null) { Usage(); return; } foreach (LoginDetails a in accounts) { a.GroupCommands = groupCommands; a.MasterName = masterName; a.MasterKey = masterKey; a.URI = loginuri; if (arguments["startpos"] != null) { char sep = '/'; string[] startbits = arguments["startpos"].Split(sep); a.StartLocation = NetworkManager.StartLocation(startbits[0], Int32.Parse(startbits[1]), Int32.Parse(startbits[2]), Int32.Parse(startbits[3])); } } // Login the accounts and run the input loop manager = new ClientManager(accounts, getTextures); if (!String.IsNullOrEmpty(scriptFile)) manager.DoCommandAll("script " + scriptFile, Guid.Empty); // Then Run the ClientManager normally manager.Run(); }
/// <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; client.AllowObjectMaster = client.MasterKey != UUID.Zero; // Require UUID for object master. 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)) { Clients[client.Self.AgentID] = client; if (client.MasterKey == UUID.Zero) { UUID query = UUID.Random(); DirectoryManager.DirPeopleReplyCallback peopleDirCallback = delegate(UUID queryID, List<DirectoryManager.AgentSearchData> matchedPeople) { if (queryID == query) { if (matchedPeople.Count != 1) { Logger.Log("Unable to resolve master key from " + client.MasterName, Helpers.LogLevel.Warning); } else { client.MasterKey = matchedPeople[0].AgentID; Logger.Log("Master key resolved to " + client.MasterKey, Helpers.LogLevel.Info); } } }; client.Directory.OnDirPeopleReply += peopleDirCallback; client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, client.MasterName, 0, query); } Logger.Log("Logged in " + client.ToString(), Helpers.LogLevel.Info); } else { Logger.Log("Failed to login " + account.FirstName + " " + account.LastName + ": " + client.Network.LoginMessage, Helpers.LogLevel.Warning); } return client; }
/// <summary> /// /// </summary> /// <param name="args"></param> /// <returns></returns> public TestClient Login(string[] args, bool use3DiLogin) { if (args.Length < 3) { Console.WriteLine("Usage: login firstname lastname password [simname] [login server url]"); return null; } LoginDetails account = new LoginDetails(); account.FirstName = args[0]; account.LastName = args[1]; account.Password = args[2]; if (args.Length > 3) account.StartLocation = NetworkManager.StartLocation(args[3], 128, 128, 40); if (args.Length > 4) if(args[4].StartsWith("http://")) account.URI = args[4]; if (string.IsNullOrEmpty(account.URI)) account.URI = Program.LoginURI; Logger.Log("Using login URI " + account.URI, Helpers.LogLevel.Info); return Login(account, use3DiLogin); }
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; } } ++PendingLogins; TestClient client = new TestClient(this); client.Network.LoginProgress += delegate(object sender, LoginProgressEventArgs e) { Logger.Log(String.Format("Login {0}: {1}", e.Status, e.Message), Helpers.LogLevel.Info, client); if (e.Status == LoginStatus.Success) { Clients[client.Self.AgentID] = client; if (client.MasterKey == UUID.Zero) { UUID query = UUID.Zero; EventHandler <DirPeopleReplyEventArgs> peopleDirCallback = delegate(object sender2, DirPeopleReplyEventArgs dpe) { if (dpe.QueryID == query) { if (dpe.MatchedPeople.Count != 1) { Logger.Log("Unable to resolve master key from " + client.MasterName, Helpers.LogLevel.Warning); } else { client.MasterKey = dpe.MatchedPeople[0].AgentID; Logger.Log("Master key resolved to " + client.MasterKey, Helpers.LogLevel.Info); } } }; client.Directory.DirPeopleReply += peopleDirCallback; query = client.Directory.StartPeopleSearch(client.MasterName, 0); } Logger.Log("Logged in " + client.ToString(), Helpers.LogLevel.Info); client.Appearance.RequestSetAppearance(); --PendingLogins; } else if (e.Status == LoginStatus.Failed) { Logger.Log("Failed to login " + account.FirstName + " " + account.LastName + ": " + client.Network.LoginMessage, Helpers.LogLevel.Warning); --PendingLogins; } }; // 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; client.AllowObjectMaster = client.MasterKey != UUID.Zero; // Require UUID for object master. 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; } client.Network.BeginLogin(loginParams); return(client); }
static void Main(string[] args) { Arguments arguments = new Arguments(args); List <LoginDetails> accounts = new List <LoginDetails>(); LoginDetails account; bool groupCommands = false; string masterName = String.Empty; UUID masterKey = UUID.Zero; string file = String.Empty; bool getTextures = false; bool noGUI = false; // true if to not prompt for input string scriptFile = String.Empty; if (arguments["groupcommands"] != null) { groupCommands = true; } if (arguments["masterkey"] != null) { masterKey = UUID.Parse(arguments["masterkey"]); } if (arguments["master"] != null) { masterName = arguments["master"]; } if (arguments["loginuri"] != null) { LoginURI = arguments["loginuri"]; } if (String.IsNullOrEmpty(LoginURI)) { LoginURI = Settings.AGNI_LOGIN_SERVER; } Logger.Log("Using login URI " + LoginURI, Helpers.LogLevel.Info); if (arguments["gettextures"] != null) { getTextures = true; } if (arguments["nogui"] != null) { noGUI = true; } if (arguments["scriptfile"] != null) { scriptFile = arguments["scriptfile"]; if (!File.Exists(scriptFile)) { Logger.Log(String.Format("File {0} Does not exist", scriptFile), Helpers.LogLevel.Error); return; } } if (arguments["file"] != null) { file = arguments["file"]; if (!File.Exists(file)) { Logger.Log(String.Format("File {0} Does not exist", file), Helpers.LogLevel.Error); return; } // Loading names from a file try { using (StreamReader reader = new StreamReader(file)) { string line; int lineNumber = 0; while ((line = reader.ReadLine()) != null) { lineNumber++; string[] tokens = line.Trim().Split(new char[] { ' ', ',' }); if (tokens.Length >= 3) { account = new LoginDetails(); account.FirstName = tokens[0]; account.LastName = tokens[1]; account.Password = tokens[2]; if (tokens.Length >= 4) // Optional starting position { char sep = '/'; string[] startbits = tokens[3].Split(sep); account.StartLocation = NetworkManager.StartLocation(startbits[0], Int32.Parse(startbits[1]), Int32.Parse(startbits[2]), Int32.Parse(startbits[3])); } accounts.Add(account); } else { Logger.Log("Invalid data on line " + lineNumber + ", must be in the format of: FirstName LastName Password [Sim/StartX/StartY/StartZ]", Helpers.LogLevel.Warning); } } } } catch (Exception ex) { Logger.Log("Error reading from " + args[1], Helpers.LogLevel.Error, ex); return; } } else if (arguments["first"] != null && arguments["last"] != null && arguments["pass"] != null) { // Taking a single login off the command-line account = new LoginDetails(); account.FirstName = arguments["first"]; account.LastName = arguments["last"]; account.Password = arguments["pass"]; accounts.Add(account); } else if (arguments["help"] != null) { Usage(); return; } foreach (LoginDetails a in accounts) { a.GroupCommands = groupCommands; a.MasterName = masterName; a.MasterKey = masterKey; a.URI = LoginURI; if (arguments["startpos"] != null) { char sep = '/'; string[] startbits = arguments["startpos"].Split(sep); a.StartLocation = NetworkManager.StartLocation(startbits[0], Int32.Parse(startbits[1]), Int32.Parse(startbits[2]), Int32.Parse(startbits[3])); } } // Login the accounts and run the input loop ClientManager.Instance.Start(accounts, getTextures); if (!String.IsNullOrEmpty(scriptFile)) { ClientManager.Instance.DoCommandAll("script " + scriptFile, UUID.Zero); } // Then Run the ClientManager normally ClientManager.Instance.Run(noGUI); }
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; } } ++PendingLogins; TestClient client = new TestClient(this); client.Network.LoginProgress += delegate(object sender, LoginProgressEventArgs e) { Logger.Log(String.Format("Login {0}: {1}", e.Status, e.Message), Helpers.LogLevel.Info, client); if (e.Status == LoginStatus.Success) { Clients[client.Self.AgentID] = client; if (client.MasterKey == UUID.Zero) { UUID query = UUID.Zero; EventHandler<DirPeopleReplyEventArgs> peopleDirCallback = delegate(object sender2, DirPeopleReplyEventArgs dpe) { if (dpe.QueryID == query) { if (dpe.MatchedPeople.Count != 1) { Logger.Log("Unable to resolve master key from " + client.MasterName, Helpers.LogLevel.Warning); } else { client.MasterKey = dpe.MatchedPeople[0].AgentID; Logger.Log("Master key resolved to " + client.MasterKey, Helpers.LogLevel.Info); } } }; client.Directory.DirPeopleReply += peopleDirCallback; query = client.Directory.StartPeopleSearch(client.MasterName, 0); } Logger.Log("Logged in " + client.ToString(), Helpers.LogLevel.Info); --PendingLogins; } else if (e.Status == LoginStatus.Failed) { Logger.Log("Failed to login " + account.FirstName + " " + account.LastName + ": " + client.Network.LoginMessage, Helpers.LogLevel.Warning); --PendingLogins; } }; // 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; client.AllowObjectMaster = client.MasterKey != UUID.Zero; // Require UUID for object master. 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; client.Network.BeginLogin(loginParams); return client; }
/// <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; client.AllowObjectMaster = client.MasterKey != UUID.Zero; // Require UUID for object master. 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)) { Clients[client.Self.AgentID] = client; if (client.MasterKey == UUID.Zero) { UUID query = UUID.Random(); DirectoryManager.DirPeopleReplyCallback peopleDirCallback = delegate(UUID queryID, List <DirectoryManager.AgentSearchData> matchedPeople) { if (queryID == query) { if (matchedPeople.Count != 1) { Logger.Log("Unable to resolve master key from " + client.MasterName, Helpers.LogLevel.Warning); } else { client.MasterKey = matchedPeople[0].AgentID; Logger.Log("Master key resolved to " + client.MasterKey, Helpers.LogLevel.Info); } } }; client.Directory.OnDirPeopleReply += peopleDirCallback; client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, client.MasterName, 0, query); } Logger.Log("Logged in " + client.ToString(), Helpers.LogLevel.Info); } else { Logger.Log("Failed to login " + account.FirstName + " " + account.LastName + ": " + client.Network.LoginMessage, Helpers.LogLevel.Warning); } return(client); }
/// <summary> /// /// </summary> /// <param name="args"></param> /// <returns></returns> public TestClient Login(string[] args) { LoginDetails account = new LoginDetails(); account.FirstName = args[0]; account.LastName = args[1]; account.Password = args[2]; if (args.Length > 3) account.StartLocation = NetworkManager.StartLocation(args[3], 128, 128, 40); if (args.Length > 4) account.URI = args[4]; return Login(account); }