From 6ef9d4da901a346c232458317cca6268da888e2e Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 18 Aug 2008 00:39:10 +0000 Subject: Formatting cleanup. --- .../TextureDownload/UserTextureDownloadService.cs | 8 +- .../Modules/Avatar/Friends/FriendsModule.cs | 6 +- .../Modules/Avatar/Groups/GroupsModule.cs | 10 +-- .../DynamicTexture/DynamicTextureModule.cs | 8 +- .../Modules/Scripting/EMailModules/EmailModule.cs | 52 ++++++------- .../Modules/World/Archiver/ArchiveConstants.cs | 22 +++--- .../Modules/World/Archiver/ArchiveReadRequest.cs | 86 +++++++++++----------- .../World/Archiver/ArchiveWriteRequestExecution.cs | 38 +++++----- .../Archiver/ArchiveWriteRequestPreparation.cs | 54 +++++++------- .../Modules/World/Archiver/AssetsArchiver.cs | 42 +++++------ .../Modules/World/Archiver/AssetsDearchiver.cs | 46 ++++++------ .../Modules/World/Archiver/AssetsRequest.cs | 10 +-- .../Modules/World/Archiver/TarArchiveReader.cs | 12 +-- .../Modules/World/Archiver/TarArchiveWriter.cs | 6 +- .../Modules/World/Estate/EstateManagementModule.cs | 18 ++--- .../Modules/World/Land/LandManagementModule.cs | 85 +++++++-------------- .../Environment/Modules/World/Land/LandObject.cs | 4 +- .../Environment/Modules/World/NPC/NPCAvatar.cs | 8 +- .../Modules/World/Permissions/PermissionsModule.cs | 2 +- .../Modules/World/Serialiser/SceneXmlLoader.cs | 14 ++-- .../Environment/Modules/World/Sun/SunModule.cs | 10 +-- .../Modules/World/Terrain/FileLoaders/BMP.cs | 6 +- .../Modules/World/Terrain/FileLoaders/GIF.cs | 6 +- .../Terrain/FileLoaders/GenericSystemDrawing.cs | 12 +-- .../Modules/World/Terrain/FileLoaders/JPEG.cs | 10 +-- .../Modules/World/Terrain/FileLoaders/LLRAW.cs | 20 ++--- .../Modules/World/Terrain/FileLoaders/PNG.cs | 6 +- .../Modules/World/Terrain/FileLoaders/RAW32.cs | 14 ++-- .../Modules/World/Terrain/FileLoaders/TIFF.cs | 6 +- .../Modules/World/Terrain/FileLoaders/Terragen.cs | 10 +-- .../Modules/World/Terrain/ITerrainModule.cs | 6 +- .../Modules/World/Terrain/TerrainModule.cs | 16 ++-- .../Modules/World/WorldMap/MapImageModule.cs | 12 +-- .../Modules/World/WorldMap/WorldMapModule.cs | 35 ++++----- 34 files changed, 327 insertions(+), 373 deletions(-) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs index 10ef766..e6ee75f 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/UserTextureDownloadService.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + /// /// True if the service has been closed, probably because a user with texture requests still queued /// logged out. @@ -175,7 +175,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload public void TextureCallback(LLUUID textureID, AssetBase texture) { //m_log.DebugFormat("[USER TEXTURE DOWNLOAD SERVICE]: Calling TextureCallback with {0}, texture == null is {1}", textureID, (texture == null ? true : false)); - + // There may still be texture requests pending for a logged out client if (closed) return; @@ -247,7 +247,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload internal void Close() { closed = true; - + lock (m_textureSenders) { foreach (TextureSender.TextureSender textureSender in m_textureSenders.Values) @@ -257,7 +257,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload m_textureSenders.Clear(); } - + // XXX: It might be possible to also remove pending texture requests from the asset cache queues, // though this might also be more trouble than it's worth. } diff --git a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs index c5a4a96..4a98622 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs @@ -186,7 +186,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends client.OnTerminateFriendship += OnTerminateFriendship; doFriendListUpdateOnline(client.AgentId); - + } private void doFriendListUpdateOnline(LLUUID AgentId) @@ -386,7 +386,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends { m_rootAgents.Add(avatar.UUID, avatar.RegionHandle); m_log.Info("[FRIEND]: Claiming " + avatar.Firstname + " " + avatar.Lastname + " in region:" + avatar.RegionHandle + "."); - + List updateme = new List(); lock (StoredFriendListUpdates) { @@ -546,7 +546,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, (uint) 1); - + //LLUUID[] Agents = new LLUUID[1]; //Agents[0] = msg.toAgentID; diff --git a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs index a83730e..eaa5013 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Groups/GroupsModule.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups scene.EventManager.OnGridInstantMessageToGroupsModule += OnGridInstantMessage; lock (m_groupUUIDGroup) { - + GroupData OpenSimulatorGroup = new GroupData(); OpenSimulatorGroup.ActiveGroupTitle = "OpenSimulator Tester"; OpenSimulatorGroup.GroupID = opensimulatorGroupID; @@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups } } - + lock (m_groupmap) { if (!m_groupmap.ContainsKey(client.AgentId)) @@ -159,8 +159,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups updateGroups[0] = OpenSimulatorGroup; client.SendGroupMembership(updateGroups); - - } private void OnAgentDataUpdateRequest(IClientAPI remoteClient, LLUUID AgentID, LLUUID SessionID) @@ -275,6 +273,4 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups GC.Collect(); } } - - -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs index a3452ab..15ce584 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -208,7 +208,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture SceneObjectPart part = scene.GetSceneObjectPart(PrimID); byte[] assetData; AssetBase oldAsset = null; - + if (BlendWithOldTexture) { LLUUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID; @@ -228,7 +228,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture assetData = new byte[data.Length]; Array.Copy(data, assetData, data.Length); } - + // Create a new asset for user AssetBase asset = new AssetBase(); asset.FullID = LLUUID.Random(); @@ -244,7 +244,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture // mostly keep the values from before LLObject.TextureEntry tmptex = part.Shape.Textures; - + // remove the old asset from the cache LLUUID oldID = tmptex.DefaultTexture.TextureID; scene.AssetCache.ExpireAsset(oldID); @@ -298,4 +298,4 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs index 1162c25..bcf3e76 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/EMailModules/EmailModule.cs @@ -68,14 +68,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules { m_Config = config; IConfig SMTPConfig; - + //FIXME: RegionName is correct?? //m_RegionName = scene.RegionInfo.RegionName; IConfig startupConfig = m_Config.Configs["Startup"]; m_Enabled = (startupConfig.GetString("emailmodule", "DefaultEmailModule") == "DefaultEmailModule"); - + //Load SMTP SERVER config try { @@ -85,16 +85,16 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules m_Enabled = false; return; } - + if (!SMTPConfig.GetBoolean("enabled", false)) { m_log.InfoFormat("[SMTP] module disabled in configuration"); m_Enabled = false; return; } - + m_HostName = SMTPConfig.GetString("host_domain_header_from", m_HostName); - SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME",SMTP_SERVER_HOSTNAME); + SMTP_SERVER_HOSTNAME = SMTPConfig.GetString("SMTP_SERVER_HOSTNAME",SMTP_SERVER_HOSTNAME); SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); @@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); } } - + m_log.Info("[EMAIL] Activated DefaultEmailModule"); } } @@ -146,9 +146,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules { get { return true; } } - + /// - /// + /// /// /// private void DelayInSeconds(int seconds) @@ -156,11 +156,11 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules TimeSpan DiffDelay = new TimeSpan(0, 0, seconds); DateTime EndDelay = DateTime.Now.Add(DiffDelay); while (DateTime.Now < EndDelay) - { + { ;//Do nothing!! } } - + private SceneObjectPart findPrim(LLUUID objectID, out string ObjectRegionName) { lock (m_Scenes) @@ -187,7 +187,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules { ObjectAbsolutePosition = part.AbsolutePosition.ToString(); ObjectName = part.Name; - ObjectRegionName = m_ObjectRegionName; + ObjectRegionName = m_ObjectRegionName; return; } ObjectAbsolutePosition = part.AbsolutePosition.ToString(); @@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules ObjectRegionName = m_ObjectRegionName; return; } - + /// /// SendMail function utilized by llEMail /// @@ -206,14 +206,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules public void SendEmail(LLUUID objectID, string address, string subject, string body) { //Check if address is empty - if (address == string.Empty) + if (address == string.Empty) return; - + //FIXED:Check the email is correct form in REGEX - string EMailpatternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+" - + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@" - + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" - + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+" + string EMailpatternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+" + + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@" + + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" + + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+" + @"[a-zA-Z]{2,}))$"; Regex EMailreStrict = new Regex(EMailpatternStrict); bool isEMailStrictMatch = EMailreStrict.IsMatch(address); @@ -226,9 +226,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules if ((subject.Length + body.Length) > 1024) { m_log.Error("[EMAIL] subject + body > 1024 Byte"); - return; + return; } - + try { string LastObjectName = string.Empty; @@ -242,21 +242,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules //From emailMessage.FromAddress = new EmailAddress(objectID.UUID.ToString()+"@"+m_HostName); //To - Only One - emailMessage.AddToAddress(new EmailAddress(address)); + emailMessage.AddToAddress(new EmailAddress(address)); //Subject emailMessage.Subject = subject; //TEXT Body resolveNamePositionRegionName(objectID, out LastObjectName, out LastObjectPosition, out LastObjectRegionName); emailMessage.TextPart = new TextAttachment("Object-Name: " + LastObjectName + "\r\nRegion: " + LastObjectRegionName + "\r\nLocal-Position: " + - LastObjectPosition+"\r\n\r\n\r\n" + body); + LastObjectPosition+"\r\n\r\n\r\n" + body); //HTML Body - emailMessage.HtmlPart = new HtmlAttachment("

" + + emailMessage.HtmlPart = new HtmlAttachment("

" + "
Object-Name: " + LastObjectName + "
Region: " + LastObjectRegionName + "
Local-Position: " + LastObjectPosition + "


" +body+"\r\n

"); - + //Set SMTP SERVER config SmtpServer smtpServer=new SmtpServer(SMTP_SERVER_HOSTNAME,SMTP_SERVER_PORT); //Authentication @@ -272,9 +272,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.EmailModules return; } } - + /// - /// + /// /// /// /// diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs index a5688ef..a76ff0d 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs @@ -39,33 +39,33 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver /// The location of the archive control file ///
public static readonly string CONTROL_FILE_PATH = "archive.xml"; - + /// /// Path for the assets held in an archive /// public static readonly string ASSETS_PATH = "assets/"; - + /// /// Path for the assets metadata file /// //public static readonly string ASSETS_METADATA_PATH = "assets.xml"; - + /// /// Path for the prims file /// public static readonly string OBJECTS_PATH = "objects/"; - + /// /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out. /// public static readonly string TERRAINS_PATH = "terrains/"; - + /// /// Extensions used for asset types in the archive /// public static readonly IDictionary ASSET_TYPE_TO_EXTENSION = new Dictionary(); public static readonly IDictionary EXTENSION_TO_ASSET_TYPE = new Dictionary(); - + static ArchiveConstants() { ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = "_animation.bvh"; @@ -79,11 +79,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = "_lostandfoundfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = "_bytecode.lso"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = "_script.lsl"; - ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = "_notecard.txt"; + ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = "_notecard.txt"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = "_object.xml"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = "_rootfolder.txt"; // Not sure if we'll ever see this // disable warning: we know Script is obsolete, but need to support it -// anyhow +// anyhow #pragma warning disable 0612 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = "_script.txt"; // Not sure if we'll ever see this #pragma warning restore 0612 @@ -93,8 +93,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = "_sound.wav"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = "_texture.jp2"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = "_texture.tga"; - ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = "_trashfolder.txt"; // Not sure if we'll ever see this - + ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = "_trashfolder.txt"; // Not sure if we'll ever see this + EXTENSION_TO_ASSET_TYPE["_animation.bvh"] = (sbyte)AssetType.Animation; EXTENSION_TO_ASSET_TYPE["_bodypart.txt"] = (sbyte)AssetType.Bodypart; EXTENSION_TO_ASSET_TYPE["_callingcard.txt"] = (sbyte)AssetType.CallingCard; @@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver EXTENSION_TO_ASSET_TYPE["_object.xml"] = (sbyte)AssetType.Object; EXTENSION_TO_ASSET_TYPE["_rootfolder.txt"] = (sbyte)AssetType.RootFolder; // disable warning: we know Script is obsolete, but need to support it -// anyhow +// anyhow #pragma warning disable 0612 EXTENSION_TO_ASSET_TYPE["_script.txt"] = (sbyte)AssetType.Script; #pragma warning restore 0612 diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 1340f8b..87106fb 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver private Scene m_scene; private string m_loadPath; - + /// /// Used to cache lookups for valid uuids. /// @@ -68,15 +68,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver } private void DearchiveRegion() - { - TarArchiveReader archive + { + TarArchiveReader archive = new TarArchiveReader( - new GZipStream(new FileStream(m_loadPath, FileMode.Open), CompressionMode.Decompress)); + new GZipStream(new FileStream(m_loadPath, FileMode.Open), CompressionMode.Decompress)); //AssetsDearchiver dearchiver = new AssetsDearchiver(m_scene.AssetCache); List serialisedSceneObjects = new List(); string filePath = "ERROR"; - + int successfulAssetRestores = 0; int failedAssetRestores = 0; @@ -111,30 +111,30 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver //m_log.Debug("[ARCHIVER]: Reached end of archive"); archive.Close(); - + m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); - + if (failedAssetRestores > 0) m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); - m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); + m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); m_scene.DeleteAllSceneObjects(); - + // Reload serialized prims m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); IRegionSerialiser serialiser = m_scene.RequestModuleInterface(); - ICollection sceneObjects = new List(); + ICollection sceneObjects = new List(); foreach (string serialisedSceneObject in serialisedSceneObjects) - { + { SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); - + // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned // on the same region server and multiple examples a single object archive to be imported // to the same scene (when this is possible). sceneObject.ResetIDs(); - + // Try to retain the original creator/owner/lastowner if their uuid is present on this grid // otherwise, use the master avatar uuid instead LLUUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; @@ -144,41 +144,41 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { if (!resolveUserUuid(part.CreatorID)) part.CreatorID = masterAvatarId; - + if (!resolveUserUuid(part.OwnerID)) part.OwnerID = masterAvatarId; - + if (!resolveUserUuid(part.LastOwnerID)) - part.LastOwnerID = masterAvatarId; - + part.LastOwnerID = masterAvatarId; + // And zap any troublesome sit target information part.SitTargetOrientation = new Quaternion(0,0,0,1); part.SitTargetPosition = new Vector3(0,0,0); - } - + } + if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) - { + { sceneObjects.Add(sceneObject); } - } - + } + m_log.InfoFormat("[ARCHIVER]: Restored {0} scene objects to the scene", sceneObjects.Count); - + int ignoredObjects = serialisedSceneObjects.Count - sceneObjects.Count; - + if (ignoredObjects > 0) m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); - + m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); - + m_log.Debug("[ARCHIVER]: Starting scripts"); - + foreach (SceneObjectGroup sceneObject in sceneObjects) { sceneObject.CreateScriptInstances(0, true); - } + } } - + /// /// Look up the given user id to check whether it's one that is valid for this grid. /// @@ -194,13 +194,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver else m_validUserUuids.Add(uuid, false); } - + if (m_validUserUuids[uuid]) return true; else - return false; + return false; } - + /// /// Load an asset /// @@ -212,20 +212,20 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver // Right now we're nastily obtaining the lluuid from the filename string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); string extension = filename.Substring(filename.LastIndexOf("_")); - string uuid = filename.Remove(filename.Length - extension.Length); - + string uuid = filename.Remove(filename.Length - extension.Length); + if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) { sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; - + //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); - + AssetBase asset = new AssetBase(new LLUUID(uuid), String.Empty); asset.Type = assetType; asset.Data = data; - + m_scene.AssetCache.AddAsset(asset); - + return true; } else @@ -233,11 +233,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_log.ErrorFormat( "[ARCHIVER]: Tried to dearchive data with path {0} with an unknown type extension {1}", assetPath, extension); - + return false; } } - + /// /// Load terrain data /// @@ -249,13 +249,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver private bool LoadTerrain(string terrainPath, byte[] data) { ITerrainModule terrainModule = m_scene.RequestModuleInterface(); - + MemoryStream ms = new MemoryStream(data); terrainModule.LoadFromStream(terrainPath, ms); ms.Close(); - + m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath); - + return true; } } diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs index 0341a70..26d4797 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -61,8 +61,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver public ArchiveWriteRequestExecution( List sceneObjects, - ITerrainModule terrainModule, - IRegionSerialiser serialiser, + ITerrainModule terrainModule, + IRegionSerialiser serialiser, string sceneName, string savePath) { @@ -79,37 +79,37 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); } - + m_log.InfoFormat( "[ARCHIVER]: Received {0} of {1} assets requested", assetsFound.Count, assetsFound.Count + assetsNotFoundUuids.Count); TarArchiveWriter archive = new TarArchiveWriter(); - + // Write out control file archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile()); - + // Write out terrain string terrainPath = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_sceneName); - MemoryStream ms = new MemoryStream(); + MemoryStream ms = new MemoryStream(); m_terrainModule.SaveToStream(terrainPath, ms); - archive.AddFile(terrainPath, ms.ToArray()); + archive.AddFile(terrainPath, ms.ToArray()); ms.Close(); - + // Write out scene object metadata foreach (SceneObjectGroup sceneObject in m_sceneObjects) { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); - + LLVector3 position = sceneObject.AbsolutePosition; - + string serializedObject = m_serialiser.SaveGroupToXml2(sceneObject); - string filename + string filename = string.Format( "{0}{1}_{2:000}-{3:000}-{4:000}__{5}.xml", - ArchiveConstants.OBJECTS_PATH, sceneObject.Name, - Math.Round(position.X), Math.Round(position.Y), Math.Round(position.Z), + ArchiveConstants.OBJECTS_PATH, sceneObject.Name, + Math.Round(position.X), Math.Round(position.Y), Math.Round(position.Z), sceneObject.UUID); - + archive.AddFile(filename, serializedObject); } @@ -120,8 +120,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver archive.WriteTar(new GZipStream(new FileStream(m_savePath, FileMode.Create), CompressionMode.Compress)); m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath); - } - + } + /// /// Create the control file for this archive /// @@ -136,13 +136,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver xtw.WriteAttributeString("major_version", "0"); xtw.WriteAttributeString("minor_version", "1"); xtw.WriteEndElement(); - + xtw.Flush(); xtw.Close(); - + String s = sw.ToString(); sw.Close(); - + return s; } } diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs index 327808a..20e15ab 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -52,14 +52,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver protected Scene m_scene; protected string m_savePath; - + /// /// Used for identifying uuids embedded in scripts /// - protected static readonly Regex m_uuidRegex + protected static readonly Regex m_uuidRegex = new Regex( - "[0-9a-eA-E]{8}-[0-9a-eA-E]{4}-[0-9a-eA-E]{4}-[0-9a-eA-E]{4}-[0-9a-eA-E]{12}", - RegexOptions.Compiled); + "[0-9a-eA-E]{8}-[0-9a-eA-E]{4}-[0-9a-eA-E]{4}-[0-9a-eA-E]{4}-[0-9a-eA-E]{12}", + RegexOptions.Compiled); /// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate @@ -93,9 +93,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver Monitor.Pulse(this); } } - + /// - /// Get an asset synchronously, potentially using an asynchronous callback. If the + /// Get an asset synchronously, potentially using an asynchronous callback. If the /// asynchronous callback is used, we will wait for it to complete. /// /// @@ -118,11 +118,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver Monitor.Wait(this); m_waitingForObjectAsset = false; } - } - + } + return m_requestedObjectAsset; } - + /// /// Record the asset uuids embedded within the given script. /// @@ -138,16 +138,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver //m_log.DebugFormat("[ARCHIVER]: Script {0}", script); MatchCollection uuidMatches = m_uuidRegex.Matches(script); //m_log.DebugFormat("[ARCHIVER]: Found {0} matches in script", uuidMatches.Count); - + foreach (Match uuidMatch in uuidMatches) { LLUUID uuid = new LLUUID(uuidMatch.Value); //m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid); assetUuids[uuid] = 1; } - } + } } - + /// /// Record the uuids referenced by the given wearable asset /// @@ -159,25 +159,25 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); AssetWearable wearableAsset = new AssetBodypart(assetBase.Data); wearableAsset.Decode(); - + //m_log.DebugFormat( // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); - + foreach (LLUUID uuid in wearableAsset.Textures.Values) { //m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid); assetUuids[uuid] = 1; } } - + /// /// Get all the asset uuids associated with a given object. This includes both those directly associated with /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained /// within this object). /// /// - /// - protected void GetSceneObjectAssetUuids(LLUUID sceneObjectUuid, IDictionary assetUuids) + /// + protected void GetSceneObjectAssetUuids(LLUUID sceneObjectUuid, IDictionary assetUuids) { AssetBase objectAsset = GetAsset(sceneObjectUuid); @@ -186,7 +186,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver string xml = Helpers.FieldToUTF8String(objectAsset.Data); SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml); GetSceneObjectAssetUuids(sog, assetUuids); - } + } } /// @@ -209,10 +209,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver try { LLObject.TextureEntry textureEntry = part.Shape.Textures; - + // Get the prim's default texture. This will be used for faces which don't have their own texture assetUuids[textureEntry.DefaultTexture.TextureID] = 1; - + // XXX: Not a great way to iterate through face textures, but there's no // other method available to tell how many faces there actually are //int i = 0; @@ -224,15 +224,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver assetUuids[texture.TextureID] = 1; } } - + foreach (TaskInventoryItem tii in part.TaskInventory.Values) { //m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type); - + if (!assetUuids.ContainsKey(tii.AssetID)) { assetUuids[tii.AssetID] = 1; - + if ((int)AssetType.Bodypart == tii.Type || ((int)AssetType.Clothing == tii.Type)) { GetWearableAssetUuids(tii.AssetID, assetUuids); @@ -275,20 +275,20 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver if (entity is SceneObjectGroup) sceneObjects.Add((SceneObjectGroup)entity); } - + foreach (SceneObjectGroup sceneObject in sceneObjects) { GetSceneObjectAssetUuids(sceneObject, assetUuids); } m_log.DebugFormat( - "[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets", + "[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets", sceneObjects.Count, assetUuids.Count); // Asynchronously request all the assets required to perform this archive operation - ArchiveWriteRequestExecution awre + ArchiveWriteRequestExecution awre = new ArchiveWriteRequestExecution( - sceneObjects, + sceneObjects, m_scene.RequestModuleInterface(), m_scene.RequestModuleInterface(), m_scene.RegionInfo.RegionName, diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs index 2704224..708bed3 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs @@ -41,17 +41,17 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver public class AssetsArchiver { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + /// /// Archive assets /// protected IDictionary m_assets; - + public AssetsArchiver(IDictionary assets) { m_assets = assets; } - + /// /// Archive the assets given to this archiver to the given archive. /// @@ -70,44 +70,44 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); - + xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); - + xtw.WriteStartElement("assets"); - + foreach (LLUUID uuid in m_assets.Keys) { AssetBase asset = m_assets[uuid]; - + if (asset != null) { xtw.WriteStartElement("asset"); - + string extension = string.Empty; - + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) { extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; - } - + } + xtw.WriteElementString("filename", uuid.ToString() + extension); - + xtw.WriteElementString("name", asset.Name); xtw.WriteElementString("description", asset.Description); xtw.WriteElementString("asset-type", asset.Type.ToString()); - + xtw.WriteEndElement(); } } - + xtw.WriteEndElement(); - + xtw.WriteEndDocument(); - + archive.AddFile("assets.xml", sw.ToString()); } - + /// /// Write asset data files to the given archive /// @@ -116,18 +116,18 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { // It appears that gtar, at least, doesn't need the intermediate directory entries in the tar //archive.AddDir("assets"); - + foreach (LLUUID uuid in m_assets.Keys) { AssetBase asset = m_assets[uuid]; - + string extension = string.Empty; - + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) { extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; } - + archive.AddFile( ArchiveConstants.ASSETS_PATH + uuid.ToString() + extension, asset.Data); diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs index 284a39e..17abb24 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs @@ -43,9 +43,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver public class AssetsDearchiver { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); - + /// /// Store for asset data we received before we get the metadata /// @@ -55,17 +55,17 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver /// Asset metadata. Is null if asset metadata isn't yet available. /// protected Dictionary m_metadata; - + /// /// Cache to which dearchived assets will be added /// protected AssetCache m_cache; - + public AssetsDearchiver(AssetCache cache) { m_cache = cache; } - + /// /// Add asset data to the dearchiver /// @@ -82,7 +82,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver ResolveAssetData(assetFilename, data); } } - + /// /// Add asset metadata xml /// @@ -90,39 +90,39 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver public void AddAssetMetadata(string xml) { m_metadata = new Dictionary(); - + StringReader sr = new StringReader(xml); XmlTextReader reader = new XmlTextReader(sr); - + reader.ReadStartElement("assets"); reader.Read(); - + while (reader.Name.Equals("asset")) { reader.Read(); - + AssetMetadata metadata = new AssetMetadata(); - + string filename = reader.ReadElementString("filename"); m_log.DebugFormat("[DEARCHIVER]: Reading node {0}", filename); - + metadata.Name = reader.ReadElementString("name"); metadata.Description = reader.ReadElementString("description"); metadata.AssetType = Convert.ToSByte(reader.ReadElementString("asset-type")); - + m_metadata[filename] = metadata; - + // Read asset end tag reader.ReadEndElement(); - + reader.Read(); } - + m_log.DebugFormat("[DEARCHIVER]: Resolved {0} items of asset metadata", m_metadata.Count); - + ResolvePendingAssetData(); } - + /// /// Resolve asset data that we collected before receiving the metadata /// @@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver ResolveAssetData(filename, m_assetDataAwaitingMetadata[filename]); } } - + /// /// Resolve a new piece of asset data against stored metadata /// @@ -143,11 +143,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver { // Right now we're nastily obtaining the lluuid from the filename string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); - + if (m_metadata.ContainsKey(filename)) { AssetMetadata metadata = m_metadata[filename]; - + if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(metadata.AssetType)) { string extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[metadata.AssetType]; @@ -166,11 +166,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver else { m_log.ErrorFormat( - "[DEARCHIVER]: Tried to dearchive data with filename {0} without any corresponding metadata", + "[DEARCHIVER]: Tried to dearchive data with filename {0} without any corresponding metadata", assetPath); } } - + /// /// Metadata for an asset /// diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsRequest.cs index 6ffbcbb..2164f7e 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsRequest.cs @@ -43,12 +43,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver class AssetsRequest { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + /// /// uuids to request /// protected ICollection m_uuids; - + /// /// Callback used when all the assets requested have been received. /// @@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver /// Assets retrieved in this request /// protected Dictionary m_assets = new Dictionary(); - + /// /// Maintain a list of assets that could not be found. This will be passed back to the requester. /// @@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_assetCache = assetCache; m_repliesRequired = uuids.Count; } - + protected internal void Execute() { // We can stop here if there are no assets to fetch @@ -105,7 +105,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver m_assets[assetID] = asset; else m_notFoundAssetUuids.Add(assetID); - + //m_log.DebugFormat( // "[ARCHIVER]: Received {0} assets and notification of {1} missing assets", m_assets.Count, m_notFoundAssetUuids.Count); diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs index 585d1d4..4e000cc 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs @@ -69,9 +69,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver public byte[] ReadEntry(out string filePath) { filePath = String.Empty; - + TarHeader header = ReadHeader(); - + if (null == header) return null; @@ -98,14 +98,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver /// /// A tar header struct. null if we have reached the end of the archive. protected TarHeader ReadHeader() - { + { byte[] header = m_br.ReadBytes(512); - + // If we've reached the end of the archive we'll be in null block territory, which means - // the next byte will be 0 + // the next byte will be 0 if (header[0] == 0) return null; - + TarHeader tarHeader = new TarHeader(); tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs index f70a93d..83b9250 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs @@ -54,10 +54,10 @@ namespace OpenSim.Region.Environment // Directories are signalled by a final / if (!dirName.EndsWith("/")) dirName += "/"; - + AddFile(dirName, new byte[0]); } - + /// /// Add a file to the tar archive /// @@ -161,7 +161,7 @@ namespace OpenSim.Region.Environment if (data.Length % 512 != 0) { int paddingRequired = 512 - (data.Length % 512); - + //m_log.DebugFormat("[TAR ARCHIVE WRITER]: Padding data with {0} bytes", paddingRequired); byte[] padding = new byte[paddingRequired]; diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 1e622be..28347d0 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs @@ -223,7 +223,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, false) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) { EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; - + bool alreadyInList = false; for (int i = 0; i < banlistcheck.Length; i++) @@ -407,8 +407,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; args.simName = m_scene.RegionInfo.RegionName; - - + remote_client.SendRegionInfoToEstateMenu(args); } @@ -416,6 +415,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate { remote_client.SendEstateCovenantInformation(m_scene.RegionInfo.RegionSettings.Covenant); } + private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) { Dictionary SceneData = new Dictionary(); @@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate continue; } } - + SceneReport.Add(lsri); } } @@ -481,7 +481,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate } } remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); - + if (uuidNameLookupList.Count > 0) LookupUUID(uuidNameLookupList); } @@ -502,7 +502,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate private void LookupUUIDsAsync(List uuidLst) { LLUUID[] uuidarr = new LLUUID[0]; - + lock (uuidLst) { uuidarr = uuidLst.ToArray(); @@ -539,7 +539,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate if (EstateManagers[i] == remoteClient.AgentId) estatemanager = true; } - + args.isEstateManager = estatemanager; args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; @@ -729,11 +729,11 @@ namespace OpenSim.Region.Environment.Modules.World.Estate client.OnLandStatRequest += HandleLandStatRequest; sendRegionHandshake(client); } - + public uint GetRegionFlags() { Simulator.RegionFlags flags = Simulator.RegionFlags.None; - + // Fully implemented // if (m_scene.RegionInfo.RegionSettings.AllowDamage) diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index 9b1b9b5..00994fb 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -47,14 +47,12 @@ namespace OpenSim.Region.Environment.Modules.World.Land { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + private static readonly string remoteParcelRequestPath = "0009/"; - + private LandChannel landChannel; private Scene m_scene; - - private readonly int[,] landIDList = new int[64, 64]; private readonly Dictionary landList = new Dictionary(); @@ -115,8 +113,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land } } - - public void PostInitialise() { } @@ -153,8 +149,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land } } - - public bool AllowedForcefulBans { get { return m_allowedForcefulBans; } @@ -185,11 +179,9 @@ namespace OpenSim.Region.Environment.Modules.World.Land public List ParcelsNearPoint(LLVector3 position) { List parcelsNear = new List(); - int x; - for (x = -4; x <= 4; x += 4) + for (int x = -4; x <= 4; x += 4) { - int y; - for (y = -4; y <= 4; y += 4) + for (int y = -4; y <= 4; y += 4) { ILandObject check = GetLandObject(position.X + x, position.Y + y); if (check != null) @@ -286,7 +278,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land ILandObject over = GetLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); - if (over != null) { if (force) @@ -387,6 +378,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land Console.WriteLine("INVALID LOCAL LAND ID"); } } + /// /// Creates a basic Parcel object without an owner (a zeroed key) /// @@ -406,13 +398,10 @@ namespace OpenSim.Region.Environment.Modules.World.Land new_land.landData.LocalID = lastLandLocalID; landList.Add(lastLandLocalID, new_land.Copy()); - bool[,] landBitmap = new_land.getLandBitmap(); - int x; - for (x = 0; x < 64; x++) + for (int x = 0; x < 64; x++) { - int y; - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { if (landBitmap[x, y]) { @@ -431,11 +420,9 @@ namespace OpenSim.Region.Environment.Modules.World.Land /// Land.localID of the peice of land to remove. public void removeLandObject(int local_id) { - int x; - for (x = 0; x < 64; x++) + for (int x = 0; x < 64; x++) { - int y; - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { if (landIDList[x, y] == local_id) { @@ -451,12 +438,10 @@ namespace OpenSim.Region.Environment.Modules.World.Land private void performFinalLandJoin(ILandObject master, ILandObject slave) { - int x; bool[,] landBitmapSlave = slave.getLandBitmap(); - for (x = 0; x < 64; x++) + for (int x = 0; x < 64; x++) { - int y; - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { if (landBitmapSlave[x, y]) { @@ -519,6 +504,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land } return landList[landIDList[x / 4, y / 4]]; } + #endregion #region Parcel Modification @@ -601,7 +587,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land ResetAllLandPrimCounts(); lock (m_scene.Entities) { - foreach (EntityBase obj in m_scene.Entities.Values) + foreach (EntityBase obj in m_scene.Entities.Values) { if (obj != null) { @@ -647,11 +633,9 @@ namespace OpenSim.Region.Environment.Modules.World.Land { int totalX = end_x - start_x; int totalY = end_y - start_y; - int y; - for (y = 0; y < totalY; y++) + for (int y = 0; y < totalY; y++) { - int x; - for (x = 0; x < totalX; x++) + for (int x = 0; x < totalX; x++) { ILandObject tempLandObject = GetLandObject(start_x + x, start_y + y); if (tempLandObject == null) return; @@ -690,9 +674,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land ILandObject result = AddLandObject(newLand); UpdateLandObject(startLandObject.landData.LocalID, startLandObject.landData); result.sendLandUpdateToAvatarsOverMe(); - - - return; } /// @@ -730,7 +711,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land ILandObject masterLandObject = selectedLandObjects[0]; selectedLandObjects.RemoveAt(0); - if (selectedLandObjects.Count < 1) { return; @@ -753,12 +733,9 @@ namespace OpenSim.Region.Environment.Modules.World.Land performFinalLandJoin(masterLandObject, slaveLandObject); } - SetPrimsTainted(); masterLandObject.sendLandUpdateToAvatarsOverMe(); - - return; } #endregion @@ -777,17 +754,14 @@ namespace OpenSim.Region.Environment.Modules.World.Land int byteArrayCount = 0; int sequenceID = 0; - int y; - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { - int x; - for (x = 0; x < 64; x++) + for (int x = 0; x < 64; x++) { byte tempByte = 0; //This represents the byte for the current 4x4 ILandObject currentParcelBlock = GetLandObject(x * 4, y * 4); - if (currentParcelBlock != null) { if (currentParcelBlock.landData.OwnerID == remote_client.AgentId) @@ -813,7 +787,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER); } - //Now for border control ILandObject westParcel = null; @@ -864,14 +837,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land { //Get the land objects within the bounds List temp = new List(); - int x; - int i; int inc_x = end_x - start_x; int inc_y = end_y - start_y; - for (x = 0; x < inc_x; x++) + for (int x = 0; x < inc_x; x++) { - int y; - for (y = 0; y < inc_y; y++) + for (int y = 0; y < inc_y; y++) { ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); @@ -892,12 +862,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land requestResult = LandChannel.LAND_RESULT_MULTIPLE; } - for (i = 0; i < temp.Count; i++) + for (int i = 0; i < temp.Count; i++) { temp[i].sendLandProperties(sequence_id, snap_selection, requestResult, remote_client); } - SendParcelOverlay(remote_client); } @@ -921,7 +890,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) { - landList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); } @@ -954,7 +922,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land landList[local_id].sendLandUpdateToClient(remote_client); } } - } public void handleParcelReclaim(int local_id, IClientAPI remote_client) @@ -972,7 +939,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land landList[local_id].sendLandUpdateToClient(remote_client); } } - } #endregion @@ -1076,7 +1042,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land { selectedParcel.returnLandObjects(returnType, agentIDs, remoteClient); } - } public void NoLandDataFromStorage() @@ -1093,11 +1058,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land obj.setParcelObjectMaxOverride(overrideDel); } } + public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) { } #region CAPS handler + private void OnRegisterCaps(LLUUID agentID, Caps caps) { string capsBase = "/CAPS/" + caps.CapsObjectPath; @@ -1109,7 +1076,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land return RemoteParcelRequest(request, path, param, agentID, caps); })); } - + // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x @@ -1171,11 +1138,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land { m_log.ErrorFormat("[LAND] Wrong type in request {0}", request); } - + LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse(); response.parcel_id = parcelID; m_log.DebugFormat("[LAND] got parcelID {0}", parcelID); - + return LLSDHelpers.SerialiseLLSDReply(response); } @@ -1191,7 +1158,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land uint x, y; Util.ParseFakeParcelID(parcelID, out regionHandle, out x, out y); m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", regionHandle, x, y); - + LandData landData; if (regionHandle == m_scene.RegionInfo.RegionHandle) landData = this.GetLandObject(x, y).landData; diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index 305e236..6388a1c 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs @@ -116,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land return newLand; } - + static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; @@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land } } #endregion - + #region Packet Request Handling public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 7b05027..09f12b2 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -305,7 +305,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event RegionHandleRequest OnRegionHandleRequest; public event ParcelInfoRequest OnParcelInfoRequest; - + #pragma warning restore 67 #endregion @@ -368,7 +368,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC { get { return 0; } } - + public ulong GetGroupPowers(LLUUID groupID) { return 0; @@ -820,13 +820,13 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time) - { + { } public void SendParcelMediaUpdate(string mediaUrl, LLUUID mediaTextureID, byte autoScale, string mediaType, string mediaDesc, int mediaWidth, int mediaHeight, byte mediaLoop) - { + { } public void SendSetFollowCamProperties (LLUUID objectID, SortedDictionary parameters) diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 6107f48..071e3af 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs @@ -146,7 +146,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); - + if (m_bypassPermissions) m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks"); else diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index 0df19d9..22c9b29 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Scenes public class SceneXmlLoader { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset) { XmlDocument doc = new XmlDocument(); @@ -114,7 +114,7 @@ namespace OpenSim.Region.Environment.Scenes doc.Load(reader); reader.Close(); rootNode = doc.FirstChild; - + // This is to deal with neighbouring regions that are still surrounding the group xml with the // tag. It should be possible to remove the first part of this if statement once we go past 0.5.9 (or // when some other changes forces all regions to upgrade). @@ -127,13 +127,13 @@ namespace OpenSim.Region.Environment.Scenes // There is only ever one prim. This oddity should be removeable post 0.5.9 return new SceneObjectGroup(aPrimNode.OuterXml); } - + return null; } else { return new SceneObjectGroup(rootNode.OuterXml); - } + } } /// @@ -171,7 +171,7 @@ namespace OpenSim.Region.Environment.Scenes reader.Close(); XmlNode rootNode = doc.FirstChild; - ICollection sceneObjects = new List(); + ICollection sceneObjects = new List(); foreach (XmlNode aPrimNode in rootNode.ChildNodes) { SceneObjectGroup obj = CreatePrimFromXml2(scene, aPrimNode.OuterXml); @@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectGroup obj = new SceneObjectGroup(xmlData); - if (scene.AddRestoredSceneObject(obj, true, false)) + if (scene.AddRestoredSceneObject(obj, true, false)) return obj; else return null; @@ -254,7 +254,7 @@ namespace OpenSim.Region.Environment.Scenes if (max.X < pos.X || max.Y < pos.Y || max.Z < pos.Z) continue; } - + stream.WriteLine(g.ToXmlString2()); primCount++; } diff --git a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs index 5682de3..9690433 100644 --- a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules private LLVector3 Position = new LLVector3(0,0,0); private LLVector3 Velocity = new LLVector3(0,0,0); private LLQuaternion Tilt = new LLQuaternion(1,0,0,0); - + private long LindenHourOffset = 0; private bool sunFixed = false; @@ -111,7 +111,7 @@ namespace OpenSim.Region.Environment.Modules private float GetLindenEstateHourFromCurrentTime() { float ticksleftover = ((float)CurrentTime) % ((float)SecondsPerSunCycle); - + float hour = (24 * (ticksleftover / SecondsPerSunCycle)) + 6; return hour; @@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Modules float hour = (24 * (ticksleftover / SecondsPerSunCycle)); float offsethours = 0; - + if (LindenHour - 6 > hour) { offsethours = hour + ((LindenHour-6) - hour); @@ -142,7 +142,7 @@ namespace OpenSim.Region.Environment.Modules offsethours = hour - (hour - (LindenHour - 6)); } //m_log.Debug("[OFFSET]: " + hour + " - " + LindenHour + " - " + offsethours.ToString()); - + LindenHourOffset = (long)((float)offsethours * (36000000000/m_day_length)); m_log.Info("[SUN]: Directive from the Estate Tools to set the sun phase to LindenHour " + GetLindenEstateHourFromCurrentTime().ToString()); @@ -422,7 +422,7 @@ namespace OpenSim.Region.Environment.Modules } } } - + public void EstateToolsTimeUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float LindenHour) { if (m_scene.RegionInfo.RegionHandle == regionHandle) diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/BMP.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/BMP.cs index 34bbf78..48da96d 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/BMP.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/BMP.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders colours.Save(filename, ImageFormat.Bmp); } - + /// /// Exports a stream using a System.Drawing exporter. /// @@ -62,7 +62,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders Bitmap colours = CreateGrayscaleBitmapFromMap(map); colours.Save(stream, ImageFormat.Png); - } + } /// /// The human readable version of the file format(s) this loader handles @@ -73,4 +73,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders return "BMP"; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/GIF.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/GIF.cs index 0cd9000..accffd2 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/GIF.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/GIF.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders colours.Save(filename, ImageFormat.Gif); } - + /// /// Exports a stream using a System.Drawing exporter. /// @@ -51,11 +51,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders Bitmap colours = CreateGrayscaleBitmapFromMap(map); colours.Save(stream, ImageFormat.Gif); - } + } public override string ToString() { return "GIF"; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 4d213e0..983ad29 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/GenericSystemDrawing.cs @@ -58,19 +58,19 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders /// A terrain channel generated from the image. public virtual ITerrainChannel LoadFile(string filename) { - return LoadBitmap(new Bitmap(filename)); + return LoadBitmap(new Bitmap(filename)); } public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) { throw new NotImplementedException(); } - + public virtual ITerrainChannel LoadStream(Stream stream) { return LoadBitmap(new Bitmap(stream)); } - + protected virtual ITerrainChannel LoadBitmap(Bitmap bitmap) { ITerrainChannel retval = new TerrainChannel(bitmap.Width, bitmap.Height); @@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders } } - return retval; + return retval; } /// @@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders colours.Save(filename, ImageFormat.Png); } - + /// /// Exports a stream using a System.Drawing exporter. /// @@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders Bitmap colours = CreateGrayscaleBitmapFromMap(map); colours.Save(stream, ImageFormat.Png); - } + } #endregion diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/JPEG.cs index 9886b81..35576c7 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/JPEG.cs @@ -51,11 +51,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders { throw new NotImplementedException(); } - + public ITerrainChannel LoadStream(Stream stream) { throw new NotImplementedException(); - } + } public void SaveFile(string filename, ITerrainChannel map) { @@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders colours.Save(filename, ImageFormat.Jpeg); } - + /// /// Exports a stream using a System.Drawing exporter. /// @@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders Bitmap colours = CreateBitmapFromMap(map); colours.Save(stream, ImageFormat.Jpeg); - } + } #endregion @@ -109,4 +109,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders return bmp; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs index 21fba2b..5f13d01 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs @@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders FileInfo file = new FileInfo(filename); FileStream s = file.Open(FileMode.Open, FileAccess.Read); ITerrainChannel retval = LoadStream(s); - + s.Close(); return retval; @@ -113,7 +113,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders // i.e. eat X upto where we start while (currFileXOffset < offsetX) { - bs.ReadBytes(sectionWidth * 13); + bs.ReadBytes(sectionWidth * 13); currFileXOffset++; } @@ -143,11 +143,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders return retval; } - + public ITerrainChannel LoadStream(Stream s) - { + { TerrainChannel retval = new TerrainChannel(); - + BinaryReader bs = new BinaryReader(s); int y; for (y = 0; y < retval.Height; y++) @@ -160,8 +160,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders } } - bs.Close(); - + bs.Close(); + return retval; } @@ -173,7 +173,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders s.Close(); } - + public void SaveStream(Stream s, ITerrainChannel map) { BinaryWriter binStream = new BinaryWriter(s); @@ -224,9 +224,9 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders } } - binStream.Close(); + binStream.Close(); } - + public string FileExtension { get { return ".raw"; } diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs index cf95486..19e181e 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/PNG.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders colours.Save(filename, ImageFormat.Png); } - + /// /// Exports a stream using a System.Drawing exporter. /// @@ -51,11 +51,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders Bitmap colours = CreateGrayscaleBitmapFromMap(map); colours.Save(stream, ImageFormat.Png); - } + } public override string ToString() { return "PNG"; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/RAW32.cs index bb8b0f7..758821a 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/RAW32.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/RAW32.cs @@ -112,11 +112,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders return retval; } - + public ITerrainChannel LoadStream(Stream s) { TerrainChannel retval = new TerrainChannel(); - + BinaryReader bs = new BinaryReader(s); int y; for (y = 0; y < retval.Height; y++) @@ -129,10 +129,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders } bs.Close(); - + return retval; } - + public void SaveFile(string filename, ITerrainChannel map) { FileInfo file = new FileInfo(filename); @@ -141,7 +141,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders s.Close(); } - + public void SaveStream(Stream s, ITerrainChannel map) { BinaryWriter bs = new BinaryWriter(s); @@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders } } - bs.Close(); + bs.Close(); } #endregion @@ -166,4 +166,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders return "RAW32"; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/TIFF.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/TIFF.cs index 3f98f40..95b43b0 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/TIFF.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/TIFF.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders colours.Save(filename, ImageFormat.Tiff); } - + /// /// Exports a stream using a System.Drawing exporter. /// @@ -51,11 +51,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders Bitmap colours = CreateGrayscaleBitmapFromMap(map); colours.Save(stream, ImageFormat.Tiff); - } + } public override string ToString() { return "TIFF"; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs index 5dc2aa5..2bf029e 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/Terragen.cs @@ -51,11 +51,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders return retval; } - + public ITerrainChannel LoadStream(Stream s) { TerrainChannel retval = new TerrainChannel(); - + BinaryReader bs = new BinaryReader(s); bool eof = false; @@ -107,7 +107,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders } bs.Close(); - + return retval; } @@ -115,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders { throw new NotImplementedException(); } - + public void SaveStream(Stream stream, ITerrainChannel map) { throw new NotImplementedException(); @@ -138,4 +138,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders return "Terragen"; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs index e255515..beeff03 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs @@ -33,7 +33,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain { void LoadFromFile(string filename); void SaveToFile(string filename); - + /// /// Load a terrain from a stream. /// @@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain /// /// void LoadFromStream(string filename, Stream stream); - + /// /// Save a terrain to a stream. /// @@ -51,7 +51,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain /// /// void SaveToStream(string filename, Stream stream); - + void InstallPlugin(string name, ITerrainEffect plug); } } diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 8fbc62e..4a62446 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs @@ -221,7 +221,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented")); } } - + /// /// Loads a terrain file from a stream and installs it in the scene. /// @@ -281,7 +281,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented")); } - } + } #region Plugin Loading Methods @@ -450,7 +450,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain m_tainted = false; m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); m_scene.SaveTerrain(); - + // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. //m_scene.CreateTerrainTexture(true); } @@ -517,11 +517,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain // fixup and height deltas that don't respect them if (respectEstateSettings && LimitChannelChanges(x, y)) { - // this has been vetoed, so update + // this has been vetoed, so update // what we are going to send to the client serialised = m_channel.GetFloatsSerialised(); } - + SendToClients(serialised, x, y); shouldTaint = true; } @@ -580,9 +580,9 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain private void SendToClients(float[] serialised, int x, int y) { m_scene.ForEachClient( - delegate(IClientAPI controller) + delegate(IClientAPI controller) { controller.SendLayerData( - x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, serialised); + x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, serialised); } ); } @@ -647,7 +647,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain { // Not a good permissions check (see client_OnModifyTerrain above), need to check the entire area. // for now check a point in the centre of the region - + if (m_scene.ExternalChecks.ExternalChecksCanTerraformLand(remoteClient.AgentId, new LLVector3(127, 127, 0))) { InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs index a331d37..9b8dc75 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs @@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap { int tc = System.Environment.TickCount; m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); - + double[,] hm = whichScene.Heightmap.GetDoubles(); bool ShadowDebugContinue = true; //Color prim = Color.FromArgb(120, 120, 120); @@ -247,7 +247,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap //X // . // - // Shade the terrain for shadows + // Shade the terrain for shadows if ((x - 1 > 0) && (y - 1 > 0)) { hfvalue = (float)hm[x, y]; @@ -268,7 +268,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap else if (hfdiff < -0.3f) { // We have to desaturate and blacken the land at the same time - // we use floats, colors use bytes, so shrink are space down to + // we use floats, colors use bytes, so shrink are space down to // 0-255 @@ -368,8 +368,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap return mapbmp; } - - + + private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) { int tc = 0; @@ -570,4 +570,4 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap } #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs index 2a7af87..2430822 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs @@ -54,13 +54,13 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly string m_mapLayerPath = "0001/"; - - //private IConfig m_config; + + //private IConfig m_config; private Scene m_scene; private List cachedMapBlocks = new List(); private int cachedTime = 0; private byte[] myMapImageJPEG; - + //private int CacheRegionsDistance = 256; #region IRegionModule Members @@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap } public void PostInitialise() { - + } public void Close() @@ -102,10 +102,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap } #endregion - - - - public void OnRegisterCaps(LLUUID agentID, Caps caps) { @@ -117,9 +113,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap OSHttpRequest httpRequest, OSHttpResponse httpResponse) { return MapLayerRequest(request, path, param, - agentID, caps); + agentID, caps); })); - } /// @@ -138,12 +133,12 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap //{ //m_log.DebugFormat("[MAPLAYER]: request: {0}, path: {1}, param: {2}, agent:{3}", //request, path, param,agentID.ToString()); - + // this is here because CAPS map requests work even beyond the 10,000 limit. ScenePresence avatarPresence = null; m_scene.TryGetAvatar(agentID, out avatarPresence); - + if (avatarPresence != null) { bool lookup = false; @@ -168,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0); - + lock (cachedMapBlocks) cachedMapBlocks = mapBlocks; @@ -262,18 +257,16 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap MemoryStream imgstream = new MemoryStream(); Bitmap mapTexture = new Bitmap(1,1); System.Drawing.Image image = (System.Drawing.Image)mapTexture; - - + try { // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular jpeg data - imgstream = new MemoryStream(); - + // non-async because we know we have the asset immediately. AssetBase mapasset = m_scene.AssetCache.GetAsset(m_scene.RegionInfo.lastMapUUID, true); - + // Decode image to System.Drawing.Image image = OpenJPEG.DecodeToImage(mapasset.Data); @@ -293,7 +286,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap myEncoderParameter = new EncoderParameter(myEncoder, 95L); myEncoderParameters.Param[0] = myEncoderParameter; - + // Save bitmap to stream mapTexture.Save(imgstream, myImageCodecInfo, myEncoderParameters); @@ -332,16 +325,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap // From msdn private static ImageCodecInfo GetEncoderInfo(String mimeType) { - int j; ImageCodecInfo[] encoders; encoders = ImageCodecInfo.GetImageEncoders(); - for (j = 0; j < encoders.Length; ++j) + for (int j = 0; j < encoders.Length; ++j) { if (encoders[j].MimeType == mimeType) return encoders[j]; } return null; } - } } -- cgit v1.1