Beispiel #1
0
        static void RunMETAbolt(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 METAbolt 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 METAbolt instance
            METAboltInstance instance = METAboltInstance.GlobalInstance;

            Application.Run(instance.MainForm);
            OpenMetaverse.WorkPool.Shutdown();
        }
Beispiel #2
0
        static void RunRadegast(CommandLineOptions args)
        {
            s_CommandLineOpts = 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);
            }

            // Change current working directory to Radegast install dir
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
                                          ?? throw new InvalidOperationException());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // See if we only wanted to display list of grids
            if (s_CommandLineOpts.ListGrids)
            {
                Console.WriteLine(s_CommandLineOpts.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);
        }
Beispiel #3
0
        // Increase the number of IOCP threads available. Mono defaults to a tragically low number
        private static void ResizeThreadPools()
        {
            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);
            }
        }
Beispiel #4
0
        static void RunRadegast(CommandLineOptions args)
        {
            newOut.WriteEvent     += consoleWriter_WriteEvent;
            newOut.WriteLineEvent += consoleWriter_WriteLineEvent;
            Console.SetOut(newOut);

            //Console.SetOut(TextWriter.Null);

            // **

            Console.WriteLine("Running Radegast...");
            s_CommandLineOpts = 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);
            }

            // Change current working directory to Radegast install dir
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
                                          ?? throw new InvalidOperationException());

            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);

            // See if we only wanted to display list of grids
            if (s_CommandLineOpts.ListGrids)
            {
                Console.WriteLine(s_CommandLineOpts.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
            Console.WriteLine("Creating Radegast Instance...");
            RadegastInstance instance = RadegastInstance.GlobalInstance;

            if (s_CommandLineOpts.DisableLookAt)
            {
                Console.WriteLine("Disabling LookAt...");
                instance.GlobalSettings["disable_look_at"] = true; // Disable LookAt
            }
            if (s_CommandLineOpts.AutoReConnect)
            {
                Console.WriteLine("Enabling Auto Reconnect...");
                instance.GlobalSettings["auto_reconnect"] = true; // Enable Auto Reconnect
            }

            // Load Email Configuration
            EmailSender._smtpServer  = s_CommandLineOpts.EmailServer;
            EmailSender._smtpPort    = s_CommandLineOpts.EmailPort;
            EmailSender._smtpSsl     = s_CommandLineOpts.EmailSsl;
            EmailSender._user        = s_CommandLineOpts.EmailUsername;
            EmailSender._pass        = s_CommandLineOpts.EmailPassword;
            EmailSender._fromAddress = s_CommandLineOpts.EmailFrom;
            EmailSender._toAddress   = s_CommandLineOpts.EmailTo;

            Console.WriteLine("Running MainForm...");
            while (true)
            {
                Thread.Sleep(2000);
            }
            //Application.Run(instance.MainForm);
            //instance.MainForm = new frmMain(instance);
            //frmMain mf = instance.MainForm;
        }