public override CmdResult ExecuteRequest(CmdRequest args) { BotClient Client = TheBotClient; if (Client.IsLoggedInAndReady) return Success("Already logged in"); { string value; if (args.TryGetValue("first", out value)) { Client.BotLoginParams.FirstName = value; } if (args.TryGetValue("last", out value)) { Client.BotLoginParams.LastName = value; } if (args.TryGetValue("pass", out value)) { Client.BotLoginParams.Password = value; } if (args.TryGetValue("loginuri", out value)) { Radegast.GridManager gm = new GridManager(); gm.LoadGrids(); string url = value; string find = url.ToLower(); foreach (var grid in gm.Grids) { if (find == grid.Name.ToLower() || find == grid.ID.ToLower()) { url = grid.LoginURI; } } Client.BotLoginParams.URI = url; } if (args.TryGetValue("location", out value)) { Client.BotLoginParams.Start = value; } if (!Client.Network.Connected && !Client.Network.LoginMessage.StartsWith("Logging")) { Client.Settings.LOGIN_SERVER = TheBotClient.BotLoginParams.URI; // ClientManager.SingleInstance.config.simURL; // "http://127.0.0.1:8002/"; /// Client.Network.Login(Client.BotLoginParams.FirstName, Client.BotLoginParams.LastName, Client.BotLoginParams.Password, "OnRez", "UNR"); WriteLine("$bot beginning login"); Client.Login(); WriteLine("$bot started login"); } else return Success("$bot is already logged in."); } return Success("loging in..."); }
static void RunRadegast(string[] args) { // Increase the number of IOCP threads available. Mono defaults to a tragically low number int workerThreads, iocpThreads; ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); if (workerThreads < 500 || iocpThreads < 1000) { if (workerThreads < 500) workerThreads = 500; if (iocpThreads < 1000) iocpThreads = 1000; ThreadPool.SetMaxThreads(workerThreads, iocpThreads); } // Read command line options CommandLine = new CommandLine(); CommandLineParser parser = new CommandLineParser(new CommandLineParserSettings(Console.Error)); if (!parser.ParseArguments(args, CommandLine)) { Environment.Exit(1); } // Change current working directory to Radegast install dir Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // See if we only wanted to display list of grids if (CommandLine.ListGrids) { Console.WriteLine(CommandLine.GetHeader()); Console.WriteLine(); GridManager grids = new GridManager(); Console.WriteLine("Use Grid ID as the parameter for --grid"); Console.WriteLine("{0,-25} - {1}", "Grid ID", "Grid Name"); Console.WriteLine("========================================================"); for (int i = 0; i < grids.Count; i++) { Console.WriteLine("{0,-25} - {1}", grids[i].ID, grids[i].Name); } Environment.Exit(0); } // Create main Radegast instance RadegastInstance instance = RadegastInstance.GlobalInstance; Application.Run(instance.MainForm); OpenMetaverse.WorkPool.Shutdown(); }
public void CleanUp() { MarkEndExecution(); if (COF != null) { COF.Dispose(); COF = null; } if (names != null) { names.Dispose(); names = null; } if (gridManager != null) { gridManager.Dispose(); gridManager = null; } if (rlv != null) { rlv.Dispose(); rlv = null; } if (client != null) { UnregisterClientEvents(client); } if (pluginManager != null) { pluginManager.Dispose(); pluginManager = null; } if (movement != null) { movement.Dispose(); movement = null; } if (commandsManager != null) { commandsManager.Dispose(); commandsManager = null; } if (ContextActionManager != null) { ContextActionManager.Dispose(); ContextActionManager = null; } if (mediaManager != null) { mediaManager.Dispose(); mediaManager = null; } if (state != null) { state.Dispose(); state = null; } if (netcom != null) { netcom.Dispose(); netcom = null; } if (mainForm != null) { mainForm.Load -= new EventHandler(mainForm_Load); } Logger.Log("RadegastInstance finished cleaning up.", Helpers.LogLevel.Debug); }
public void BeginLogin() { Console.WriteLine("Beginning Login..."); //string username = cbxUsername.Text; string username = MainProgram.s_CommandLineOpts.Username; //if (cbxUsername.SelectedIndex > 0 && cbxUsername.SelectedItem is SavedLogin login) //{ //username = login.Username; //} string[] parts = System.Text.RegularExpressions.Regex.Split(username.Trim(), @"[. ]+"); if (parts.Length == 2) { netcom.LoginOptions.FirstName = parts[0]; netcom.LoginOptions.LastName = parts[1]; } else { netcom.LoginOptions.FirstName = username.Trim(); netcom.LoginOptions.LastName = "Resident"; } //netcom.LoginOptions.Password = txtPassword.Text; netcom.LoginOptions.Password = MainProgram.s_CommandLineOpts.Password; netcom.LoginOptions.Channel = Properties.Resources.ProgramName; // Channel netcom.LoginOptions.Version = Properties.Resources.RadegastTitle; // Version netcom.AgreeToTos = true; //netcom.LoginOptions.StartLocation = StartLocationType.Last; /* * switch (cbxLocation.SelectedIndex) * { * case -1: //Custom * netcom.LoginOptions.StartLocation = StartLocationType.Custom; * netcom.LoginOptions.StartLocationCustom = cbxLocation.Text; * break; * * case 0: //Home * netcom.LoginOptions.StartLocation = StartLocationType.Home; * break; * * case 1: //Last * netcom.LoginOptions.StartLocation = StartLocationType.Last; * break; * } */ // Setup login location either from the last used or // override from the command line if (string.IsNullOrEmpty(MainProgram.s_CommandLineOpts.Location)) { // Use last location as default netcom.LoginOptions.StartLocation = StartLocationType.Last; } else { netcom.LoginOptions.StartLocation = StartLocationType.Custom; netcom.LoginOptions.StartLocationCustom = MainProgram.s_CommandLineOpts.Location; } GridManager gm = new GridManager(); gm.LoadGrids(); netcom.LoginOptions.Grid = gm.Grids[0]; /* * if (cbxGrid.SelectedIndex == cbxGrid.Items.Count - 1) // custom login uri * { * if (txtCustomLoginUri.TextLength == 0 || txtCustomLoginUri.Text.Trim().Length == 0) * { * MessageBox.Show("You must specify the Login Uri to connect to a custom grid.", Properties.Resources.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error); * return; * } * * netcom.LoginOptions.Grid = new Grid("custom", "Custom", txtCustomLoginUri.Text); * netcom.LoginOptions.GridCustomLoginUri = txtCustomLoginUri.Text; * } * else * { * netcom.LoginOptions.Grid = cbxGrid.SelectedItem as Grid; * } */ Console.WriteLine("Will Login with Name: " + netcom.loginOptions.FullName); Console.WriteLine("Will Login To URI: " + netcom.LoginOptions.Grid.LoginURI); string startLocation = "Unknown"; if (netcom.LoginOptions.StartLocation == StartLocationType.Custom) { startLocation = netcom.LoginOptions.StartLocationCustom; } if (netcom.LoginOptions.StartLocation == StartLocationType.Last) { startLocation = "Last"; } if (netcom.LoginOptions.StartLocation == StartLocationType.Home) { startLocation = "Home"; } Console.WriteLine("Will Login To Region: " + startLocation); if (netcom.LoginOptions.Grid.Platform != "SecondLife") { instance.Client.Settings.MULTIPLE_SIMS = true; instance.Client.Settings.HTTP_INVENTORY = !instance.GlobalSettings["disable_http_inventory"]; } else { // UDP inventory is deprecated as of 2015-03-30 and no longer supported. // https://community.secondlife.com/t5/Second-Life-Server/Deploy-for-the-week-of-2015-03-30/td-p/2919194 instance.Client.Settings.HTTP_INVENTORY = true; } Console.WriteLine("Calling netcom.Login()..."); netcom.Login(); //SaveConfig(); }
static void RunRadegast(string[] args) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // Increase the number of IOCP threads available. Mono defaults to a tragically low number int workerThreads, iocpThreads; ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); if (workerThreads < 500 || iocpThreads < 1000) { if (workerThreads < 500) { workerThreads = 500; } if (iocpThreads < 1000) { iocpThreads = 1000; } ThreadPool.SetMaxThreads(workerThreads, iocpThreads); } // Read command line options CommandLine = new CommandLine(); CommandLineParser parser = new CommandLineParser(new CommandLineParserSettings(Console.Error)); if (!parser.ParseArguments(args, CommandLine)) { Environment.Exit(1); } // Change current working directory to Radegast install dir Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // See if we only wanted to display list of grids if (CommandLine.ListGrids) { Console.WriteLine(CommandLine.GetHeader()); Console.WriteLine(); GridManager grids = new GridManager(); Console.WriteLine("Use Grid ID as the parameter for --grid"); Console.WriteLine("{0,-25} - {1}", "Grid ID", "Grid Name"); Console.WriteLine("========================================================"); for (int i = 0; i < grids.Count; i++) { Console.WriteLine("{0,-25} - {1}", grids[i].ID, grids[i].Name); } Environment.Exit(0); } // Create main Radegast instance RadegastInstance instance = RadegastInstance.GlobalInstance; Application.Run(instance.MainForm); OpenMetaverse.WorkPool.Shutdown(); }