From 7e0fc95c3af435143075882650d707dc6564a8f0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Jan 2022 00:33:16 +0000 Subject: [PATCH] == UUID.Zero is slow --- OpenSim/Addons/Groups/GroupsModule.cs | 7 +- .../Region/Framework/Scenes/UuidGatherer.cs | 12 +-- .../Avatar/Friends/FriendsCommandsModule.cs | 4 +- .../Avatar/SitStand/SitStandCommandsModule.cs | 2 +- .../Avatar/XmlRpcGroups/GroupsModule.cs | 7 +- .../Materials/MaterialsModule.cs | 25 +++-- .../Scripting/JsonStore/JsonStoreModule.cs | 2 +- .../UserStatistics/WebStatsModule.cs | 6 +- .../PhysicsModules/ubOde/ODEMeshWorker.cs | 8 +- .../Shared/Api/Implementation/LSL_Api.cs | 92 +++++++++---------- .../Shared/Api/Implementation/OSSL_Api.cs | 70 +++++++------- OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 2 +- .../Shared/Instance/ScriptInstance.cs | 2 +- .../Region/ScriptEngine/YEngine/XMRInstRun.cs | 2 +- .../Handlers/Neighbour/NeighbourHandlers.cs | 2 +- .../Handlers/Simulation/AgentHandlers.cs | 6 +- .../Services/AssetService/XAssetService.cs | 2 +- .../WebkeyAuthenticationService.cs | 2 +- .../Asset/AssetServicesConnector.cs | 7 +- .../Services/FSAssetService/FSAssetService.cs | 4 +- OpenSim/Services/GridService/GridService.cs | 4 +- .../Services/GridService/HypergridLinker.cs | 4 +- .../LLLoginService/LLLoginResponse.cs | 2 +- .../Services/LLLoginService/LLLoginService.cs | 2 +- .../UserAccountService/UserAccountService.cs | 2 +- .../Common/Mock/TestInventoryDataPlugin.cs | 2 +- 26 files changed, 137 insertions(+), 143 deletions(-) diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 3fb6eacb8f..e82f963ffd 100755 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs @@ -597,11 +597,8 @@ namespace OpenSim.Groups string giver = notice.noticeData.AttachmentOwnerID; UUID attachmentUUID = notice.noticeData.AttachmentItemID; - if (attachmentUUID == null || - attachmentUUID.IsZero() || - giver == null || - giver == UUID.Zero.ToString() - ) + if (attachmentUUID == null || attachmentUUID.IsZero() || + giver == null || giver == UUID.ZeroString ) return; if (m_debugEnabled) diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index d4eb330091..74aa326575 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -297,7 +297,7 @@ namespace OpenSim.Region.Framework.Scenes public bool AddGathered(UUID uuid, sbyte type) { - if (uuid == UUID.Zero) + if (uuid.IsZero()) return false; if (ToSkip.Contains(uuid)) @@ -329,7 +329,7 @@ namespace OpenSim.Region.Framework.Scenes /// UUID. public bool AddForInspection(UUID uuid) { - if(uuid == UUID.Zero) + if(uuid.IsZero()) return false; if(ToSkip.Contains(uuid)) @@ -522,7 +522,7 @@ namespace OpenSim.Region.Framework.Scenes /// The uuid of the asset for which to gather referenced assets private void GetAssetUuids(UUID assetUuid) { - if(assetUuid == UUID.Zero) + if(assetUuid.IsZero()) return; if(FailedUUIDs.Contains(assetUuid)) @@ -621,7 +621,7 @@ namespace OpenSim.Region.Framework.Scenes private void AddForInspection(UUID assetUuid, sbyte assetType) { - if(assetUuid == UUID.Zero) + if(assetUuid.IsZero()) return; // Here, we want to collect uuids which require further asset fetches but mark the others as gathered @@ -776,7 +776,7 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < ids.Count; ++i) { - if (ids[i] == UUID.Zero) + if (ids[i].IsZero()) continue; if (!UncertainAssetsUUIDs.Contains(ids[i])) UncertainAssetsUUIDs.Add(ids[i]); @@ -1007,7 +1007,7 @@ namespace OpenSim.Region.Framework.Scenes while (--count >= 0) { UUID id = new UUID(abytes, pos); - if (id == UUID.Zero) + if (id.IsZero()) break; if (!ToSkip.Contains(id) && !FailedUUIDs.Contains(id)) diff --git a/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs index a913ec48a3..9feb324874 100755 --- a/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Friends/FriendsCommandsModule.cs @@ -102,7 +102,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends m_userManagementModule = m_scene.RequestModuleInterface(); m_presenceService = m_scene.RequestModuleInterface(); - if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null) + if (m_friendsModule != null && ((FriendsModule)m_friendsModule).Scene != null && m_userManagementModule != null && m_presenceService != null) { m_scene.AddCommand( "Friends", this, "friends show", @@ -134,7 +134,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Friends // UserAccount ua // = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, firstName, lastName); - if (userId == UUID.Zero) + if (userId.IsZero()) { MainConsole.Instance.Output("No such user as {0} {1}", firstName, lastName); return; diff --git a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs index ef7d852682..01d12096de 100755 --- a/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/SitStand/SitStandCommandsModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.SitStand foreach (SceneObjectPart part in sceneObject.Parts) { - if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) + if (part.IsSitTargetSet && part.SitTargetAvatar.IsZero()) { sitPart = part; break; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index cd847175f4..a612268691 100755 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -404,7 +404,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_log.DebugFormat("[xmlGROUPS]: OnInstantMessage called for {0}, message type {1}", remoteClient.Name, (InstantMessageDialog)im.dialog); - if (remoteClient == null || !remoteClient.IsActive || remoteClient.AgentId == UUID.Zero) + if (remoteClient == null || !remoteClient.IsActive || remoteClient.AgentId.IsZero()) return; Scene scene = (Scene)remoteClient.Scene; @@ -623,7 +623,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[xmlGROUPS]: Accepted notice {0} for {1}", noticeID, remoteClient.AgentId); - if (noticeID == UUID.Zero) + if (noticeID.IsZero()) return; UUID folderID = UUID.Zero; @@ -691,7 +691,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[xmlGROUPS]: Accepted notice {0} for {1}", noticeID, remoteAgentID); - if (noticeID == UUID.Zero) + if (noticeID.IsZero()) return; GroupNoticeInfo notice = m_groupData.GetGroupNotice(remoteAgentID, noticeID); @@ -1321,7 +1321,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (groupInfo == null) return; - IClientAPI ejecteeClient = GetActiveRootClient(ejecteeID); // Send Message to Ejectee diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index e5dbfeb330..809d33c0e6 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -319,8 +319,8 @@ namespace OpenSim.Region.OptionalModules.Materials if(fmat == null || ( fmat.DiffuseAlphaMode == 1 - && fmat.NormalMapID == UUID.Zero - && fmat.SpecularMapID == UUID.Zero)) + && fmat.NormalMapID.IsZero() + && fmat.SpecularMapID.IsZero())) continue; fmat.ID = id; @@ -383,7 +383,7 @@ namespace OpenSim.Region.OptionalModules.Materials private bool GetStoredMaterialInFace(SceneObjectPart part, Primitive.TextureEntryFace face) { UUID id = face.MaterialID; - if (id == UUID.Zero) + if (id.IsZero()) return false; OSDMap mat; @@ -419,8 +419,8 @@ namespace OpenSim.Region.OptionalModules.Materials if(fmat == null || (fmat.DiffuseAlphaMode == 1 - && fmat.NormalMapID == UUID.Zero - && fmat.SpecularMapID == UUID.Zero)) + && fmat.NormalMapID.IsZero() + && fmat.SpecularMapID.IsZero())) { face.MaterialID = UUID.Zero; return true; @@ -463,7 +463,7 @@ namespace OpenSim.Region.OptionalModules.Materials private void RemoveMaterialInFace(Primitive.TextureEntryFace face) { UUID id = face.MaterialID; - if (id == UUID.Zero) + if (id.IsZero()) return; lock (materialslock) @@ -662,9 +662,8 @@ namespace OpenSim.Region.OptionalModules.Materials { newFaceMat = new FaceMaterial(mat); if(newFaceMat.DiffuseAlphaMode == 1 - && newFaceMat.NormalMapID == UUID.Zero - && newFaceMat.SpecularMapID == UUID.Zero - ) + && newFaceMat.NormalMapID.IsZero() + && newFaceMat.SpecularMapID.IsZero()) id = UUID.Zero; else { @@ -686,12 +685,12 @@ namespace OpenSim.Region.OptionalModules.Materials sop.Shape.TextureEntry = te.GetBytes(9); } - if(oldid != UUID.Zero) + if(!oldid.IsZero()) RemoveMaterial(oldid); lock(materialslock) { - if(id != UUID.Zero) + if(!id.IsZero()) { if (m_Materials.ContainsKey(id)) m_MaterialsRefCount[id]++; @@ -851,7 +850,7 @@ namespace OpenSim.Region.OptionalModules.Materials public UUID AddNewMaterial(FaceMaterial fm) { - if(fm.DiffuseAlphaMode == 1 && fm.NormalMapID == UUID.Zero && fm.SpecularMapID == UUID.Zero) + if(fm.DiffuseAlphaMode == 1 && fm.NormalMapID.IsZero() && fm.SpecularMapID.IsZero()) { fm.ID = UUID.Zero; return UUID.Zero; @@ -875,7 +874,7 @@ namespace OpenSim.Region.OptionalModules.Materials public void RemoveMaterial(UUID id) { - if(id == UUID.Zero) + if(id.IsZero()) return; lock(materialslock) diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index ae8341f02b..899675ed5f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs @@ -250,7 +250,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore // ----------------------------------------------------------------- public bool CreateStore(string value, ref UUID result) { - if (result == UUID.Zero) + if (result.IsZero()) result = UUID.Random(); JsonStore map = null; diff --git a/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs index e0fdf7c71c..b498599107 100644 --- a/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs @@ -500,7 +500,7 @@ namespace OpenSim.Region.UserStatistics { UUID sessionID = mmap["session_id"].AsUUID(); - if (sessionID == UUID.Zero) + if (sessionID.IsZero()) return new UserSession(); @@ -518,7 +518,7 @@ namespace OpenSim.Region.UserStatistics } // can't find a session - if (agentID == UUID.Zero) + if (agentID.IsZero()) { return new UserSession(); } @@ -623,7 +623,7 @@ namespace OpenSim.Region.UserStatistics // m_log.DebugFormat( // "[WEB STATS MODULE]: Updating user stats for {0} {1}, session {2}", uid.name_f, uid.name_l, uid.session_id); - if (uid.session_id == UUID.Zero) + if (uid.session_id.IsZero()) return; lock (db) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs index 9c84647b1b..f7eff077b7 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs @@ -185,7 +185,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // check if we got outdated - if (!pbs.SculptEntry || pbs.SculptTexture == UUID.Zero) + if (!pbs.SculptEntry || pbs.SculptTexture.IsZero()) { repData.meshState = MeshState.noNeed; return; @@ -256,7 +256,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (repData.meshState != MeshState.loadingAsset) return; - if (repData.assetID == null || repData.assetID == UUID.Zero) + if (repData.assetID == null || repData.assetID.Value.IsZero()) return; if (repData.assetID != repData.pbs.SculptTexture) @@ -527,7 +527,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (pbs.SculptEntry) { - if (pbs.SculptTexture == UUID.Zero) + if (pbs.SculptTexture.IsZero()) return; repData.assetID = pbs.SculptTexture; @@ -907,7 +907,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde return; UUID assetID = (UUID) repData.assetID; - if (assetID == UUID.Zero) + if (assetID.IsZero()) return; repData.meshState = MeshState.loadingAsset; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f3e939cf62..1a6355c94f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -542,7 +542,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected SceneObjectPart MonitoringObject() { UUID m = m_host.ParentGroup.MonitoringObject; - if (m == UUID.Zero) + if (m.IsZero()) return null; SceneObjectPart p = m_ScriptEngine.World.GetSceneObjectPart(m); @@ -603,9 +603,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llResetOtherScript(string name) { - UUID item; + UUID item = GetScriptByName(name); - if ((item = GetScriptByName(name)) == UUID.Zero) + if (item.IsZero()) { Error("llResetOtherScript", "Can't find script '" + name + "'"); return; @@ -2412,7 +2412,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else { textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); - if (textureID == UUID.Zero) + if (textureID.IsZero()) { if (!UUID.TryParse(texture, out textureID)) dotexture = false; @@ -2471,7 +2471,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID textureID = new UUID(); textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); - if (textureID == UUID.Zero) + if (textureID.IsZero()) { if (!UUID.TryParse(texture, out textureID)) return; @@ -3150,7 +3150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound); - if(soundID == UUID.Zero) + if(soundID.IsZero()) return; // send the sound, once, to all clients in range @@ -3177,7 +3177,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound); - if(soundID == UUID.Zero) + if(soundID.IsZero()) return; m_SoundModule.LoopSound(m_host.UUID, soundID, volume, true, false); @@ -3190,7 +3190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound); - if(soundID == UUID.Zero) + if(soundID.IsZero()) return; m_SoundModule.LoopSound(m_host.UUID, soundID, volume, false, true); @@ -3203,7 +3203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound); - if(soundID == UUID.Zero) + if(soundID.IsZero()) return; // send the sound, once, to all clients in range @@ -3217,7 +3217,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound); - if(soundID == UUID.Zero) + if(soundID.IsZero()) return; // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. @@ -3238,7 +3238,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound); - if(soundID == UUID.Zero) + if(soundID.IsZero()) return; m_SoundModule.PreloadSound(m_host.UUID, soundID); @@ -3486,7 +3486,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGiveMoney(LSL_Key destination, LSL_Integer amount) { - if (m_item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter.IsZero()) return 0; if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) @@ -3729,7 +3729,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llCollisionFilter(LSL_String name, LSL_Key id, LSL_Integer accept) { UUID.TryParse(id, out UUID objectID); - if(objectID == UUID.Zero) + if(objectID.IsZero()) m_host.SetCollisionFilter(accept != 0, name.m_string.ToLower(System.Globalization.CultureInfo.InvariantCulture), string.Empty); else m_host.SetCollisionFilter(accept != 0, name.m_string.ToLower(System.Globalization.CultureInfo.InvariantCulture), objectID.ToString()); @@ -3911,7 +3911,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llInstantMessage(string user, string message) { - if (!UUID.TryParse(user, out UUID result) || result == UUID.Zero) + if (!UUID.TryParse(user, out UUID result) || result.IsZero()) { Error("llInstantMessage","An invalid key was passed to llInstantMessage"); ScriptSleep(2000); @@ -4176,7 +4176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llStartAnimation(string anim) { - if (m_item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter.IsZero()) return; if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) @@ -4187,7 +4187,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // Do NOT try to parse UUID, animations cannot be triggered by ID UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation); - if (animID == UUID.Zero) + if (animID.IsZero()) presence.Animator.AddAnimation(anim, m_host.UUID); else presence.Animator.AddAnimation(animID, m_host.UUID); @@ -4198,7 +4198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llStopAnimation(string anim) { - if (m_item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter.IsZero()) return; if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) @@ -4209,7 +4209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID animID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, anim); - if (animID == UUID.Zero) + if (animID.IsZero()) presence.Animator.RemoveAnimation(anim); else presence.Animator.RemoveAnimation(animID, true); @@ -4221,9 +4221,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // Do NOT try to parse UUID, animations cannot be triggered by ID UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation); - if (animID == UUID.Zero) + if (animID.IsZero()) animID = DefaultAvatarAnimations.GetDefaultAnimation(anim); - if (animID != UUID.Zero) + if (!animID.IsZero()) m_host.AddAnimation(animID, anim); } @@ -5139,7 +5139,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt) { // If attached using llAttachToAvatarTemp, cowardly refuse - if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID == UUID.Zero) + if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID.IsZero()) return; if (UUID.TryParse(agent, out UUID agentId)) @@ -5169,7 +5169,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // The destination is not an asset ID and also doesn't name a landmark. // Use it as a sim name - if (assetID == UUID.Zero) + if (assetID.IsZero()) { if(string.IsNullOrEmpty(destination)) World.RequestTeleportLocation(sp.ControllingClient, World.RegionInfo.RegionName, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); @@ -7817,7 +7817,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID folderID = m_ScriptEngine.World.MoveTaskInventoryItems(destID, category, m_host, itemList, false); - if (folderID == UUID.Zero) + if (folderID.IsZero()) { Error("llGiveInventoryList", "Unable to give list"); ScriptSleep(100); @@ -8688,7 +8688,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(map, out UUID sculptId)) sculptId = ScriptUtils.GetAssetIdFromItemName(m_host, map, (int)AssetType.Texture); - if (sculptId == UUID.Zero) + if (sculptId.IsZero()) return; shapeBlock.PathCurve = pathcurve; @@ -10364,7 +10364,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!string.IsNullOrEmpty(mapname)) { mapID = ScriptUtils.GetAssetIdFromItemName(m_host, mapname, (int)AssetType.Texture); - if (mapID == UUID.Zero) + if (mapID.IsZero()) { if (!UUID.TryParse(mapname, out mapID)) { @@ -10433,7 +10433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if(!string.IsNullOrEmpty(smapname)) { smapID = ScriptUtils.GetAssetIdFromItemName(m_host, smapname, (int)AssetType.Texture); - if (smapID == UUID.Zero) + if (smapID.IsZero()) { if (!UUID.TryParse(smapname, out smapID)) { @@ -10603,7 +10603,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api FaceMaterial mat = null; UUID oldid = texface.MaterialID; - if (oldid == UUID.Zero) + if (oldid.IsZero()) { if (materialAlphaMode == 1) return false; @@ -10661,9 +10661,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api FaceMaterial mat = null; UUID oldid = texface.MaterialID; - if (oldid == UUID.Zero) + if (oldid.IsZero()) { - if (mapID == UUID.Zero) + if (mapID.IsZero()) return false; } else @@ -10729,9 +10729,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api FaceMaterial mat = null; UUID oldid = texface.MaterialID; - if(oldid == UUID.Zero) + if(oldid.IsZero()) { - if(mapID == UUID.Zero) + if(mapID.IsZero()) return false; } else @@ -13398,7 +13398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGetCameraPos() { - if (m_item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter.IsZero()) return Vector3.Zero; if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) @@ -13421,7 +13421,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Rotation llGetCameraRot() { - if (m_item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter.IsZero()) return Quaternion.Identity; if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) @@ -13601,13 +13601,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // the object we are in UUID objectID = m_host.ParentUUID; - if (objectID == UUID.Zero) + if (objectID.IsZero()) return; // we need the permission first, to know which avatar we want to set the camera for UUID agentID = m_item.PermsGranter; - if (agentID == UUID.Zero) + if (agentID.IsZero()) return; if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) @@ -13727,13 +13727,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // the object we are in UUID objectID = m_host.ParentUUID; - if (objectID == UUID.Zero) + if (objectID.IsZero()) return; // we need the permission first, to know which avatar we want to clear the camera for UUID agentID = m_item.PermsGranter; - if (agentID == UUID.Zero) + if (agentID.IsZero()) return; if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) @@ -14836,7 +14836,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_String(String.Empty)); break; case ScriptBaseClass.OBJECT_TEMP_ATTACHED: - if (obj.ParentGroup.AttachmentPoint != 0 && obj.ParentGroup.FromItemID == UUID.Zero) + if (obj.ParentGroup.AttachmentPoint != 0 && obj.ParentGroup.FromItemID.IsZero()) { ret.Add(new LSL_Integer(1)); } @@ -14981,7 +14981,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api assetID = item.AssetID; } - if (assetID == UUID.Zero) + if (assetID.IsZero()) { // => complain loudly, as specified by the LSL docs Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'"); @@ -15032,7 +15032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api assetID = item.AssetID; } - if (assetID == UUID.Zero) + if (assetID.IsZero()) { // => complain loudly, as specified by the LSL docs Error("llGetNotecardLine", "Can't find notecard '" + name + "'"); @@ -15193,7 +15193,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Key llRequestUsername(LSL_Key id) { - if (!UUID.TryParse(id, out UUID key) || key == UUID.Zero) + if (!UUID.TryParse(id, out UUID key) || key.IsZero()) return string.Empty; ScenePresence lpresence = World.GetScenePresence(key); @@ -15248,7 +15248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Key llRequestDisplayName(LSL_Key id) { - if (!UUID.TryParse(id, out UUID key) || key == UUID.Zero) + if (!UUID.TryParse(id, out UUID key) || key.IsZero()) return string.Empty; ScenePresence lpresence = World.GetScenePresence(key); @@ -16885,7 +16885,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } - if (m_item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter.IsZero()) { replydata = "MISSING_PERMISSION_DEBIT"; break; @@ -17406,7 +17406,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - if (m_item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter.IsZero()) { llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); return; @@ -17427,13 +17427,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation); - if (animID == UUID.Zero) + if (animID.IsZero()) { String animupper = ((string)anim).ToUpperInvariant(); DefaultAvatarAnimations.AnimsUUIDbyName.TryGetValue(animupper, out animID); } - if (animID == UUID.Zero) + if (animID.IsZero()) { llShout(ScriptBaseClass.DEBUG_CHANNEL, "Animation not found"); return; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 946cdce492..e6cb7e3bbe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -984,7 +984,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return false; UUID landGroup = landdata.GroupID; - if(landGroup == UUID.Zero) + if(landGroup.IsZero()) return false; if(landGroup == m_host.GroupID) @@ -1197,7 +1197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null && part != null && - part.SitTargetAvatar == UUID.Zero) + part.SitTargetAvatar.IsZero()) presence.HandleAgentRequestSit(presence.ControllingClient, agentID, targetID, @@ -1264,7 +1264,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } m_host.TaskInventory.LockItemsForRead(false); - if (animID == UUID.Zero) + if (animID.IsZero()) target.Animator.AddAnimation(animation, m_host.UUID); else target.Animator.AddAnimation(animID, m_host.UUID); @@ -1290,7 +1290,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api animID = UUID.Zero; } - if (animID == UUID.Zero) + if (animID.IsZero()) target.Animator.RemoveAnimation(animation); else target.Animator.RemoveAnimation(animID, true); @@ -1872,9 +1872,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (UUID.TryParse(arg, out uuid)) { - if(newLand.GroupID != uuid) + if(newLand.GroupID.NotEqual(uuid)) { - if(uuid == UUID.Zero) + if(uuid.IsZero()) { changed = true; newLand.GroupID = uuid; @@ -2180,7 +2180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api InitLSL(); // harakiri check - if(objUUID == UUID.Zero) + if(objUUID.IsZero()) { if (!m_host.ParentGroup.IsAttachment) m_LSL_Api.llDie(); @@ -2348,7 +2348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); } - if (assetID == UUID.Zero) + if (assetID.IsZero()) return UUID.Zero; if (!NotecardCache.IsCached(assetID)) @@ -2360,7 +2360,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Whoops, it's still possible here that the notecard name was properly // formatted like a UUID but isn't an asset UUID so lets look it up by name after all assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); - if (assetID == UUID.Zero) + if (assetID.IsZero()) return UUID.Zero; if (!NotecardCache.IsCached(assetID)) @@ -2413,7 +2413,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID assetID = CacheNotecard(name); - if (assetID == UUID.Zero) + if (assetID.IsZero()) { OSSLShoutError("Notecard '" + name + "' could not be found."); return "ERROR!"; @@ -2469,7 +2469,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID assetID = CacheNotecard(name); - if (assetID == UUID.Zero) + if (assetID.IsZero()) { OSSLShoutError("Notecard '" + name + "' could not be found."); return -1; @@ -3280,7 +3280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ImageID = ScriptUtils.GetAssetIdFromItemName(m_host, image, (int)AssetType.Texture); - if (ImageID == null || ImageID == UUID.Zero) + if (ImageID == null || ImageID.IsZero()) { if (!UUID.TryParse(image, out ImageID)) return; @@ -3450,7 +3450,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } m_host.TaskInventory.LockItemsForRead(false); - if (animID == UUID.Zero) + if (animID.IsZero()) target.Animator.AddAnimation(animation, m_host.UUID); else target.Animator.AddAnimation(animID, m_host.UUID); @@ -3483,7 +3483,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api animID = UUID.Zero; } - if (animID == UUID.Zero) + if (animID.IsZero()) target.Animator.RemoveAnimation(animation); else target.Animator.RemoveAnimation(animID, true); @@ -3805,7 +3805,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); - if (!UUID.TryParse(agentKey, out UUID id) || id == UUID.Zero) + if (!UUID.TryParse(agentKey, out UUID id) || id.IsZero()) return; ScenePresence sp = World.GetScenePresence(id); @@ -3826,7 +3826,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Float health = new LSL_Float(-1); - if (!UUID.TryParse(agentKey, out UUID id) || id == UUID.Zero) + if (!UUID.TryParse(agentKey, out UUID id) || id.IsZero()) return health; ScenePresence presence = World.GetScenePresence(id); @@ -4096,7 +4096,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ScriptBaseClass.FALSE; // object has to be set to a group, but not group owned - if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) + if (m_host.GroupID.IsZero() || m_host.GroupID.Equals(m_host.OwnerID)) return ScriptBaseClass.FALSE; // invited agent has to be present in this scene @@ -4135,7 +4135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ScriptBaseClass.FALSE; // object has to be set to a group, but not group owned - if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) + if (m_host.GroupID.IsZero() || m_host.GroupID.Equals(m_host.OwnerID)) return ScriptBaseClass.FALSE; // object owner needs eject power @@ -4344,7 +4344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments"); - if (!UUID.TryParse(avatar.ToString(), out UUID targetUUID) || targetUUID == UUID.Zero) + if (!UUID.TryParse(avatar.ToString(), out UUID targetUUID) || targetUUID.IsZero()) return; if (!World.TryGetScenePresence(targetUUID, out ScenePresence target)) @@ -4484,7 +4484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetRezzingObject"); UUID rezID = m_host.ParentGroup.RezzerID; - if(rezID == UUID.Zero || m_host.ParentGroup.Scene.GetScenePresence(rezID) != null) + if(rezID.IsZero() || m_host.ParentGroup.Scene.GetScenePresence(rezID) != null) return new LSL_Key(ScriptBaseClass.NULL_KEY); return new LSL_Key(rezID.ToString()); } @@ -4964,7 +4964,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return false; UUID landGroup = landdata.GroupID; - if(landGroup == UUID.Zero) + if(landGroup.IsZero()) return false; if(landGroup == m_host.GroupID) @@ -5080,7 +5080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); - if (soundID == UUID.Zero) + if (soundID.IsZero()) return; // send the sound, once, to all clients in range @@ -5097,7 +5097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); - if (soundID == UUID.Zero) + if (soundID.IsZero()) return; m_SoundModule.LoopSound(sop.UUID, soundID, volume, false,false); @@ -5113,7 +5113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); - if (soundID == UUID.Zero) + if (soundID.IsZero()) return; m_SoundModule.LoopSound(sop.UUID, soundID, volume, true, false); @@ -5129,7 +5129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); - if (soundID == UUID.Zero) + if (soundID.IsZero()) return; m_SoundModule.LoopSound(sop.UUID, soundID, volume, false, true); @@ -5145,7 +5145,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); - if (soundID == UUID.Zero) + if (soundID.IsZero()) return; // send the sound, once, to all clients in range @@ -5162,7 +5162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); - if (soundID == UUID.Zero) + if (soundID.IsZero()) return; // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. @@ -5180,7 +5180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); - if (soundID == UUID.Zero) + if (soundID.IsZero()) return; m_SoundModule.TriggerSoundLimited(sop.UUID, soundID, volume, @@ -5213,7 +5213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound); - if (soundID == UUID.Zero) + if (soundID.IsZero()) return; m_SoundModule.PreloadSound(sop.UUID, soundID); @@ -5263,7 +5263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (detectedParams == null) return String.Empty; UUID key = detectedParams.Key; - if (key == UUID.Zero) + if (key.IsZero()) return String.Empty; UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key); return account.UserCountry; @@ -5278,7 +5278,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(id, out UUID key)) return String.Empty; - if (key == UUID.Zero) + if (key.IsZero()) return String.Empty; //if owner is not god, target must be in region, or nearby regions @@ -5569,7 +5569,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ScriptBaseClass.NULL_KEY; UUID id = item.LastOwnerID; - if(id == UUID.Zero) + if(id.IsZero()) id= item.OwnerID; return id.ToString(); } @@ -5828,7 +5828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } UUID envID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, daycycle); - if (envID == UUID.Zero) + if (envID.IsZero()) return -3; AssetBase asset = World.AssetService.Get(envID.ToString()); @@ -5876,7 +5876,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID envID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, daycycle); - if (envID == UUID.Zero) + if (envID.IsZero()) return -4; AssetBase asset = World.AssetService.Get(envID.ToString()); @@ -5919,7 +5919,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID envID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, daycycle); - if (envID == UUID.Zero) + if (envID.IsZero()) return -4; AssetBase asset = World.AssetService.Get(envID.ToString()); diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index e00ee1eb74..a623144bd5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs @@ -252,7 +252,7 @@ namespace OpenSim.Region.ScriptEngine.Shared public void Populate(Scene scene, DetectedObject obj) { - if(obj.keyUUID == UUID.Zero) // land + if(obj.keyUUID.IsZero()) // land { Position = new LSL_Types.Vector3(obj.posVector); Rotation.s = 1.0; diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 0e173c4d4b..bd0eedc767 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public bool StatePersistedHere { get { return m_AttachedAvatar == UUID.Zero; } } + public bool StatePersistedHere { get { return m_AttachedAvatar.IsZero(); } } /// /// The current work item if an event for this script is running or waiting to run, diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs index 4e36e080aa..aa1c47085d 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs @@ -165,7 +165,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine // of all others so the m_DetachQuantum won't run out // before attach(NULL_KEY) is executed. case ScriptEventCode.attach: - if (evt.Params[0].ToString() == UUID.Zero.ToString()) + if (evt.Params[0].ToString() == UUID.ZeroString) { LinkedListNode lln2 = null; for(lln2 = m_EventQueue.First; lln2 != null; lln2 = lln2.Next) diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index 9ce38f1348..3509b6e6fa 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs @@ -81,7 +81,7 @@ namespace OpenSim.Server.Handlers.Neighbour } if (!RestHandlerUtils.GetParams(httpRequest.UriPath, out UUID regionID, out ulong regionHandle, out string action) - || regionID == UUID.Zero) + || regionID.IsZero()) { m_log.InfoFormat("[RegionPostHandler]: Invalid parameters for neighbour message {0}", httpRequest.UriPath); httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index dac49a896b..444dd0aa5a 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -240,7 +240,7 @@ namespace OpenSim.Server.Handlers.Simulation { case "QUERYACCESS": { - if (agentID == UUID.Zero || regionID == UUID.Zero) + if (agentID.IsZero() || regionID.IsZero()) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; @@ -271,7 +271,7 @@ namespace OpenSim.Server.Handlers.Simulation } case "POST": { - if (agentID == UUID.Zero) + if (agentID.IsZero()) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; @@ -289,7 +289,7 @@ namespace OpenSim.Server.Handlers.Simulation } case "DELETE": { - if (agentID == UUID.Zero || regionID == UUID.Zero) + if (agentID.IsZero() || regionID.IsZero()) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs index 2bb82e55f7..945e133de5 100644 --- a/OpenSim/Services/AssetService/XAssetService.cs +++ b/OpenSim/Services/AssetService/XAssetService.cs @@ -167,7 +167,7 @@ namespace OpenSim.Services.AssetService { //m_log.DebugFormat("[XASSET SERVICE]: Get asset async {0}", id); - if (!UUID.TryParse(id, out UUID assetID) || assetID == UUID.Zero) + if (!UUID.TryParse(id, out UUID assetID) || assetID.IsZero()) return false; AssetBase asset = Get(id); diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index 0bd5b1f72e..5a0fca9100 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs @@ -68,7 +68,7 @@ namespace OpenSim.Services.AuthenticationService public string Authenticate(UUID principalID, string password, int lifetime) { - if (new UUID(password) == UUID.Zero) + if (new UUID(password).IsZero()) { m_log.DebugFormat("[AUTH SERVICE]: UUID.Zero is not a valid web_login_key on PrincipalID {0}", principalID); } diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index d793c8d6a0..05e3e1ccca 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -328,15 +328,14 @@ namespace OpenSim.Services.Connectors // cluster member, so we can't have the server assign one. if (asset.ID == string.Empty || asset.ID == stringUUIDZero) { - if (asset.FullID == UUID.Zero) + if (asset.FullID.IsZero()) { asset.FullID = UUID.Random(); + m_log.WarnFormat("[Assets] Zero ID: {0}", asset.Name); } - m_log.WarnFormat("[Assets] Zero ID: {0}",asset.Name); asset.ID = asset.FullID.ToString(); } - - if (asset.FullID == UUID.Zero) + else if (asset.FullID.IsZero()) { if (UUID.TryParse(asset.ID, out UUID uuid)) asset.FullID = uuid; diff --git a/OpenSim/Services/FSAssetService/FSAssetService.cs b/OpenSim/Services/FSAssetService/FSAssetService.cs index bbee6ee148..0126067d61 100644 --- a/OpenSim/Services/FSAssetService/FSAssetService.cs +++ b/OpenSim/Services/FSAssetService/FSAssetService.cs @@ -670,13 +670,13 @@ namespace OpenSim.Services.FSAssetService if (asset.ID == string.Empty) { - if (asset.FullID == UUID.Zero) + if (asset.FullID.IsZero()) { asset.FullID = UUID.Random(); } asset.ID = asset.FullID.ToString(); } - else if (asset.FullID == UUID.Zero) + else if (asset.FullID.IsZero()) { UUID uuid = UUID.Zero; if (UUID.TryParse(asset.ID, out uuid)) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 7fe2b68118..41da5ab912 100755 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -240,7 +240,7 @@ namespace OpenSim.Services.GridService { IConfig gridConfig = m_config.Configs["GridService"]; - if (regionInfos.RegionID == UUID.Zero) + if (regionInfos.RegionID.IsZero()) return "Invalid RegionID - cannot be zero UUID"; if (regionInfos.RegionLocY <= Constants.MaximumRegionSize) @@ -284,7 +284,7 @@ namespace OpenSim.Services.GridService if ((rflags & OpenSim.Framework.RegionFlags.Reservation) != 0) { // Regions reserved for the null key cannot be taken. - if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) + if ((string)region.Data["PrincipalID"] == UUID.ZeroString) return "Region location is reserved"; // Treat it as an auth request diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index bcc14cf57a..f1069f9d6e 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -205,7 +205,7 @@ namespace OpenSim.Services.GridService if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out string reason, out sizeX, out sizeY)) return false; - if (regionID == UUID.Zero) + if (regionID.IsZero()) { m_log.Warn("[HYPERGRID LINKER]: Unable to link region: " + reason); return false; @@ -369,7 +369,7 @@ namespace OpenSim.Services.GridService if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason, out sizeX, out sizeY)) return false; - if (regionID == UUID.Zero) + if (regionID.IsZero()) { m_log.Warn("[HYPERGRID LINKER]: Unable to link region"); reason = "Remote region could not be found"; diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index c05db77bf8..53c6f55032 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -805,7 +805,7 @@ namespace OpenSim.Services.LLLoginService Hashtable TempHash; foreach (InventoryFolderBase InvFolder in folders) { - if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == InventoryFolderBase.ROOT_FOLDER_NAME) + if (InvFolder.ParentID.IsZero() && InvFolder.Name == InventoryFolderBase.ROOT_FOLDER_NAME) { rootID = InvFolder.ID; } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 4f4bef05a3..3b4f215958 100755 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -480,7 +480,7 @@ namespace OpenSim.Services.LLLoginService // spamming the console. if (guinfo != null) { - if (guinfo.HomeRegionID == UUID.Zero) + if (guinfo.HomeRegionID.IsZero()) { if(startLocation == "home") m_log.WarnFormat( diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 08d4f85121..9e104cf73b 100755 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -912,7 +912,7 @@ namespace OpenSim.Services.UserAccountService if(item != null && item.AssetType == (int)AssetType.Link) { - if(item.AssetID == UUID.Zero ) + if(item.AssetID.IsZero()) item = null; else item = m_InventoryService.GetItem(source, item.AssetID); diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs index 0ff6f7f485..04cda547bd 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs @@ -158,7 +158,7 @@ namespace OpenSim.Tests.Common m_folders[folder.ID] = folder; - if (folder.ParentID == UUID.Zero) + if (folder.ParentID.IsZero()) { // m_log.DebugFormat( // "[MOCK INV DB]: Adding root folder {0} {1} for {2}", folder.Name, folder.ID, folder.Owner);