コード例 #1
0
 public void RemoveSpawnPoint(uint index)
 {
     try
     {
         m_Spawnpoints.RemoveAt((int)index);
     }
     catch (IndexOutOfRangeException)
     {
         /* intentionally left empty */
     }
     TriggerSpawnpointUpdate();
 }
コード例 #2
0
ファイル: LocalConsole.cs プロジェクト: ft-/silversim-testing
        private void PromptThread()
        {
            Thread.CurrentThread.Name = "Local Console Input Thread";

            for ( ;;)
            {
                string consoleTitle;
                if (SelectedScene == UUID.Zero)
                {
                    CmdPrompt    = "(root) # ";
                    consoleTitle = m_ConsoleTitle + " # (root)";
                }
                else
                {
                    SceneInterface scene;
                    if (m_Scenes.TryGetValue(SelectedScene, out scene))
                    {
                        CmdPrompt    = scene.Name + " # ";
                        consoleTitle = m_ConsoleTitle + " # " + scene.Name;
                    }
                    else
                    {
                        CmdPrompt     = "(root) # ";
                        SelectedScene = UUID.Zero;
                        consoleTitle  = m_ConsoleTitle + " # (root)";
                    }
                }
                try
                {
                    System.Console.Title = consoleTitle;
                }
                catch
                {
                    /* no action required */
                }

                string cmd;
                try
                {
                    cmd = ReadLine(CmdPrompt, true);
                }
                catch (ThreadAbortException)
                {
                    SetCursorLeft(0);
                    m_CursorYPosition = SetCursorTop(m_CursorYPosition);

                    System.Console.WriteLine();

                    lock (m_CommandLineBuffer)
                    {
                        m_CursorYPosition = -1;
                    }
                    throw;
                }

                if (0 == cmd.Length)
                {
                    continue;
                }
                try
                {
                    System.Console.Title = consoleTitle + " $ " + cmd;
                }
                catch
                {
                    /* no action required */
                }

                if (m_CmdHistory.Count >= 100)
                {
                    m_CmdHistory.RemoveAt(0);
                }
                m_CmdHistory.Add(cmd);
                lock (m_InputThreadLock)
                {
                    try
                    {
                        m_Commands.ExecuteCommandString(cmd, this);
                    }
                    catch (Exception e)
                    {
                        m_Log.Error("Exception encountered during command execution", e);
                    }
                }
            }
        }