FromData() public static method

public static FromData ( uint localID, UUID ItemID, UUID hostID, Object data ) : ListenerInfo
localID uint
ItemID UUID
hostID UUID
data Object
return ListenerInfo
Beispiel #1
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);

                m_ListenerRwLock.AcquireWriterLock(-1);
                try
                {
                    if (!m_listeners.ContainsKey((int)item[2]))
                    {
                        m_listeners.Add((int)item[2],
                                        new List <ListenerInfo>());
                    }
                    m_listeners[(int)item[2]].Add(info);
                }
                finally
                {
                    m_ListenerRwLock.ReleaseWriterLock();
                }

                idx += dataItemLength;
            }
        }
Beispiel #2
0
        public void AddFromData(uint localID, UUID itemID, UUID hostID,
                                Object[] data)
        {
            int idx = 0;

            Object[] item = new Object[6];

            while (idx < data.Length)
            {
                Array.Copy(data, idx, item, 0, 6);

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

                lock (m_listeners)
                {
                    if (!m_listeners.ContainsKey((int)item[2]))
                    {
                        m_listeners.Add((int)item[2], new List <ListenerInfo>());
                    }
                    m_listeners[(int)item[2]].Add(info);
                }

                idx += 6;
            }
        }
        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);

                lock (mainLock)
                {
                    if (!m_listenersByChannel.ContainsKey((int)item[2]))
                    {
                        m_listenersByChannel.Add((int)item[2], new List <ListenerInfo>());
                    }
                    m_listenersByChannel[(int)item[2]].Add(info);
                }

                idx += dataItemLength;
            }
        }
Beispiel #4
0
        public void AddFromData(UUID itemID, UUID hostID,
                                OSD data)
        {
            OSDMap save = (OSDMap)data;

            foreach (KeyValuePair <string, OSD> kvp in save)
            {
                OSDMap       item = (OSDMap)kvp.Value;
                ListenerInfo info = ListenerInfo.FromData(itemID, hostID, item);
                AddListener(info.GetItemID(), info.GetHostID(), info.GetChannel(), info.GetName(), info.GetID(), info.GetMessage());
            }
        }
        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;
            }
        }