コード例 #1
0
        /// <summary>
        /// Add a command to those which can be invoked from the console.
        /// </summary>
        /// <param name="module"></param>
        /// <param name="command"></param>
        /// <param name="help"></param>
        /// <param name="longhelp"></param>
        /// <param name="descriptivehelp"></param>
        /// <param name="fn"></param>
        public void AddCommand(string module, bool shared, string command,
                               string help, string longhelp, string descriptivehelp,
                               CommandDelegate fn)
        {
            string[] parts = Parser.Parse(command);

            Dictionary <string, Object> current = tree;

            foreach (string part in parts)
            {
                if (current.ContainsKey(part))
                {
                    if (current[part] is Dictionary <string, Object> )
                    {
                        current = (Dictionary <string, Object>)current[part];
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    current[part] = new Dictionary <string, Object>();
                    current       = (Dictionary <string, Object>)current[part];
                }
            }

            CommandInfo info;

            if (current.ContainsKey(String.Empty))
            {
                info = (CommandInfo)current[String.Empty];
                if (!info.shared && !info.fn.Contains(fn))
                {
                    info.fn.Add(fn);
                }

                return;
            }

            info                  = new CommandInfo();
            info.module           = module;
            info.shared           = shared;
            info.help_text        = help;
            info.long_help        = longhelp;
            info.descriptive_help = descriptivehelp;
            info.fn               = new List <CommandDelegate>();
            info.fn.Add(fn);
            current[String.Empty] = info;

            // Now add command to modules dictionary
            ThreadedClasses.RwLockedList <CommandInfo> commands = m_modulesCommands[module];
            commands.Add(info);
        }
コード例 #2
0
        public void AddRegion(Scene scene)
        {
            if (m_scene == null)
            {
                m_scene = scene;
            }

            m_scenes.Add(scene);
            scene.EventManager.OnNewClient += OnNewClient;
            m_Clients = new ThreadedClasses.RwLockedList<UUID>();
        }
コード例 #3
0
        public void AddRegion(Scene scene)
        {
            if (m_scene == null)
            {
                m_scene = scene;
            }

            m_scenes.Add(scene);
            scene.EventManager.OnNewClient += OnNewClient;
            m_Clients = new ThreadedClasses.RwLockedList <UUID>();
        }
コード例 #4
0
        public int AddListener(uint localID, UUID itemID, UUID hostID,
                               int channel, string name, UUID id, string msg,
                               int regexBitfield)
        {
            // do we already have a match on this particular filter event?
            List <ListenerInfo> coll = GetListeners(itemID, channel, name, id,
                                                    msg);

            if (coll.Count > 0)
            {
                // special case, called with same filter settings, return same
                // handle (2008-05-02, tested on 1.21.1 server, still holds)
                return(coll[0].GetHandle());
            }

            if (m_curlisteners < m_maxlisteners)
            {
                lock (m_listeners) /* serialize handle creation here */
                {
                    int newHandle = GetNewHandle(itemID);

                    if (newHandle > 0)
                    {
                        ListenerInfo li = new ListenerInfo(newHandle, localID,
                                                           itemID, hostID, channel, name, id, msg,
                                                           regexBitfield);


                        ThreadedClasses.RwLockedList <ListenerInfo> listeners =
                            m_listeners.GetOrAddIfNotExists(channel, delegate()
                        {
                            return(new ThreadedClasses.RwLockedList <ListenerInfo>());
                        });
                        listeners.Add(li);
                        Interlocked.Increment(ref m_curlisteners);

                        return(newHandle);
                    }
                }
            }
            return(-1);
        }
コード例 #5
0
        public void AddFromData(uint localID, UUID itemID, UUID hostID,
                                Object[] data)
        {
            int idx = 0;

            Object[] item           = new Object[6];
            int      dataItemLength = 6;

            while (idx < data.Length)
            {
                dataItemLength = (idx + 7 == data.Length || (idx + 7 < data.Length && data[idx + 7] is bool)) ? 7 : 6;
                item           = new Object[dataItemLength];
                Array.Copy(data, idx, item, 0, dataItemLength);

                ListenerInfo info =
                    ListenerInfo.FromData(localID, itemID, hostID, item);

                ThreadedClasses.RwLockedList <ListenerInfo> li = m_listeners.GetOrAddIfNotExists((int)item[2], delegate() { return(new ThreadedClasses.RwLockedList <ListenerInfo>()); });
                li.Add(info);

                idx += dataItemLength;
            }
        }
コード例 #6
0
        internal void ReplaceAttachment(AvatarAttachment attach)
        {
//            m_log.DebugFormat(
//                "[AVATAR APPEARANCE]: Replacing itemID={0}, assetID={1} at {2}",
//                attach.ItemID, attach.AssetID, attach.AttachPoint);

            ThreadedClasses.RwLockedList<AvatarAttachment> newList = new ThreadedClasses.RwLockedList<AvatarAttachment>();
            newList.Add(attach);
            m_attachments[attach.AttachPoint] = newList;
        }
コード例 #7
0
 public BSConstraintCollection(BulletWorld world)
 {
     m_world = world;
     m_constraints = new ThreadedClasses.RwLockedList<BSConstraint>();
 }
コード例 #8
0
 public BSConstraintCollection(BulletWorld world)
 {
     m_world       = world;
     m_constraints = new ThreadedClasses.RwLockedList <BSConstraint>();
 }