Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
Getting LoginServer Addresses issues
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Getting LoginServer Addresses issues

  1. #1

    Getting LoginServer Addresses issues

    I'm trying to get the login server adresses on a custom server

    Code:
            /// <summary>
            /// Gets this 
            /// </summary>
            /// <returns></returns>
            public IEnumerable<LoginServer> GetLoginServers()
            {
                for (uint i = Addresses.Client.LoginServerStart;
                    i < Addresses.Client.MaxLoginServers;
                    i += Addresses.Client.StepLoginServer)
                {
                    yield return new LoginServer(
                        Util.Memory.ReadString(Kernel.GetInstance().Client.ProcessHandle, i + 0),
                        Util.Memory.ReadInt16(Kernel.GetInstance().Client.ProcessHandle, i + Addresses.Client.DistancePort));
                }
            }
    Code:
            private void button1_Click(object sender, EventArgs e)
            {
                MessageBox.Show(GetLoginServers().ToString());
            }
    It's no returnning login servers
    Help me?

  2. #2
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Are you sure that the result ToString returns the expected value? I imagine it will return the type of IEnumerable<LoginServer>. Also, what are you doing with a Kernel object? This would surely be easier using a Process object? Just looks as if you're over complicating and not finding the results you want.

  3. #3
    Could you provide the ToString() implementation of LoginServer class?
    Last edited by szulak; 12-19-2013 at 03:58 PM.

  4. #4
    Senior Member
    Join Date
    Jan 2012
    Posts
    417
    1. As szulak pointed, you must override the ToString implementation within the LoginServer class in order to get a meaningful result of the ToString method
    2. You are using in a strange way your button click method, it should be called like:
      Code:
      private void button1_Click(object sender, EventArgs e)
      {
          foreach (LoginServer loginServer in GetLoginServers())
          {
              MessageBox.Show(loginServer.ToString());
          }
      }


    Disregard some errors in my code, I'm not coding it in a proper c# code editor

  5. #5
    Will try thanks for reply
    but now the message box don't apper

  6. #6
    Senior Member
    Join Date
    Jan 2012
    Posts
    417
    Quote Originally Posted by Tryller View Post
    Will try thanks for reply
    but now the message box don't apper
    then there isn't any element in the enumeration. It means the inner block of your for loop is not being executed, most likely due
    Addresses.Client.LoginServerStart > Addresses.Client.MaxLoginServers.

  7. #7
    i < Addresses.Client.MaxLoginServers

    to

    i < (Addresses.Client.LoginServerStart + (Addresses.Client.MaxLoginServers * Addresses.Client.StepLoginServer))

  8. #8
    Junior Member
    Join Date
    Jan 2014
    Posts
    10
    anyone can translate it to c++ / delphi ?
    thx

    what means in c++ / delphi?

    yield return new LoginServer(
    Util.Memory.ReadString(Kernel.GetInstance().Client .ProcessHandle, i + 0),
    Util.Memory.ReadInt16(Kernel.GetInstance().Client. ProcessHandle, i + Addresses.Client.DistancePort));
    Last edited by disney; 01-12-2014 at 05:51 PM.

  9. #9
    Senior Member
    Join Date
    Jan 2012
    Posts
    417
    I don't know if C++ or Delphi have a coroutine concept, but yield return X basically assigns X to the current iterator value

    Code:
    function getBlablabla()
      for (...)
        yield return X;
    end
    it was used to "build" a list and return the list like
    Code:
    function getBlablabla()
      var list = new List()
      for (...)
         list.add(X)
    
      return list
    end
    in pseudo-like code.

    PS: why are you trying to translate a [wrong] piece of code?

  10. #10
    Junior Member
    Join Date
    Jan 2014
    Posts
    10
    that code not working in c# ? ;/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •