Пример #1
0
 public void Dispose()
 {
     lock (CommandsLoaded)
     {
         CommandsLoaded.ForEach(plug =>
         {
             try
             {
                 plug.Dispose();
             }
             catch (Exception) { }
         });
         CommandsLoaded.Clear();
     }
     lock (InterpretersLoaded)
     {
         InterpretersLoaded.ForEach(plug =>
         {
             try
             {
                 plug.Dispose();
             }
             catch (Exception) { }
         });
         InterpretersLoaded.Clear();
     }
     CommandsByName.Clear();
     _commandWorker.Abort();
     _commandWorker = null;
     CommandQueued  = null;
 }
            /// <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) {
                }
            }
Пример #3
0
 private void ExecuteCommand(string text)
 {
     lock (ExecuteCommandLock)
     {
         if (TodoThread != null)
         {
             TodoThread.Abort();
             TodoThread = null;
         }
         AIMLPadEditor edit = this;
         submitButton.Enabled = false;
         TodoThread           = new Thread(() =>
         {
             robot.AcceptInput(WriteLine, text, user, true,
                               RequestKind.CommandAndChatProcessor, true);
             if (InvokeRequired)
             {
                 Invoke(new ThreadStart(() =>
                 {
                     edit.PopulateRobotChange();
                     edit.PopulateUserChange();
                     submitButton.Enabled = true;
                     consoleInputText.SelectAll();
                 }));
             }
         });
         TodoThread.Start();
     }
 }
Пример #4
0
        internal void KillIt()
        {
            Thread w = WorkerThread;

            if (w != null && w.IsAlive)
            {
                w.Abort();
            }
        }
 public void Dispose()
 {
     thrJobQueue.Abort();
     lock (taskQueue)
     {
         taskQueue.Clear();
     }
     //TODO decide if we should do this here
     //  taskInterperter.Dispose();
     taskInterperter = null;
 }
Пример #6
0
 public override void Abort()
 {
     KeepFollowing = false;
     try
     {
         FollowThread.Abort();
     }
     catch (Exception)
     {
     }
 }
Пример #7
0
        public override void Abort()
        {
            var Client         = GetGridClient();
            var ClientMovement = Client.Self.Movement;

            DeRegCallback();
            TheBot.StopMoving();
            EndFlyto();
            ClientMovement.Fly = true;
            if (FollowThread.IsAlive)
            {
                FollowThread.Abort();
            }
        }
 public void closeTcpListener()
 {
     //    if (ns != null) ns.Close();
     //  if (tcp_client != null) tcp_client.Close();
     IsDisposing = true;
     if (thrSvr != null)
     {
         thrSvr.Abort();
     }
     if (tcp_socket != null)
     {
         tcp_socket.Stop();
     }
     // if (parent.thrJobQueue != null) parent.thrJobQueue.Abort();
 }
        public override void Dispose()
        {
            if (Instance.Client != null)
            {
                UnregisterClientEvents(Instance.Client);
            }

            lock (sounds)
            {
                foreach (var s in sounds)
                {
                    if (!s.Disposed)
                    {
                        s.Dispose();
                    }
                }
                sounds.Clear();
            }

            sounds = null;

            if (system != null)
            {
                Logger.Log("FMOD interface stopping", Helpers.LogLevel.Info);
                system.release();
                system = null;
            }

            if (listenerThread != null)
            {
                if (listenerThread.IsAlive)
                {
                    listenerThread.Abort();
                }
                listenerThread = null;
            }

            if (soundThread != null)
            {
                if (soundThread.IsAlive)
                {
                    soundThread.Abort();
                }
                soundThread = null;
            }

            base.Dispose();
        }
            /// <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) {
                }
            }
        public void Dispose()
        {
            if (InventoryUpdate != null)
            {
                if (InventoryUpdate.IsAlive)
                {
                    InventoryUpdate.Abort();
                }
                InventoryUpdate = null;
            }

            Inventory.InventoryObjectAdded   -= new EventHandler <InventoryObjectAddedEventArgs>(Inventory_InventoryObjectAdded);
            Inventory.InventoryObjectUpdated -= new EventHandler <InventoryObjectUpdatedEventArgs>(Inventory_InventoryObjectUpdated);
            Inventory.InventoryObjectRemoved -= new EventHandler <InventoryObjectRemovedEventArgs>(Inventory_InventoryObjectRemoved);

            client.Objects.ObjectUpdate     -= new EventHandler <PrimEventArgs>(Objects_AttachmentUpdate);
            client.Objects.KillObject       -= new EventHandler <KillObjectEventArgs>(Objects_KillObject);
            client.Appearance.AppearanceSet -= new EventHandler <AppearanceSetEventArgs>(Appearance_AppearanceSet);
        }
Пример #12
0
 public override void Abort()
 {
     if (avatarThinkerThread != null)
     {
         try
         {
             ///  avatarThinkerThread.Suspend();
             avatarThinkerThread.Abort();
             avatarThinkerThread = null;
         }
         catch (Exception)
         {
         }
     }
     if (IsControlling)
     {
         Actor.CurrentAction = null;
     }
 }
Пример #13
0
 public void Stop()
 {
     repeat = false;
     if (assetLoop != null)
     {
         try
         {
             if (assetLoop.IsAlive)
             {
                 assetLoop.Abort();
             }
         }
         catch (Exception)
         {
         }
         assetLoop = null;
     }
     ClientSelf.AnimationStop(AssetID, true);
 }
Пример #14
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 { }
        }
Пример #15
0
 public void Dispose()
 {
     MaintainCollisions = false;
     IsDisposing        = true;
     TrackPathsThread.Abort();
 }
Пример #16
0
        /// <summary>
        /// Start up the Voice service.
        /// </summary>
        public void Start()
        {
            // Start the background thread
            if (posThread != null && posThread.IsAlive)
            {
                posThread.Abort();
            }
            posThread              = new Thread(new ThreadStart(PositionThreadBody));
            posThread.Name         = "VoicePositionUpdate";
            posThread.IsBackground = true;
            posRestart             = new ManualResetEvent(false);
            posThread.Start();

            Client.Network.EventQueueRunning += new EventHandler <EventQueueRunningEventArgs>(Network_EventQueueRunning);

            // Connection events
            OnDaemonRunning +=
                new VoiceGateway.DaemonRunningCallback(connector_OnDaemonRunning);
            OnDaemonCouldntRun +=
                new VoiceGateway.DaemonCouldntRunCallback(connector_OnDaemonCouldntRun);
            OnConnectorCreateResponse +=
                new EventHandler <VoiceGateway.VoiceConnectorEventArgs>(connector_OnConnectorCreateResponse);
            OnDaemonConnected +=
                new DaemonConnectedCallback(connector_OnDaemonConnected);
            OnDaemonCouldntConnect +=
                new DaemonCouldntConnectCallback(connector_OnDaemonCouldntConnect);
            OnAuxAudioPropertiesEvent +=
                new EventHandler <AudioPropertiesEventArgs>(connector_OnAuxAudioPropertiesEvent);

            // Session events
            OnSessionStateChangeEvent +=
                new EventHandler <SessionStateChangeEventArgs>(connector_OnSessionStateChangeEvent);
            OnSessionAddedEvent +=
                new EventHandler <SessionAddedEventArgs>(connector_OnSessionAddedEvent);

            // Session Participants events
            OnSessionParticipantUpdatedEvent +=
                new EventHandler <ParticipantUpdatedEventArgs>(connector_OnSessionParticipantUpdatedEvent);
            OnSessionParticipantAddedEvent +=
                new EventHandler <ParticipantAddedEventArgs>(connector_OnSessionParticipantAddedEvent);

            // Device events
            OnAuxGetCaptureDevicesResponse +=
                new EventHandler <VoiceDevicesEventArgs>(connector_OnAuxGetCaptureDevicesResponse);
            OnAuxGetRenderDevicesResponse +=
                new EventHandler <VoiceDevicesEventArgs>(connector_OnAuxGetRenderDevicesResponse);

            // Generic status response
            OnVoiceResponse += new EventHandler <VoiceResponseEventArgs>(connector_OnVoiceResponse);

            // Account events
            OnAccountLoginResponse +=
                new EventHandler <VoiceAccountEventArgs>(connector_OnAccountLoginResponse);

            Logger.Log("Voice initialized", Helpers.LogLevel.Info);

            // If voice provisioning capability is already available,
            // proceed with voice startup.   Otherwise the EventQueueRunning
            // event will do it.
            System.Uri vCap =
                Client.Network.CurrentSim.Caps.CapabilityURI("ProvisionVoiceAccountRequest");
            if (vCap != null)
            {
                RequestVoiceProvision(vCap);
            }
        }
 /// <summary>
 ///
 /// </summary>
 public void Stop()
 {
     _Thread.Abort();
 }
        private void btnFolder_Click(object sender, EventArgs e)
        {
            openFileDialog1.CheckFileExists = false;
            DialogResult res = openFileDialog1.ShowDialog();

            traversed = 0;

            if (res == DialogResult.OK)
            {
                string dir = Path.GetDirectoryName(openFileDialog1.FileName);
                txtFolderName.Text = folderName = dir;
                btnFolder.Enabled  = false;

                lvwFiles.Items.Clear();

                if (cbList.Checked)
                {
                    try
                    {
                        csvFile = new StreamWriter(Path.Combine(dir, "inventory.csv"), false);
                        WriteCSVLine("Type", "Path", "Name", "Description", "Created", "Creator", "Last Owner");
                    }
                    catch
                    {
                        csvFile = null;
                    }
                }

                lblStatus.Text    = "Fetching items...";
                sbrProgress.Style = ProgressBarStyle.Marquee;
                fetched           = 0;

                if (backupThread != null)
                {
                    if (backupThread.IsAlive)
                    {
                        backupThread.Abort();
                    }
                    backupThread = null;
                }

                backupThread = new Thread(() =>
                {
                    TraverseDir(rootNode, Path.DirectorySeparatorChar.ToString());
                    if (csvFile != null)
                    {
                        try
                        {
                            csvFile.Close();
                            csvFile.Dispose();
                        }
                        catch
                        {
                        }
                    }

                    BeginInvoke(new MethodInvoker(() =>
                    {
                        lblStatus.Text    = $"Done ({fetched} items saved).";
                        sbrProgress.Style = ProgressBarStyle.Blocks;
                        btnFolder.Enabled = true;
                    }
                                                  ));
                })
                {
                    IsBackground = false, Name = "Inventory Backup"
                };

                backupThread.Start();
            }
        }