Beispiel #1
0
        public override void Send(ListenEvent ev)
        {
            if (!string.IsNullOrEmpty(m_Name) &&
                ev.Name != m_Name)
            {
                return;
            }
            if (m_ID != UUID.Zero)
            {
                if (m_ID.Equals(UUID.Zero))
                {
                    /* expected ID matches UUID.Zero, so we want to receive every possible UUID */
                }
                else if (!m_ID.Equals(ev.ID))
                {
                    return;
                }
            }
            if (!string.IsNullOrEmpty(m_Message) &&
                ev.Message != m_Message)
            {
                return;
            }

            if (IsActive)
            {
                m_Send(ev);
            }
        }
Beispiel #2
0
 /// <inheritdoc />
 public UUID OtherEnd(UUID n)
 {
     if (!n.Equals(To.ID) && !n.Equals(From.ID))
     {
         throw new Exception("Cannot return other end. Parameter 'node' must be connected to link.");
     }
     return(From.ID.Equals(n) ? To.ID : From.ID);
 }
        private bool IsLocal(UUID groupID, out string serviceLocation, out string name)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            serviceLocation = string.Empty;
            name            = string.Empty;
            if (groupID.Equals(UUID.Zero))
            {
                return(true);
            }

            ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty);

            if (group == null)
            {
                //m_log.DebugFormat("[XXX]: IsLocal? group {0} not found -- no.", groupID);
                return(false);
            }

            serviceLocation = group.ServiceLocation;
            name            = group.GroupName;
            bool isLocal = (group.ServiceLocation == string.Empty);

            //m_log.DebugFormat("[XXX]: IsLocal? {0}", isLocal);
            return(isLocal);
        }
Beispiel #4
0
        // Theres probably a more clever and efficient way to
        // do this, maybe with regex.
        // PM2008: Ha, one could even be smart and define a specialized Enumerator.
        public List <ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg)
        {
            List <ListenerInfo> collection = new List <ListenerInfo>();

            lock (m_listeners)
            {
                List <ListenerInfo> listeners;
                if (!m_listeners.TryGetValue(channel, out listeners))
                {
                    return(collection);
                }

                collection.AddRange(from li in listeners
                                    where li.IsActive()
                                    where itemID.Equals(UUID.Zero) || li.GetItemID().Equals(itemID)
                                    where li.GetName().Length <= 0 || li.GetName().Equals(name)
                                    where li.GetName().Length <= 0 || ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) != OS_LISTEN_REGEX_NAME && li.GetName().Equals(name)) ||
                                    ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) == OS_LISTEN_REGEX_NAME && Regex.IsMatch(name, li.GetName()))
                                    where li.GetMessage().Length <= 0 || ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) != OS_LISTEN_REGEX_MESSAGE && li.GetMessage().Equals(msg)) ||
                                    ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) == OS_LISTEN_REGEX_MESSAGE && Regex.IsMatch(msg, li.GetMessage()))
                                    where li.GetID().Equals(UUID.Zero) || li.GetID().Equals(id)
                                    where li.GetMessage().Length <= 0 || li.GetMessage().Equals(msg)
                                    select li);
            }
            return(collection);
        }
Beispiel #5
0
    public bool Equals(Beacon other)
    {
        if (other == null)
        {
            return(false);
        }

        if (type != other.type)
        {
            return(false);
        }

        switch (type)
        {
        case BeaconType.iBeacon:
            return(UUID.Equals(other.UUID) && major.Equals(other.major) && minor.Equals(other.minor));

        case BeaconType.EddystoneUID:
            return(UUID.Equals(other.UUID) && instance.Equals(other.instance));

        case BeaconType.EddystoneURL:
            return(UUID.Equals(other.UUID));
        }

        return(base.Equals(other));
    }
Beispiel #6
0
        protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
        {
            first = "Unknown"; last = "UserHGGAI";
            if (base.GetAgentInfo(scopeID, fid, out agentID, out first, out last))
            {
                return(true);
            }

            // fid is not a UUID...
            string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty;

            if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp))
            {
                if (!agentID.Equals(UUID.Zero))
                {
                    m_uMan.AddUser(agentID, f, l, url);

                    string   name  = m_uMan.GetUserName(agentID);
                    string[] parts = name.Trim().Split(new char[] { ' ' });
                    if (parts.Length == 2)
                    {
                        first = parts[0];
                        last  = parts[1];
                    }
                    else
                    {
                        first = f;
                        last  = l;
                    }
                    return(true);
                }
            }
            return(false);
        }
Beispiel #7
0
        ///////////////////////////////////////////////////////////////////////////
        //    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
        ///////////////////////////////////////////////////////////////////////////
        /// <summary>
        ///     Resolves a region UUID to a region handle.
        /// </summary>
        /// <param name="Client">the OpenMetaverse grid client</param>
        /// <param name="regionUUID">the UUID of the region</param>
        /// <param name="millisecondsTimeout">timeout for the search in milliseconds</param>
        /// <param name="regionHandle">the found region handle</param>
        /// <returns>true if the region UUID could be resolved</returns>
        private static bool directRegionUUIDToHandle(GridClient Client, UUID regionUUID, uint millisecondsTimeout,
                                                     ref ulong regionHandle)
        {
            if (regionUUID.Equals(UUID.Zero))
            {
                return(false);
            }
            var   GridRegionEvent   = new ManualResetEventSlim(false);
            ulong localRegionHandle = 0;
            EventHandler <RegionHandleReplyEventArgs> GridRegionEventHandler =
                (sender, args) =>
            {
                localRegionHandle = args.RegionHandle;
                GridRegionEvent.Set();
            };

            Client.Grid.RegionHandleReply += GridRegionEventHandler;
            Client.Grid.RequestRegionHandle(regionUUID);
            if (!GridRegionEvent.Wait((int)millisecondsTimeout))
            {
                Client.Grid.RegionHandleReply -= GridRegionEventHandler;
                return(false);
            }
            Client.Grid.RegionHandleReply -= GridRegionEventHandler;
            if (!localRegionHandle.Equals(0))
            {
                regionHandle = localRegionHandle;
                return(true);
            }
            return(false);
        }
Beispiel #8
0
        ///////////////////////////////////////////////////////////////////////////
        //    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
        ///////////////////////////////////////////////////////////////////////////
        /// <summary>
        ///     Resolves an agent UUID to an agent name.
        /// </summary>
        /// <param name="Client">the OpenMetaverse grid client</param>
        /// <param name="AgentUUID">the UUID of the agent</param>
        /// <param name="millisecondsTimeout">timeout for the search in milliseconds</param>
        /// <param name="AgentName">an object to store the name of the agent in</param>
        /// <returns>true if the UUID could be resolved to a name</returns>
        private static bool directAgentUUIDToName(GridClient Client, UUID AgentUUID, uint millisecondsTimeout,
                                                  ref string AgentName)
        {
            if (AgentUUID.Equals(UUID.Zero))
            {
                return(false);
            }
            var agentName          = string.Empty;
            var UUIDNameReplyEvent = new ManualResetEventSlim(false);
            EventHandler <UUIDNameReplyEventArgs> UUIDNameReplyDelegate = (sender, args) =>
            {
                args.Names.TryGetValue(AgentUUID, out agentName);
                UUIDNameReplyEvent.Set();
            };

            Client.Avatars.UUIDNameReply += UUIDNameReplyDelegate;
            Client.Avatars.RequestAvatarName(AgentUUID);
            if (!UUIDNameReplyEvent.Wait((int)millisecondsTimeout))
            {
                Client.Avatars.UUIDNameReply -= UUIDNameReplyDelegate;
                return(false);
            }
            Client.Avatars.UUIDNameReply -= UUIDNameReplyDelegate;
            if (!string.IsNullOrEmpty(agentName))
            {
                AgentName = agentName;
                return(true);
            }
            return(false);
        }
Beispiel #9
0
        ///
        /// RezObject
        ///
        public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
                                                   UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
                                                   bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
        {
            //m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID);

            if (fromTaskID.Equals(UUID.Zero))
            {
                CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
                if (userInfo != null)
                {
                    if (userInfo.RootFolder != null)
                    {
                        InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
                        if (item == null)
                        { // Fetch the item
                            item       = new InventoryItemBase();
                            item.Owner = remoteClient.AgentId;
                            item.ID    = itemID;
                            item       = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
                        }
                        if (item != null)
                        {
                            m_assMapper.Get(item.AssetID, remoteClient.AgentId);
                        }
                    }
                }
            }

            // OK, we're done fetching. Pass it up to the default RezObject
            return(base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
                                  RezSelected, RemoveItem, fromTaskID, attachment));
        }
        public override void Send(ListenEvent ev)
        {
            if (m_Name != null)
            {
                if ((m_RegexBitfield & 1) != 0)
                {
                    if (!m_Name.IsMatch(ev.Name))
                    {
                        return;
                    }
                }
                else if (m_NamePlain != ev.Name)
                {
                    return;
                }
            }
            if (m_ID != UUID.Zero)
            {
                if (m_ID.Equals(UUID.Zero))
                {
                    /* expected ID matches UUID.Zero, so we want to receive every possible UUID */
                }
                else if (!m_ID.Equals(ev.ID))
                {
                    return;
                }
            }
            if (m_Message != null)
            {
                if ((m_RegexBitfield & 2) != 0)
                {
                    if (!m_Message.IsMatch(ev.Message))
                    {
                        return;
                    }
                }
                else if (m_MessagePlain != ev.Message)
                {
                    return;
                }
            }

            if (IsActive)
            {
                m_Send(ev);
            }
        }
Beispiel #11
0
 public static bool UpdateRegion(UUID regionUUID, string name)
 {
     return(!string.IsNullOrEmpty(name) && !regionUUID.Equals(UUID.Zero) && UpdateRegion(new Region
     {
         Name = name,
         UUID = regionUUID
     }));
 }
Beispiel #12
0
 public static bool AddGroup(string GroupName, UUID GroupUUID)
 {
     return(!string.IsNullOrEmpty(GroupName) && !GroupUUID.Equals(UUID.Zero) && AddGroup(new Group
     {
         Name = GroupName,
         UUID = GroupUUID
     }));
 }
Beispiel #13
0
 public static bool UpdateRegion(UUID regionUUID, ulong regionHandle)
 {
     return(!regionHandle.Equals(0) && !regionUUID.Equals(UUID.Zero) && UpdateRegion(new Region
     {
         Handle = regionHandle,
         UUID = regionUUID
     }));
 }
Beispiel #14
0
 /// <summary>
 /// Define equality as two regions having the same, non-zero UUID.
 /// </summary>
 public bool Equals(GridRegion region)
 {
     if ((object)region == null)
     {
         return(false);
     }
     // Return true if the non-zero UUIDs are equal:
     return((RegionID != UUID.Zero) && RegionID.Equals(region.RegionID));
 }
Beispiel #15
0
 public static bool AddMute(MuteFlags flags, UUID uuid, string name, MuteType type)
 {
     return(!uuid.Equals(UUID.Zero) && !string.IsNullOrEmpty(name) && AddMute(new MuteEntry
     {
         Flags = flags,
         ID = uuid,
         Name = name,
         Type = type
     }));
 }
 ///
 /// Used in DeleteToInventory
 ///
 protected override void ExportAsset(UUID agentID, UUID assetID)
 {
     if (!assetID.Equals(UUID.Zero))
     {
         UploadInventoryItem(agentID, assetID, "", 0);
     }
     else
     {
         m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
     }
 }
Beispiel #17
0
 public bool Authorize(IOwned entity, UUID id)
 {
     if (id.Equals(_ownerID))
     {
         //Reset the timeout every time the user makes a change
         _updated = true;
         JM726.Lib.Static.Util.Wake(this);
         return(true);
     }
     return(false);
 }
 ///
 /// Used in DeleteToInventory
 ///
 protected override void ExportAsset(UUID agentID, UUID assetID)
 {
     if (!assetID.Equals(UUID.Zero))
     {
         PostInventoryAsset(agentID, AssetType.Unknown, assetID, "", 0);
     }
     else
     {
         m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
     }
 }
Beispiel #19
0
        /// <summary>
        /// Get listeners matching the input parameters.
        /// </summary>
        /// <remarks>
        /// Theres probably a more clever and efficient way to do this, maybe
        /// with regex.
        /// PM2008: Ha, one could even be smart and define a specialized
        /// Enumerator.
        /// </remarks>
        /// <param name="itemID"></param>
        /// <param name="channel"></param>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public List <ListenerInfo> GetListeners(UUID itemID, int channel,
                                                string name, UUID id, string msg)
        {
            List <ListenerInfo> collection = new List <ListenerInfo>();

            m_ListenerRwLock.AcquireReaderLock(-1);
            try
            {
                List <ListenerInfo> listeners;
                if (!m_listeners.TryGetValue(channel, out listeners))
                {
                    return(collection);
                }

                foreach (ListenerInfo li in listeners)
                {
                    if (!li.IsActive())
                    {
                        continue;
                    }
                    if (!itemID.Equals(UUID.Zero) &&
                        !li.GetItemID().Equals(itemID))
                    {
                        continue;
                    }
                    if (li.GetName().Length > 0 && (
                            ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) != OS_LISTEN_REGEX_NAME && !li.GetName().Equals(name)) ||
                            ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) == OS_LISTEN_REGEX_NAME && !Regex.IsMatch(name, li.GetName()))
                            ))
                    {
                        continue;
                    }
                    if (!li.GetID().Equals(UUID.Zero) && !li.GetID().Equals(id))
                    {
                        continue;
                    }
                    if (li.GetMessage().Length > 0 && (
                            ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) != OS_LISTEN_REGEX_MESSAGE && !li.GetMessage().Equals(msg)) ||
                            ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) == OS_LISTEN_REGEX_MESSAGE && !Regex.IsMatch(msg, li.GetMessage()))
                            ))
                    {
                        continue;
                    }
                    collection.Add(li);
                }
            }
            finally
            {
                m_ListenerRwLock.ReleaseReaderLock();
            }
            return(collection);
        }
Beispiel #20
0
        ///
        /// DeleteToInventory
        ///
        public override UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient)
        {
            UUID assetID = base.DeleteToInventory(action, folderID, objectGroup, remoteClient);

            if (!assetID.Equals(UUID.Zero))
            {
                UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
            }
            else
            {
                m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
            }

            return(assetID);
        }
Beispiel #21
0
 public override bool Equals(object obj)
 {
     if (ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (ReferenceEquals(this, obj))
     {
         return(true);
     }
     if (obj.GetType() != GetType())
     {
         return(false);
     }
     return(UUID.Equals(((BluetoothLeItem)obj).UUID));
 }
        ///
        /// Used in DeleteToInventory
        ///
        protected override void ExportAsset(UUID agentID, UUID assetID)
        {
            if (!assetID.Equals(UUID.Zero))
            {
                InventoryItemBase item = new InventoryItemBase();
                item.Owner     = agentID;
                item.AssetType = (int)AssetType.Unknown;
                item.AssetID   = assetID;
                item.Name      = String.Empty;

                PostInventoryAsset(item, 0);
            }
            else
            {
                m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
            }
        }
 private void BroadcastUpdate(string action, BluetoothGattCharacteristic characteristic)
 {
     // This is special handling for the Heart Rate Measurement profile.  Data parsing is
     // carried out as per profile specifications:
     // http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
     if (TX_CHAR_UUID2.Equals(characteristic.Uuid))
     {
         Debug.WriteLine(TAG, string.Format("Received Text: {0:D}", characteristic.GetValue().Length));
         CallBack.CallbackMethod(action + EXTRA_DATA, characteristic.GetValue());
     }
     else
     {
         if (NAME_CHAR_UUID.Equals(characteristic.Uuid))
         {
             CallBack.CallbackMethod(action + NAME_DATA, characteristic.GetValue());
         }
     }
 }
Beispiel #24
0
        /// <summary>
        /// Get listeners matching the input parameters.
        /// </summary>
        /// <remarks>
        /// Theres probably a more clever and efficient way to do this, maybe
        /// with regex.
        /// PM2008: Ha, one could even be smart and define a specialized
        /// Enumerator.
        /// </remarks>
        /// <param name="itemID"></param>
        /// <param name="channel"></param>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public List <ListenerInfo> GetListeners(UUID itemID, int channel,
                                                string name, UUID id, string msg)
        {
            List <ListenerInfo> collection = new List <ListenerInfo>();

            ThreadedClasses.RwLockedList <ListenerInfo> listeners;
            if (!m_listeners.TryGetValue(channel, out listeners))
            {
                return(collection);
            }

            listeners.ForEach(delegate(ListenerInfo li)
            {
                if (!li.IsActive())
                {
                    return;
                }
                if (!itemID.Equals(UUID.Zero) &&
                    !li.GetItemID().Equals(itemID))
                {
                    return;
                }
                if (li.GetName().Length > 0 && (
                        ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) != OS_LISTEN_REGEX_NAME && !li.GetName().Equals(name)) ||
                        ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) == OS_LISTEN_REGEX_NAME && !Regex.IsMatch(name, li.GetName()))
                        ))
                {
                    return;
                }
                if (!li.GetID().Equals(UUID.Zero) && !li.GetID().Equals(id))
                {
                    return;
                }
                if (li.GetMessage().Length > 0 && (
                        ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) != OS_LISTEN_REGEX_MESSAGE && !li.GetMessage().Equals(msg)) ||
                        ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) == OS_LISTEN_REGEX_MESSAGE && !Regex.IsMatch(msg, li.GetMessage()))
                        ))
                {
                    return;
                }
                collection.Add(li);
            });
            return(collection);
        }
Beispiel #25
0
 private string getNeighbourCol(UUID x, UUID y, int width, string infinity)
 {
     if (x.Equals(y))
     {
         return(getCol("0", width));
     }
     if (neighbourVectors[y].ContainsKey(x))
     {
         float  v      = neighbourVectors[y][x].Dist;
         string format = "{0:##.";
         for (int i = 0; i < width - (v < 10f ? 3 : 4); i++)
         {
             format += "#";
         }
         format += "}";
         return(getCol(String.Format(format, v), width));
     }
     return(getCol(infinity, width));
 }
Beispiel #26
0
 private void CheckLinksPair(UUID from, UUID to, string request)
 {
     if (!_nodes.ContainsKey(from) && !_nodes.ContainsKey(to))
     {
         throw new Exception("Unable to " + request + " link. To and From are not known nodes.");
     }
     else if (!_nodes.ContainsKey(from))
     {
         throw new Exception("Unable to " + request + " link. From is not a known node.");
     }
     else if (!_nodes.ContainsKey(to))
     {
         throw new Exception("Unable to " + request + " link. To is not a known node.");
     }
     else if (from.Equals(to))
     {
         throw new Exception("Unable to " + request + " link. To and from must be different nodes.");
     }
 }
Beispiel #27
0
        // Theres probably a more clever and efficient way to
        // do this, maybe with regex.
        // PM2008: Ha, one could even be smart and define a specialized Enumerator.
        public List <ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg)
        {
            List <ListenerInfo> collection = new List <ListenerInfo>();

            lock (m_listeners)
            {
                List <ListenerInfo> listeners;
                if (!m_listeners.TryGetValue(channel, out listeners))
                {
                    return(collection);
                }

                collection.AddRange(from li in listeners
                                    where li.IsActive()
                                    where itemID.Equals(UUID.Zero) || li.GetItemID().Equals(itemID)
                                    where li.GetName().Length <= 0 || li.GetName().Equals(name)
                                    where li.GetID().Equals(UUID.Zero) || li.GetID().Equals(id)
                                    where li.GetMessage().Length <= 0 || li.GetMessage().Equals(msg)
                                    select li);
            }
            return(collection);
        }
        // DO NOT OVERRIDE THE BASE METHOD
        public new virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
                                                  SceneObjectGroup objectGroup, IClientAPI remoteClient)
        {
            UUID assetID = base.DeleteToInventory(action, folderID, new List <SceneObjectGroup>()
            {
                objectGroup
            }, remoteClient);

            if (!assetID.Equals(UUID.Zero))
            {
                if (remoteClient != null)
                {
                    UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
                }
            }
            else
            {
                m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
            }

            return(assetID);
        }
Beispiel #29
0
        // Theres probably a more clever and efficient way to
        // do this, maybe with regex.
        // PM2008: Ha, one could even be smart and define a specialized Enumerator.
        public List <ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg)
        {
            List <ListenerInfo> collection = new List <ListenerInfo>();

            lock (m_listeners)
            {
                List <ListenerInfo> listeners;
                if (!m_listeners.TryGetValue(channel, out listeners))
                {
                    return(collection);
                }

                foreach (ListenerInfo li in listeners)
                {
                    if (!li.IsActive())
                    {
                        continue;
                    }
                    if (!itemID.Equals(UUID.Zero) && !li.GetItemID().Equals(itemID))
                    {
                        continue;
                    }
                    if (li.GetName().Length > 0 && !li.GetName().Equals(name))
                    {
                        continue;
                    }
                    if (!li.GetID().Equals(UUID.Zero) && !li.GetID().Equals(id))
                    {
                        continue;
                    }
                    if (li.GetMessage().Length > 0 && !li.GetMessage().Equals(msg))
                    {
                        continue;
                    }
                    collection.Add(li);
                }
            }
            return(collection);
        }
Beispiel #30
0
    public bool Equals(Beacon other)
    {
        if (other == null)
        {
            return(false);
        }

        if (type != other.type)
        {
            return(false);
        }

        switch (type)
        {
        case BeaconType.iBeacon:
            if (!UUID.Equals(other.UUID) || !major.Equals(other.major) || !minor.Equals(other.minor))
            {
                return(false);
            }
            break;

        case BeaconType.EddystoneUID:
            if (!UUID.Equals(other.UUID) || !instance.Equals(other.instance))
            {
                return(false);
            }
            break;

        case BeaconType.EddystoneURL:
            if (!UUID.Equals(other.UUID))
            {
                return(false);
            }
            break;
        }

        return(base.Equals(other));
    }
        // Theres probably a more clever and efficient way to
        // do this, maybe with regex.
        public List<ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg)
        {
            List<ListenerInfo> collection = new List<ListenerInfo>();

            lock (m_listeners)
            {
                List<ListenerInfo> listeners;
                if (!m_listeners.TryGetValue(channel, out listeners))
                {
                    return collection;
                }

                collection.AddRange(from li in listeners
                                    where li.IsActive()
                                    where itemID.Equals(UUID.Zero) || li.GetItemID().Equals(itemID)
                                    where li.GetName().Length <= 0 || li.GetName().Equals(name)
                                    where li.GetName().Length <= 0 || ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) != OS_LISTEN_REGEX_NAME && li.GetName().Equals(name)) ||
                                                                      ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) == OS_LISTEN_REGEX_NAME && Regex.IsMatch(name, li.GetName()))
                                    where li.GetMessage().Length <= 0 || ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) != OS_LISTEN_REGEX_MESSAGE && li.GetMessage().Equals(msg)) ||
                                                                         ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) == OS_LISTEN_REGEX_MESSAGE && Regex.IsMatch(msg, li.GetMessage()))
                                    where li.GetID().Equals(UUID.Zero) || li.GetID().Equals(id)
                                    where li.GetMessage().Length <= 0 || li.GetMessage().Equals(msg)
                                    select li);
            }
            return collection;
        }
        /// <summary>
        /// Construct the building class instance from the given properties.
        /// </summary>
        /// <param name="type" type="BuildingType">type</param>
        /// <param name="plot">The plot of land this building stands on, note it might be bigger than the
        /// actual buildings footprint, for example if it is part of a larger complex, limit the size of
        /// buildings to have a footprint of no more than 100 square meters.</param>
        /// <param name="flags"></param>
        /// <param name="owner">The owner of the building either a user, or company (group of companies) own buildings.</param>
        /// <param name="seed"></param>
        /// <param name="height">The height in floors of the building, not each floor is approximately 3 meters in size
        /// and thus buildings are limited to a maximum height of 100 floors.</param>
        public CityBuilding( BuildingType type, BuildingPlot plot, BuildingFlags flags, 
            UUID owner, IScene scene, string name ):base(owner,new Vector3(plot.xpos,21,plot.ypos),
            Quaternion.Identity, PrimitiveBaseShape.CreateBox(), name, scene)
        {
            //  Start the process of constructing a building given the parameters specified. For
            // truly random buildings change the following value (6) too another number, this is
            // used to allow for the buildings to be fairly fixed during research and development.
            buildingSeed = 6; // TODO FIX ACCESS TO THE CityModule.randomValue(n) code.
            buildingType = type;
            buildingPlot = plot;
            buildingFlags = flags;
            //  Has a valid owner been specified, if not use the default library owner (i think) of the zero uuid.
            if (!owner.Equals(UUID.Zero))
                buildingOwner = owner;
            else
                buildingOwner = UUID.Zero;

            //  Generate a unique value for this building and it's own group if it's part of a complex,
            // otherwise use the zero uuid for group (perhaps it should inherit from the city?)
            buildingUUID = UUID.Random();
            buildingGUID = UUID.Random();

            buildingCenter = new Vector3((plot.xpos + plot.width / 2), 21, (plot.ypos + plot.depth) / 2);
            if (name.Length > 0)
                buildingName = name;
            else
                buildingName = "Building" + type.ToString();
            //  Now that internal variables that are used by other methods have been set construct
            // the building based on the type, plot, flags and seed given in the parameters.
            switch (type)
            {
                case BuildingType.BUILDING_GENERAL:
                    OpenSim.Framework.MainConsole.Instance.Output("Building Type GENERAL", log4net.Core.Level.Info);
                    createBlocky();
                    break;
                case BuildingType.BUILDING_LOCALE:
                    /*
                    switch ( CityModule.randomValue(8) )
                    {
                        case 0:
                            OpenSim.Framework.MainConsole.Instance.Output("Locale general.", log4net.Core.Level.Info);
                            createSimple();
                            break;
                        case 1:
                            OpenSim.Framework.MainConsole.Instance.Output("locale 1", log4net.Core.Level.Info);
                            createBlocky();
                            break;
                    }
                    */
                    break;
                case BuildingType.BUILDING_CIVIL:
                    createTower();
                    break;
                case BuildingType.BUILDING_MILITARY:
                    break;
                case BuildingType.BUILDING_HEALTHCARE:
                    break;
                case BuildingType.BUILDING_SPORTS:
                    break;
                case BuildingType.BUILDING_ENTERTAINMENT:
                    break;
                case BuildingType.BUILDING_EDUCATION:
                    break;
                case BuildingType.BUILDING_RELIGIOUS:
                    break;
                case BuildingType.BUILDING_MUSEUM:
                    break;
                case BuildingType.BUILDING_POWERSTATION:
                    break;
                case BuildingType.BUILDING_MINEOILGAS:
                    break;
                case BuildingType.BUILDING_ZOOLOGICAL:
                    break;
                case BuildingType.BUILDING_CEMETARY:
                    break;
                case BuildingType.BUILDING_PRISON:
                    break;
                case BuildingType.BUILDING_AGRICULTURAL:
                    break;
                case BuildingType.BUILDING_RECREATION:
                    break;
                default:
                    createSimple();
                    break;
            }
        }
Beispiel #33
0
        ///
        /// RezObject
        ///
        public override SceneObjectGroup RezObject(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd, Vector3 RayStart,
                                                   UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
                                                   bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
        {
            //m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID);

            if (fromTaskID.Equals(UUID.Zero))
            {
                CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
                if (userInfo != null)
                {
                    if (userInfo.RootFolder != null)
                    {
                        InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
                        if (item == null)
                        { // Fetch the item
                            item = new InventoryItemBase();
                            item.Owner = remoteClient.AgentId;
                            item.ID = itemID;
                            item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
                        }
                        if (item != null)
                        {
                            m_assMapper.Get(item.AssetID, remoteClient.AgentId);

                        }
                    }
                }
            }

            // OK, we're done fetching. Pass it up to the default RezObject
            return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 
                                  RezSelected, RemoveItem, fromTaskID, attachment);

        }
        ///
        /// Used in DeleteToInventory
        ///
        protected override void ExportAsset(UUID agentID, UUID assetID)
        {
            if (!assetID.Equals(UUID.Zero))
            {
                InventoryItemBase item = new InventoryItemBase();
                item.Owner = agentID;
                item.AssetType = (int)AssetType.Unknown;
                item.AssetID = assetID;
                item.Name = String.Empty;

                PostInventoryAsset(item, 0);
            }
            else
            {
                m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
            }
        }
Beispiel #35
0
 public void RemoveBoard(UUID board)
 {
     _boards = _boards.Where(oldBoard => !board.Equals(oldBoard.ID));
 }
        // Theres probably a more clever and efficient way to
        // do this, maybe with regex.
        // PM2008: Ha, one could even be smart and define a specialized Enumerator.
        public List<ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg)
        {
            List<ListenerInfo> collection = new List<ListenerInfo>();

            lock (m_listeners)
            {
                List<ListenerInfo> listeners;
                if (!m_listeners.TryGetValue(channel, out listeners))
                {
                    return collection;
                }

                collection.AddRange(from li in listeners
                                    where li.IsActive()
                                    where itemID.Equals(UUID.Zero) || li.GetItemID().Equals(itemID)
                                    where li.GetName().Length <= 0 || li.GetName().Equals(name)
                                    where li.GetID().Equals(UUID.Zero) || li.GetID().Equals(id)
                                    where li.GetMessage().Length <= 0 || li.GetMessage().Equals(msg)
                                    select li);
            }
            return collection;
        }
Beispiel #37
0
        protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
        {
            first = "Unknown"; last = "UserHGGAI";
            if (base.GetAgentInfo(scopeID, fid, out agentID, out first, out last))
                return true;

            // fid is not a UUID...
            string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty;
            if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp))
            {
                if (!agentID.Equals(UUID.Zero))
                {
                    m_uMan.AddUser(agentID, f, l, url);

                    string name = m_uMan.GetUserName(agentID);
                    string[] parts = name.Trim().Split(new char[] { ' ' });
                    if (parts.Length == 2)
                    {
                        first = parts[0];
                        last = parts[1];
                    }
                    else
                    {
                        first = f;
                        last = l;
                    }
                    return true;
                }
            }
            return false;
        }
 public bool Authorize(IOwned entity, UUID id)
 {
     if (id.Equals(_ownerID)) {
         //Reset the timeout every time the user makes a change
         _updated = true;
         JM726.Lib.Static.Util.Wake(this);
         return true;
     }
     return false;
 }
Beispiel #39
0
 /// <inheritdoc />
 public UUID OtherEnd(UUID n)
 {
     if (!n.Equals(To.ID) && !n.Equals(From.ID))
         throw new Exception("Cannot return other end. Parameter 'node' must be connected to link.");
     return From.ID.Equals(n) ? To.ID : From.ID;
 }
Beispiel #40
0
 private bool Authorize(string command, UUID id)
 {
     if (!id.Equals(m_god.PrincipalID) && !id.Equals(UUID.Zero)) {
         UserAccount attempt = m_scene.UserAccountService.GetUserAccount(UUID.Zero, id);
         m_log.Warn("Can't execute " + command + " on " + Name + ". " + (attempt != null ? attempt.FirstName + " " + attempt.LastName + " is not " : "Not ") + "authorized.");
         return false;
     }
     return true;
 }
 ///
 /// Used in DeleteToInventory
 ///
 protected override void ExportAsset(UUID agentID, UUID assetID)
 {
     if (!assetID.Equals(UUID.Zero))
         UploadInventoryItem(agentID, AssetType.Unknown, assetID, "", 0);
     else
         m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
 }
Beispiel #42
0
        // Theres probably a more clever and efficient way to
        // do this, maybe with regex.
        // PM2008: Ha, one could even be smart and define a specialized Enumerator.
        public List<ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg)
        {
            List<ListenerInfo> collection = new List<ListenerInfo>();

            lock (m_listeners)
            {
                List<ListenerInfo> listeners;
                if (!m_listeners.TryGetValue(channel,out listeners))
                {
                    return collection;
                }

                foreach (ListenerInfo li in listeners)
                {
                    if (!li.IsActive())
                    {
                        continue;
                    }
                    if (!itemID.Equals(UUID.Zero) && !li.GetItemID().Equals(itemID))
                    {
                        continue;
                    }
                    if (li.GetName().Length > 0 && !li.GetName().Equals(name))
                    {
                        continue;
                    }
                    if (!li.GetID().Equals(UUID.Zero) && !li.GetID().Equals(id))
                    {
                        continue;
                    }
                    if (li.GetMessage().Length > 0 && !li.GetMessage().Equals(msg))
                    {
                        continue;
                    }
                    collection.Add(li);
                }
            }
            return collection;
        }
Beispiel #43
0
        /// <summary>
        /// Get listeners matching the input parameters.
        /// </summary>
        /// <remarks>
        /// Theres probably a more clever and efficient way to do this, maybe
        /// with regex.
        /// PM2008: Ha, one could even be smart and define a specialized
        /// Enumerator.
        /// </remarks>
        /// <param name="itemID"></param>
        /// <param name="channel"></param>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public List<ListenerInfo> GetListeners(UUID itemID, int channel,
                string name, UUID id, string msg)
        {
            List<ListenerInfo> collection = new List<ListenerInfo>();

            lock (m_listeners)
            {
                List<ListenerInfo> listeners;
                if (!m_listeners.TryGetValue(channel, out listeners))
                {
                    return collection;
                }

                foreach (ListenerInfo li in listeners)
                {
                    if (!li.IsActive())
                    {
                        continue;
                    }
                    if (!itemID.Equals(UUID.Zero) &&
                            !li.GetItemID().Equals(itemID))
                    {
                        continue;
                    }
                    if (li.GetName().Length > 0 && (
                        ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) != OS_LISTEN_REGEX_NAME && !li.GetName().Equals(name)) ||
                        ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) == OS_LISTEN_REGEX_NAME && !Regex.IsMatch(name, li.GetName()))
                    ))
                    {
                        continue;
                    }
                    if (!li.GetID().Equals(UUID.Zero) && !li.GetID().Equals(id))
                    {
                        continue;
                    }
                    if (li.GetMessage().Length > 0 && (
                        ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) != OS_LISTEN_REGEX_MESSAGE && !li.GetMessage().Equals(msg)) ||
                        ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) == OS_LISTEN_REGEX_MESSAGE && !Regex.IsMatch(msg, li.GetMessage()))
                    ))
                    {
                        continue;
                    }
                    collection.Add(li);
                }
            }
            return collection;
        }
Beispiel #44
0
 private string getNeighbourCol(UUID x, UUID y, int width, string infinity)
 {
     if (x.Equals(y))
         return getCol("0", width);
     if (neighbourVectors[y].ContainsKey(x)) {
         float v = neighbourVectors[y][x].Dist;
         string format = "{0:##.";
         for (int i = 0; i < width - (v < 10f ? 3 : 4); i++)
             format += "#";
         format += "}";
         return getCol(String.Format(format, v), width);
     }
     return getCol(infinity, width);
 }
 /// <summary>
 /// Override this to change what happens when something changes in the topology.
 /// Changes are:
 /// A link is added.
 /// A link is removed.
 /// The weight of a link changes.
 /// 
 /// The default behaviour is to run the algorithm from every node.
 /// </summary>
 protected virtual void OnChange(string msg, UUID link, Parameters parameters, bool visualise)
 {
     foreach (DijkstraNode n in this.GetAllNodes<DijkstraNode>()) {
         if (n.GetType().Equals(_dijkstraType) && !Links.ContainsKey(n.ID) || !link.Equals(Links[n.ID].ID) || !Links[n.ID].IsBidirectional)
             n.RunAlgorithm("Running algorithm from " + n.Name + " because " + msg + ".", null, n.Equals(VisualisedNode));
     }
 }
        private bool IsLocal(UUID groupID, out string serviceLocation, out string name)
        {
            serviceLocation = string.Empty;
            name = string.Empty;
            if (groupID.Equals(UUID.Zero))
                return true;

            ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty);
            if (group == null)
            {
                //m_log.DebugFormat("[XXX]: IsLocal? group {0} not found -- no.", groupID);
                return false;
            }

            serviceLocation = group.ServiceLocation;
            name = group.GroupName;
            bool isLocal = (group.ServiceLocation == string.Empty);
            //m_log.DebugFormat("[XXX]: IsLocal? {0}", isLocal);
            return isLocal;
        }
Beispiel #47
0
        /// <summary>
        /// Send an Instant Message
        /// </summary>
        /// <param name="fromName">The name this IM will show up as being from</param>
        /// <param name="target">Key of Avatar</param>
        /// <param name="message">Text message being sent</param>
        /// <param name="imSessionID">IM session ID (to differentiate between IM windows)</param>
        /// <param name="dialog">Type of instant message to send</param>
        /// <param name="offline">Whether to IM offline avatars as well</param>
        /// <param name="position">Senders Position</param>
        /// <param name="regionID">RegionID Sender is In</param>
        /// <param name="binaryBucket">Packed binary data that is specific to
        /// the dialog type</param>
        public void InstantMessage(string fromName, UUID target, string message, UUID imSessionID,
            InstantMessageDialog dialog, InstantMessageOnline offline, Vector3 position, UUID regionID,
            byte[] binaryBucket)
        {
            if (target != UUID.Zero)
            {
                ImprovedInstantMessagePacket im = new ImprovedInstantMessagePacket();

                if (imSessionID.Equals(UUID.Zero) || imSessionID.Equals(AgentID))
                    imSessionID = AgentID.Equals(target) ? AgentID : target ^ AgentID;

                im.AgentData.AgentID = Client.Self.AgentID;
                im.AgentData.SessionID = Client.Self.SessionID;

                im.MessageBlock.Dialog = (byte)dialog;
                im.MessageBlock.FromAgentName = Utils.StringToBytes(fromName);
                im.MessageBlock.FromGroup = false;
                im.MessageBlock.ID = imSessionID;
                im.MessageBlock.Message = Utils.StringToBytes(message);
                im.MessageBlock.Offline = (byte)offline;
                im.MessageBlock.ToAgentID = target;

                if (binaryBucket != null)
                    im.MessageBlock.BinaryBucket = binaryBucket;
                else
                    im.MessageBlock.BinaryBucket = Utils.EmptyBytes;

                // These fields are mandatory, even if we don't have valid values for them
                im.MessageBlock.Position = Vector3.Zero;
                //TODO: Allow region id to be correctly set by caller or fetched from Client.*
                im.MessageBlock.RegionID = regionID;

                // Send the message
                Client.Network.SendPacket(im);
            }
            else
            {
                Logger.Log(String.Format("Suppressing instant message \"{0}\" to UUID.Zero", message),
                    Helpers.LogLevel.Error, Client);
            }
        }
        private bool IsLocal(UUID groupID, out string serviceLocation, out string name)
        {
			if (m_log.IsDebugEnabled) {
				m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod ().Name);
			}

            serviceLocation = string.Empty;
            name = string.Empty;
            if (groupID.Equals(UUID.Zero))
                return true;

            ExtendedGroupRecord group = m_LocalGroupsConnector.GetGroupRecord(UUID.Zero.ToString(), groupID, string.Empty);
            if (group == null)
            {
                //m_log.DebugFormat("[XXX]: IsLocal? group {0} not found -- no.", groupID);
                return false;
            }

            serviceLocation = group.ServiceLocation;
            name = group.GroupName;
            bool isLocal = (group.ServiceLocation == string.Empty);
            //m_log.DebugFormat("[XXX]: IsLocal? {0}", isLocal);
            return isLocal;
        }