/************************************************************************************/
 protected static void ReleaseAllKeys()
 {
     foreach (string strThisKey in s_PressedKeys)
     {
         Program.Log("Releasing keyboard key: {0}", strThisKey);
         LavishScriptAPI.LavishScript.ExecuteCommand("press -release " + strThisKey);
     }
     s_PressedKeys.Clear();
     return;
 }
Пример #2
0
        public static void GetAllSets(this SetCollection sets)
        {
            WowDatabase wowDatabase = Engine.Instance.WowDatabase;

            uint setCount = wowDatabase.SetCount;

            sets.Clear();

            for (uint i = 0; i < setCount; ++i)
            {
                SEntry?r = wowDatabase.GetSet(i);
                if (r != null)
                {
                    sets.Add(new Set()
                    {
                        Name = r.Value.name, Id = r.Value.id
                    });
                }
            }
        }
Пример #3
0
        /***************************************************************************/
        /// <summary>
        /// This is the C# entry point for the thread.
        /// Its sole purpose is to invoke the virtual Run function.
        /// </summary>
        private void ThreadStartEntryPoint()
        {
            Exception exUnhandled = null;

            try
            {
                lock (s_GlobalDataLock)
                    s_ActiveThreadDictionary.Add(Thread.CurrentThread.ManagedThreadId, this);

                m_ThreadInactiveEvent.Reset();

                RegisterWaitHandle(m_QueueFilledEvent);

                Run();
            }

            /// All unhandled exceptions enter this block.
            catch (Exception e)
            {
                exUnhandled = e;
            }

            /// The special ThreadAbortException will always guarantee the execution of this finally-block.
            finally
            {
                lock (s_GlobalDataLock)
                    s_ActiveThreadDictionary.Remove(Thread.CurrentThread.ManagedThreadId);

                m_bAcceptNewMessages = false;
                m_ThreadInactiveEvent.Set();

                /// If this thread is dying because of an unhandled exception,
                /// then we NOW run the handler, once we're safe outside any locks.
                if (null != exUnhandled)
                {
                    /// Thread-safe eventing is bizarre.
                    /// For now I'll assume I won't have to copy the event list into a temp object
                    /// for safe synchronization (I can't figure out how to anyway).
                    /// http://blogs.msdn.com/jaybaz_ms/archive/2004/03/19/92787.aspx
                    /// http://blogs.msdn.com/jaybaz_ms/archive/2004/06/17/158636.aspx
                    try
                    {
                        lock (s_GlobalDataLock)
                            s_LastChanceExceptionHandler(this, exUnhandled);
                    }
                    catch
                    {
                        /// We intend to leave this thread without ANY further exceptions.
                    }
                }

                /// Gather any data from the thread, then sever the connection to the live object(s).
                /// This will allow this thread object to be restarted, which may or may not be convenient.
                lock (m_Lock)
                {
                    // Destroy all of the timers.
                    foreach (TimerDesc ThisTimerDesc in m_Timers.Values)
                    {
                        ThisTimerDesc.m_Timer.Stop();
                        ThisTimerDesc.m_Timer.Dispose();
                    }

                    m_Timers.Clear();
                    m_PulsedTimers.Clear();
                    m_Thread = null;
                    ClearMessageQueue();
                }
            }

            return;
        }