Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        public TestClient(ClientManager manager)
        {
            ClientManager = manager;

            updateTimer = new System.Timers.Timer(500);
            updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed);

            RegisterAllCommands(Assembly.GetExecutingAssembly());

            Settings.LOG_LEVEL = Helpers.LogLevel.Debug;
            Settings.LOG_RESENDS = false;
            Settings.STORE_LAND_PATCHES = true;
            Settings.ALWAYS_DECODE_OBJECTS = true;
            Settings.ALWAYS_REQUEST_OBJECTS = true;
            Settings.SEND_AGENT_UPDATES = true;
            Settings.USE_ASSET_CACHE = true;

            Network.RegisterCallback(PacketType.AgentDataUpdate, AgentDataUpdateHandler);
            Network.LoginProgress += LoginHandler;
            Objects.AvatarUpdate += new EventHandler<AvatarUpdateEventArgs>(Objects_AvatarUpdate);
            Objects.TerseObjectUpdate += new EventHandler<TerseObjectUpdateEventArgs>(Objects_TerseObjectUpdate);
            Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged);
            Self.IM += Self_IM;
            Groups.GroupMembersReply += GroupMembersHandler;
            Inventory.InventoryObjectOffered += Inventory_OnInventoryObjectReceived;

            Network.RegisterCallback(PacketType.AvatarAppearance, AvatarAppearanceHandler);
            Network.RegisterCallback(PacketType.AlertMessage, AlertMessageHandler);

            VoiceManager = new VoiceManager(this);

            updateTimer.Start();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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;
            bool   getTextures   = false;
            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 (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, UUID.Zero);
            }

            // Then Run the ClientManager normally
            manager.Run();
        }
Esempio n. 5
-44
        /// <summary>
        /// 
        /// </summary>
        public TestClient(ClientManager manager)
        {
            ClientManager = manager;

            updateTimer = new System.Timers.Timer(500);
            updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed);

            RegisterAllCommands(Assembly.GetExecutingAssembly());

            Settings.LOG_LEVEL = Helpers.LogLevel.Debug;
            Settings.LOG_RESENDS = false;
            Settings.STORE_LAND_PATCHES = true;
            Settings.ALWAYS_DECODE_OBJECTS = true;
            Settings.ALWAYS_REQUEST_OBJECTS = true;
            Settings.SEND_AGENT_UPDATES = true;
            Settings.USE_ASSET_CACHE = true;

            Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));
            Network.OnLogin += new NetworkManager.LoginCallback(LoginHandler);
            Self.IM += Self_IM;
            Groups.GroupMembersReply += GroupMembersHandler;
            Inventory.OnObjectOffered += new InventoryManager.ObjectOfferedCallback(Inventory_OnInventoryObjectReceived);

            Network.RegisterCallback(PacketType.AvatarAppearance, new NetworkManager.PacketCallback(AvatarAppearanceHandler));
            Network.RegisterCallback(PacketType.AlertMessage, new NetworkManager.PacketCallback(AlertMessageHandler));

            VoiceManager = new VoiceManager(this);

            updateTimer.Start();
        }