Пример #1
0
 public static void Authentication(Forms.Authentication auth, string username, string password, string hwid)
 {
     Worker.instance.Send(
         pack.Serialize(
             (int)PacketHeader.Authentication,
             username,
             password,
             hwid
             )
         );
 }
Пример #2
0
        public Worker()
        {
            running = true;

            /**
             * Make the worker instance globally available.
             */
            instance = this;

            /**
             * Setup the context.
             */
            context = new ApplicationContext();

            /**
             * Initialize the client.
             */
            client = new UserClient();

            /**
             * Register events.
             */
            client.ExceptionThrown += Events.Client_ExceptionThrown;
            client.ReadPacket      += Events.Client_ReadPacket;
            client.StateChanged    += Events.Client_StateChanged;
            client.WritePacket     += Events.Client_WritePacket;;

            /**
             * Connect to the server.
             */
            client.Connect(Config.host, Config.port);

            /**
             * Show the authentication form.
             */
            auth = new Forms.Authentication(this);
            auth.Show();

#if DEBUG
            /**
             * Show the debugging form.
             */
            new Forms.Debug().Show();
#endif
        }