Exemple #1
0
        static void OnFrame(object sender, EventArgs e)
        {
            if (!_readyToStart)
            {
                return;
            }

            if (DateTime.Now.Subtract(_lastPulse).TotalSeconds < _pulsedelay)
            {
                return;
            }

            _lastPulse = DateTime.Now;

            // If the session is ready, then we are done :)
            if (_directEve.Session.IsReady)
            {
                Logging.Log("[Startup] We've successfully logged in");
                _done = true;
                return;
            }

            // We shouldn't get any window
            if (_directEve.Windows.Count != 0)
            {
                foreach (var window in _directEve.Windows)
                {
                    if (window.Name == "telecom")
                    {
                        Logging.Log("Questor: Closing telecom message...");
                        Logging.Log("Questor: Content of telecom window (HTML): [" + (window.Html ?? string.Empty).Replace("\n", "").Replace("\r", "") + "]");
                        window.Close();
                        continue;
                    }

                    // Modal windows must be closed
                    // But lets only close known modal windows
                    if (window.Name == "modal")
                    {
                        bool close = false;
                        if (!string.IsNullOrEmpty(window.Html))
                        {
                            // Server going down
                            close      |= window.Html.Contains("Please make sure your characters are out of harms way");
                            close      |= window.Html.Contains("The socket was closed");
                            close      |= window.Html.Contains("accepting connections");
                            close      |= window.Html.Contains("Could not connect");
                            close      |= window.Html.Contains("The specified proxy or server node");
                            close      |= window.Html.Contains("Starting up");
                            close      |= window.Html.Contains("Unable to connect to the selected server");
                            close      |= window.Html.Contains("Could not connect to the specified address");
                            close      |= window.Html.Contains("Connection Timeout");
                            close      |= window.Html.Contains("The cluster is not currently accepting connections");
                            close      |= window.Html.Contains("Your character is located within");
                            close      |= window.Html.Contains("The transport has not yet been connected");
                            close      |= window.Html.Contains("The user's connection has been usurped");
                            close      |= window.Html.Contains("The EVE cluster has reached its maximum user limit");
                            close      |= window.Html.Contains("The connection to the server was closed");
                            close      |= window.Html.Contains("The client's local session information is corrupt");
                            _pulsedelay = 60;
                        }

                        if (close)
                        {
                            Logging.Log("Questor: Closing modal window...");
                            Logging.Log("Questor: Content of modal window (HTML): [" + (window.Html ?? string.Empty).Replace("\n", "").Replace("\r", "") + "]");
                            window.Close();
                            continue;
                        }
                    }

                    if (string.IsNullOrEmpty(window.Html))
                    {
                        continue;
                    }

                    Logging.Log("[Startup] We've got an unexpected window, auto login halted.");
                    _done = true;
                    return;
                }
                return;
            }

            if (!string.IsNullOrEmpty(_scriptFile))
            {
                try
                {
                    // Replace this try block with the following once new DirectEve is pushed
                    // _directEve.RunScript(_scriptFile);

                    System.Reflection.MethodInfo info = _directEve.GetType().GetMethod("RunScript");

                    if (info == null)
                    {
                        Logging.Log("DirectEve.RunScript() doesn't exist.  Upgrade DirectEve.dll!");
                    }
                    else
                    {
                        Logging.Log(string.Format("Running {0}...", _scriptFile));
                        info.Invoke(_directEve, new Object[] { _scriptFile });
                    }
                }
                catch (System.Exception ex)
                {
                    Logging.Log(string.Format("Exception {0}...", ex.ToString()));
                    _done = true;
                }
                finally
                {
                    _scriptFile = null;
                }
                return;
            }

            if (_directEve.Login.AtLogin)
            {
                Logging.Log("[Startup] Login account [" + _username + "]");
                _directEve.Login.Login(_username, _password);
                _pulsedelay = 20;
                return;
            }

            if (_directEve.Login.AtCharacterSelection && _directEve.Login.IsCharacterSelectionReady)
            {
                foreach (var slot in _directEve.Login.CharacterSlots)
                {
                    if (slot.CharId.ToString() != _character && string.Compare(slot.CharName, _character, true) != 0)
                    {
                        continue;
                    }

                    Logging.Log("[Startup] Activating character [" + slot.CharName + "]");
                    slot.Activate();
                    return;
                }

                Logging.Log("[Startup] Character id/name [" + _character + "] not found, retrying in 10 seconds");
            }
        }
Exemple #2
0
        static void OnFrame(object sender, EventArgs e)
        {
            if (DateTime.Now.Subtract(_lastPulse).TotalSeconds < 10)
            {
                return;
            }
            _lastPulse = DateTime.Now;

            // If the session is ready, then we are done :)
            if (_directEve.Session.IsReady)
            {
                Logging.Log("We've successfully logged in");
                _done = true;
                return;
            }

            // We are not ready, lets wait
            if (_directEve.Login.IsConnecting || _directEve.Login.IsLoading)
            {
                return;
            }

            // Are we at the login or character selection screen?
            if (!_directEve.Login.AtLogin && !_directEve.Login.AtCharacterSelection)
            {
                return;
            }

            // We shouldn't get any window
            if (_directEve.Windows.Count != 0)
            {
                foreach (var window in _directEve.Windows)
                {
                    if (string.IsNullOrEmpty(window.Html))
                    {
                        continue;
                    }

                    if (window.Html.Contains("Please make sure your characters are out of harms way"))
                    {
                        continue;
                    }

                    if (window.Name == "telecom")
                    {
                        continue;
                    }

                    Logging.Log("We've got an unexpected window, auto login halted.");
                    _done = true;
                    return;
                }
            }

            if (!string.IsNullOrEmpty(_scriptFile))
            {
                try
                {
                    // Replace this try block with the following once new DirectEve is pushed
                    // _directEve.RunScript(_scriptFile);

                    System.Reflection.MethodInfo info = _directEve.GetType().GetMethod("RunScript");

                    if (info == null)
                    {
                        Logging.Log("DirectEve.RunScript() doesn't exist.  Upgrade DirectEve.dll!");
                    }
                    else
                    {
                        Logging.Log(string.Format("Running {0}...", _scriptFile));
                        info.Invoke(_directEve, new Object[] { _scriptFile });
                    }
                }
                catch (System.Exception ex)
                {
                    Logging.Log(string.Format("Exception {0}...", ex.ToString()));
                    _done = true;
                }
                finally
                {
                    _scriptFile = null;
                }
                return;
            }

            if (_directEve.Login.AtLogin)
            {
                Logging.Log("Login account [" + _username + "]");
                _directEve.Login.Login(_username, _password);
                return;
            }

            if (_directEve.Login.AtCharacterSelection && _directEve.Login.IsCharacterSelectionReady)
            {
                foreach (var slot in _directEve.Login.CharacterSlots)
                {
                    if (slot.CharId.ToString() != _character && string.Compare(slot.CharName, _character, true) != 0)
                    {
                        continue;
                    }

                    Logging.Log("Activating character [" + slot.CharName + "]");
                    slot.Activate();
                    return;
                }

                Logging.Log("Character id/name [" + _character + "] not found, retrying in 3 seconds");
            }
        }
Exemple #3
0
        static void OnFrame(object sender, EventArgs e)
        {
            if (!_readyToStart)
            {
                return;
            }

            if (_chantlingScheduler && !string.IsNullOrEmpty(_character) && !_readyToStarta)
            {
                return;
            }

            if (DateTime.Now.Subtract(_lastPulse).TotalSeconds < _pulsedelay)
            {
                return;
            }

            _lastPulse = DateTime.Now;

            // If the session is ready, then we are done :)
            if (_directEve.Session.IsReady)
            {
                Logging.Log("[Startup] We've successfully logged in");
                _done = true;
                return;
            }

            // We shouldn't get any window
            if (_directEve.Windows.Count != 0)
            {
                foreach (var window in _directEve.Windows)
                {
                    if (string.IsNullOrEmpty(window.Html))
                    {
                        continue;
                    }
                    Logging.Log("[Startup] windowtitles:" + window.Name + "::" + window.Html);
                    //
                    // Close these windows and continue
                    //
                    if (window.Name == "telecom")
                    {
                        Logging.Log("Questor: Closing telecom message...");
                        Logging.Log("Questor: Content of telecom window (HTML): [" + (window.Html ?? string.Empty).Replace("\n", "").Replace("\r", "") + "]");
                        window.Close();
                        continue;
                    }

                    // Modal windows must be closed
                    // But lets only close known modal windows
                    if (window.Name == "modal")
                    {
                        bool close   = false;
                        bool restart = false;
                        if (!string.IsNullOrEmpty(window.Html))
                        {
                            // Server going down
                            //Logging.Log("[Startup] (1) close is: " + close);
                            close |= window.Html.Contains("Please make sure your characters are out of harms way");
                            close |= window.Html.Contains("The socket was closed");
                            close |= window.Html.Contains("accepting connections");
                            close |= window.Html.Contains("Could not connect");
                            close |= window.Html.Contains("The connection to the server was closed");
                            close |= window.Html.Contains("server was closed");
                            close |= window.Html.Contains("Unable to connect to the selected server. Please check the address and try again.");
                            close |= window.Html.Contains("make sure your characters are out of harm");
                            close |= window.Html.Contains("Connection to server lost");
                            close |= window.Html.Contains("The socket was closed");
                            close |= window.Html.Contains("The specified proxy or server node");
                            close |= window.Html.Contains("Starting up");
                            close |= window.Html.Contains("Unable to connect to the selected server");
                            close |= window.Html.Contains("Could not connect to the specified address");
                            close |= window.Html.Contains("Connection Timeout");
                            close |= window.Html.Contains("The cluster is not currently accepting connections");
                            close |= window.Html.Contains("Your character is located within");
                            close |= window.Html.Contains("The transport has not yet been connected");
                            close |= window.Html.Contains("The user's connection has been usurped");
                            close |= window.Html.Contains("The EVE cluster has reached its maximum user limit");
                            close |= window.Html.Contains("The connection to the server was closed");
                            //close |= window.Html.Contains("A client update is avilable and will now be installed");
                            //
                            // eventually it would be nice to hit ok on this one and let it update
                            //
                            close |= window.Html.StartsWith("<html><body>A client update is available and will now be installed.");
                            close |= window.Html.Contains("You are on a <b>14 day trial</b>.");
                            //
                            // these windows require a quit of eve all together
                            //
                            close |= window.Html.Contains("The connection was closed");
                            close |= window.Html.Contains("Connection to server lost."); //INFORMATION
                            close |= window.Html.Contains("Connection to server lost");  //INFORMATION
                            close |= window.Html.Contains("Local cache is corrupt");
                            close |= window.Html.Contains("Local session information is corrupt");
                            close |= window.Html.Contains("The client's local session"); // information is corrupt");

                            //Logging.Log("[Startup] (2) close is: " + close);
                            //Logging.Log("[Startup] (1) window.Html is: " + window.Html);
                            _pulsedelay = 60;
                        }

                        if (close)
                        {
                            Logging.Log("Questor: Closing modal window...");
                            Logging.Log("Questor: Content of modal window (HTML): [" + (window.Html ?? string.Empty).Replace("\n", "").Replace("\r", "") + "]");
                            window.Close();
                            continue;
                        }
                        if (restart)
                        {
                            Logging.Log("Startup: Restarting eve...");
                            Logging.Log("Startup: Content of modal window (HTML): [" + (window.Html ?? string.Empty).Replace("\n", "").Replace("\r", "") + "]");
                            Cache.Instance.DirectEve.ExecuteCommand(DirectCmd.CmdQuitGame);
                            continue;
                        }
                    }

                    if (string.IsNullOrEmpty(window.Html))
                    {
                        continue;
                    }
                    if (window.Name == "telecom")
                    {
                        continue;
                    }
                    Logging.Log("[Startup] We've got an unexpected window, auto login halted.");
                    Logging.Log("[Startup] window.Name is: " + window.Name);
                    Logging.Log("[Startup] window.Caption is: " + window.Caption);
                    Logging.Log("[Startup] window.ID is: " + window.Id);
                    Logging.Log("[Startup] window.Html is: " + window.Html);
                    _done = true;
                    return;
                }
                return;
            }

            if (!string.IsNullOrEmpty(_scriptFile))
            {
                try
                {
                    // Replace this try block with the following once new DirectEve is pushed
                    // _directEve.RunScript(_scriptFile);

                    System.Reflection.MethodInfo info = _directEve.GetType().GetMethod("RunScript");

                    if (info == null)
                    {
                        Logging.Log("DirectEve.RunScript() doesn't exist.  Upgrade DirectEve.dll!");
                    }
                    else
                    {
                        Logging.Log(string.Format("Running {0}...", _scriptFile));
                        info.Invoke(_directEve, new Object[] { _scriptFile });
                    }
                }
                catch (System.Exception ex)
                {
                    Logging.Log(string.Format("Exception {0}...", ex.ToString()));
                    _done = true;
                }
                finally
                {
                    _scriptFile = null;
                }
                return;
            }

            if (_directEve.Login.AtLogin)
            {
                if (DateTime.Now.Subtract(AppStarted).TotalSeconds > 10)
                {
                    Logging.Log("[Startup] Login account [" + _username + "]");
                    _directEve.Login.Login(_username, _password);
                    Logging.Log("[Startup] Waiting for Character Selection Screen");
                    _pulsedelay = (int)Time.QuestorBeforeLoginPulseDelay_milliseconds;
                    return;
                }
            }

            if (_directEve.Login.AtCharacterSelection && _directEve.Login.IsCharacterSelectionReady)
            {
                foreach (var slot in _directEve.Login.CharacterSlots)
                {
                    if (slot.CharId.ToString() != _character && string.Compare(slot.CharName, _character, true) != 0)
                    {
                        continue;
                    }

                    Logging.Log("[Startup] Activating character [" + slot.CharName + "]");
                    slot.Activate();
                    return;
                }

                Logging.Log("[Startup] Character id/name [" + _character + "] not found, retrying in 10 seconds");
            }
        }