Exemplo n.º 1
0
        public void Login()
        {
            loggingIn = true;

            OverrideEventArgs ea = new OverrideEventArgs();
            OnClientLoggingIn(ea);

            if (ea.Cancel)
            {
                loggingIn = false;
                return;
            }

            if (string.IsNullOrEmpty(loginOptions.FirstName) ||
                string.IsNullOrEmpty(loginOptions.LastName) ||
                string.IsNullOrEmpty(loginOptions.Password))
            {
                OnClientLoginStatus(
                    new ClientLoginEventArgs(LoginStatus.Failed, "One or more fields are blank."));
            }

            string startLocation = string.Empty;

            switch (loginOptions.StartLocation)
            {
                case StartLocationType.Home: startLocation = "home"; break;
                case StartLocationType.Last: startLocation = "last"; break;

                case StartLocationType.Custom:
                    startLocation = loginOptions.StartLocationCustom.Trim();

                    StartLocationParser parser = new StartLocationParser(startLocation);
                    startLocation = NetworkManager.StartLocation(parser.Sim, parser.X, parser.Y, parser.Z);

                    break;
            }

            string password;

            if (loginOptions.IsPasswordMD5)
                password = loginOptions.Password;
            else
                password = Helpers.MD5(loginOptions.Password);

            LoginParams loginParams = client.Network.DefaultLoginParams(
                loginOptions.FirstName, loginOptions.LastName, password,
                loginOptions.UserAgent, loginOptions.Author);

            loginParams.Start = startLocation;

            switch (loginOptions.Grid)
            {
                case LoginGrid.MainGrid: client.Settings.LOGIN_SERVER = MainGridLogin; break;
                case LoginGrid.BetaGrid: client.Settings.LOGIN_SERVER = BetaGridLogin; break;
                case LoginGrid.Custom: client.Settings.LOGIN_SERVER = loginOptions.GridCustomLoginUri; break;
            }

            client.Network.BeginLogin(loginParams);
        }
Exemplo n.º 2
0
        public void Login()
        {
            try
            {
                loggingIn = true;

                LastExecStatus crashrep = instance.HadCrashed();

                loginOptions.CrashStatus = crashrep;

                instance.StartCrashRep();

                OverrideEventArgs ea = new OverrideEventArgs();
                OnClientLoggingIn(ea);

                if (ea.Cancel)
                {
                    loggingIn = false;
                    return;
                }

                if (string.IsNullOrEmpty(loginOptions.FirstName) ||
                    string.IsNullOrEmpty(loginOptions.LastName) ||
                    string.IsNullOrEmpty(loginOptions.Password))
                {
                    OnClientLoginStatus(
                        new LoginProgressEventArgs(LoginStatus.Failed, "One or more fields are blank.", string.Empty));
                }

                string startLocation = string.Empty;

                switch (loginOptions.StartLocation)
                {
                case StartLocationType.Home: startLocation = "home"; break;

                case StartLocationType.Last: startLocation = "last"; break;

                case StartLocationType.Custom:
                    startLocation = loginOptions.StartLocationCustom.Trim();

                    StartLocationParser parser = new StartLocationParser(startLocation);
                    startLocation = NetworkManager.StartLocation(parser.Sim, parser.X, parser.Y, parser.Z);

                    break;
                }

                string password;

                //if (loginOptions.IsPasswordMD5)
                //    password = loginOptions.Password;
                //else
                //    password = OpenMetaverse.Utils.MD5(loginOptions.Password);

                password = OpenMetaverse.Utils.MD5(loginOptions.Password);

                string[] agt = loginOptions.UserAgent.Split(' ');

                LoginParams loginParams = client.Network.DefaultLoginParams(
                    loginOptions.FirstName, loginOptions.LastName, password,
                    agt[0], loginOptions.UserAgent.Substring(9));

                loginParams.Start = startLocation;

                loginParams.AgreeToTos = true;
                loginParams.Channel    = "METAbolt";
                loginParams.Author     = loginOptions.Author;

                loginParams.MAC = GetMACAddress();
                //loginParams.MethodName = string.Empty;
                loginParams.Platform = System.Environment.OSVersion.VersionString;   // "Windows";
                //loginParams.ReadCritical = false;
                loginParams.Version = instance.METAbolt_Version;

                // V 0.9.1.6 change
                switch (loginOptions.Grid)
                {
                case LoginGrid.MainGrid: client.Settings.LOGIN_SERVER = MainGridLogin; loginParams.URI = MainGridLogin; break;

                case LoginGrid.BetaGrid: client.Settings.LOGIN_SERVER = BetaGridLogin; loginParams.URI = BetaGridLogin; break;

                case LoginGrid.Custom: client.Settings.LOGIN_SERVER = loginOptions.GridCustomLoginUri; loginParams.URI = loginOptions.GridCustomLoginUri; break;
                }

                client.Network.BeginLogin(loginParams);
            }
            catch (Exception ex)
            {
                Logger.Log("Connection to SL failed", Helpers.LogLevel.Warning, ex);
            }
        }
Exemplo n.º 3
0
        public void Login()
        {
            try
            {
                loggingIn = true;

                LastExecStatus crashrep = instance.HadCrashed();

                loginOptions.CrashStatus = crashrep;

                instance.StartCrashRep();

                OverrideEventArgs ea = new OverrideEventArgs();
                OnClientLoggingIn(ea);

                if (ea.Cancel)
                {
                    loggingIn = false;
                    return;
                }

                if (string.IsNullOrEmpty(loginOptions.FirstName) ||
                    string.IsNullOrEmpty(loginOptions.LastName) ||
                    string.IsNullOrEmpty(loginOptions.Password))
                {
                    OnClientLoginStatus(
                        new LoginProgressEventArgs(LoginStatus.Failed, "One or more fields are blank.", string.Empty));
                }

                string startLocation = string.Empty;

                switch (loginOptions.StartLocation)
                {
                    case StartLocationType.Home: startLocation = "home"; break;
                    case StartLocationType.Last: startLocation = "last"; break;

                    case StartLocationType.Custom:
                        startLocation = loginOptions.StartLocationCustom.Trim();

                        StartLocationParser parser = new StartLocationParser(startLocation);
                        startLocation = NetworkManager.StartLocation(parser.Sim, parser.X, parser.Y, parser.Z);

                        break;
                }

                string password;

                //if (loginOptions.IsPasswordMD5)
                //    password = loginOptions.Password;
                //else
                //    password = OpenMetaverse.Utils.MD5(loginOptions.Password);

                password = OpenMetaverse.Utils.MD5(loginOptions.Password);

                string[] agt = loginOptions.UserAgent.Split(' ');

                LoginParams loginParams = client.Network.DefaultLoginParams(
                    loginOptions.FirstName, loginOptions.LastName, password,
                    agt[0], loginOptions.UserAgent.Substring(9));

                loginParams.Start = startLocation;

                loginParams.AgreeToTos = true;
                loginParams.Channel = "METAbolt";
                loginParams.Author = loginOptions.Author;

                loginParams.MAC = GetMACAddress();
                //loginParams.MethodName = string.Empty;
                loginParams.Platform = System.Environment.OSVersion.VersionString;   // "Windows";
                //loginParams.ReadCritical = false;
                loginParams.Version = instance.METAbolt_Version;

                // V 0.9.1.6 change
                switch (loginOptions.Grid)
                {
                    case LoginGrid.MainGrid: client.Settings.LOGIN_SERVER = MainGridLogin; loginParams.URI = MainGridLogin; break;
                    case LoginGrid.BetaGrid: client.Settings.LOGIN_SERVER = BetaGridLogin; loginParams.URI = BetaGridLogin; break;
                    case LoginGrid.Custom: client.Settings.LOGIN_SERVER = loginOptions.GridCustomLoginUri; loginParams.URI = loginOptions.GridCustomLoginUri; break;
                }

                client.Network.BeginLogin(loginParams);
            }
            catch (Exception ex)
            {
                Logger.Log("Connection to SL failed", Helpers.LogLevel.Warning, ex);
            }
        }