/// <summary>
            ///
            /// </summary>
            public void Stop()
            {
#if LOG4NET
                _Logger.Debug("Stop()");
#endif

#if LOG4NET
                _Logger.Debug("Stop(): aborting thread...");
#endif
                _Thread.Abort();
                // make sure we close the stream after the thread is gone, else
                // the thread will think the connection is broken!
#if LOG4NET
                _Logger.Debug("Stop(): joining thread...");
#endif
                _Thread.Join();

#if LOG4NET
                _Logger.Debug("Stop(): closing reader...");
#endif
                try {
                    _Connection._Reader.Close();
                } catch (ObjectDisposedException) {
                }
            }
Ejemplo n.º 2
0
        public override void InvokeReal()
        {
            target0.X = (float)target.X;
            target0.Y = (float)target.Y;

            RegCallback();
            SetMovement();
            //System.Threading.Thread.Sleep(100);

            //XYMovement();
            //ZMovement();
            //ClientMovement.SendUpdate(false);

            // start if not already started
            var bc = GetBotClient();

            if (!FollowThread.IsAlive)
            {
                try
                {
                    bc.AddThread(FollowThread);
                    FollowThread.Start();
                    FollowThread.Join();
                }
                finally
                {
                    bc.RemoveThread(FollowThread);
                    DeRegCallback();
                }
            }
        }
Ejemplo n.º 3
0
 public override void InvokeReal()
 {
     // start if not already started
     if (!FollowThread.IsAlive)
     {
         FollowThread.Start();
         FollowThread.Join();
     }
 }
Ejemplo n.º 4
0
 internal void DoWork()
 {
     WorkerThread = new Thread(DoWorkNow, 0)
     {
         Name = "Worker for " + GetName(),
     };
     WorkerThread.Start();
     if (!DoWorkInThread)
     {
         WorkerThread.Join();
     }
 }
            /// <summary>
            ///
            /// </summary>
            public void Stop()
            {
#if LOG4NET
                Logger.Connection.Debug("Stopping WriteThread...");
#endif

                _Thread.Abort();
                // make sure we close the stream after the thread is gone, else
                // the thread will think the connection is broken!
                _Thread.Join();

                try {
                    _Connection._Writer.Close();
                } catch (ObjectDisposedException) {
                }
            }
Ejemplo n.º 6
0
 /// <summary>
 /// runs in a STA thread (by creating one)  Does not "join"
 /// </summary>
 /// <param name="args"></param>
 public static void RunInThread(ApartmentState must, ThreadStart runMain, bool blocking)
 {
     if (!blocking || Thread.CurrentThread.ApartmentState != must)
     {
         Thread newThread = new Thread(runMain);
         newThread.SetApartmentState(must);
         newThread.Start();
         if (blocking)
         {
             newThread.Join();
         }
         return;
     }
     else
     {
         runMain();
     }
 }
Ejemplo n.º 7
0
        public void Dispose()
        {
            SaveCache(new object());

            if (client != null)
            {
                DeregisterEvents(client);
            }

            if (requestTimer != null)
            {
                requestTimer.Dispose();
                requestTimer = null;
            }

            if (cacheTimer != null)
            {
                cacheTimer.Dispose();
                cacheTimer = null;
            }

            try
            {
                if (useRequestThread)
                {
                    PendingLookups.Close();
                    if (requestThread != null)
                    {
                        if (!requestThread.Join(5 * 1000))
                        {
                            requestThread.Abort();
                        }
                        requestThread = null;
                    }
                }
            }
            catch { }
        }
Ejemplo n.º 8
0
        public static void RadegastMain(string[] args)
        {
            if (!ClientManagerConfig.UsingRadegastFromCogbot)
            {
                ClientManagerConfig.UsingCogbotFromRadegast = true;
                ClientManagerConfig.UsingRadegastFromCogbot = false;
            }
            // Increase the number of IOCP threads available. Mono defaults to a tragically low number
            args = SetAllCommandLineOptions(args);
            // Change current working directory to Radegast install dir
            if (ChangeLCD)
            {
                SetCurrentDirectory(typeof(RadegastInstance));
            }

            Thread t = ClientManager.InSTAThread(StartRadegast, "StartExtraRadegast");

            if (ClientManagerConfig.UsingCogbotFromRadegast)
            {
                t.Join();
            }
            //StartRadegast();
        }
Ejemplo n.º 9
0
 /// <summary>
 /// runs in a STA thread (by creating one)  Does not "join"
 /// </summary>
 /// <param name="args"></param>        
 public static void RunInThread(ApartmentState must, ThreadStart runMain, bool blocking)
 {
     if (!blocking || Thread.CurrentThread.ApartmentState != must)
     {
         Thread newThread = new Thread(runMain);
         newThread.SetApartmentState(must);
         newThread.Start();
         if (blocking) newThread.Join();
         return;
     }
     else
     {
         runMain();
     }
 }
Ejemplo n.º 10
0
 internal void DoWork()
 {
     WorkerThread = new Thread(DoWorkNow, 0)
                        {
                            Name = "Worker for " + GetName(),
                        };
     WorkerThread.Start();
     if (!DoWorkInThread) WorkerThread.Join();
 }