From a7fcacf8f396acbca0b640a65acfbf5487d513e7 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 9 Jun 2009 18:07:35 +0000 Subject: Formatting cleanup. Ignore some generated files. --- .../Region/CoreModules/Asset/CenomeAssetCache.cs | 68 +++++++++++----------- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 6 +- .../DynamicTexture/DynamicTextureModule.cs | 4 +- .../World/Permissions/PermissionsModule.cs | 38 ++++++------ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 36 ++++++------ OpenSim/Region/Framework/Scenes/Scene.cs | 6 +- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 14 ++--- .../Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | 6 +- 8 files changed, 89 insertions(+), 89 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 5e3d243..d42c9e2 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs @@ -114,12 +114,12 @@ namespace OpenSim.Region.CoreModules.Asset /// /// Asset's default expiration time in the cache. /// - public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes( 30.0 ); + public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); /// /// Log manager instance. /// - private static readonly ILog Log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType ); + private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// /// Cache object. @@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Asset /// public void Initialize() { - Initialize( DefaultMaxSize, DefaultMaxCount, DefaultExpirationTime ); + Initialize(DefaultMaxSize, DefaultMaxCount, DefaultExpirationTime); } /// @@ -174,16 +174,16 @@ namespace OpenSim.Region.CoreModules.Asset /// /// Asset's expiration time. /// - public void Initialize( long maximalSize, int maximalCount, TimeSpan expirationTime ) + public void Initialize(long maximalSize, int maximalCount, TimeSpan expirationTime) { - if( maximalSize <= 0 || maximalCount <= 0 ) + if (maximalSize <= 0 || maximalCount <= 0) { - Log.Info( "[ASSET CACHE]: Cenome asset cache is not enabled." ); + Log.Info("[ASSET CACHE]: Cenome asset cache is not enabled."); m_enabled = false; return; } - if( expirationTime <= TimeSpan.Zero ) + if (expirationTime <= TimeSpan.Zero) { // Disable expiration time expirationTime = TimeSpan.MaxValue; @@ -191,14 +191,14 @@ namespace OpenSim.Region.CoreModules.Asset // Create cache and add synchronization wrapper over it m_cache = - CnmSynchronizedCache.Synchronized( new CnmMemoryCache( - maximalSize, maximalCount, expirationTime ) ); + CnmSynchronizedCache.Synchronized(new CnmMemoryCache( + maximalSize, maximalCount, expirationTime)); m_enabled = true; Log.InfoFormat( "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", maximalSize, maximalCount, - expirationTime ); + expirationTime); } #region IImprovedAssetCache Members @@ -209,10 +209,10 @@ namespace OpenSim.Region.CoreModules.Asset /// /// The asset that is being cached. /// - public void Cache( AssetBase asset ) + public void Cache(AssetBase asset) { long size = asset.Data != null ? asset.Data.Length : 1; - m_cache.Set( asset.ID, asset, size ); + m_cache.Set(asset.ID, asset, size); m_cachedCount++; } @@ -230,9 +230,9 @@ namespace OpenSim.Region.CoreModules.Asset /// /// The expired asset's id. /// - public void Expire( string id ) + public void Expire(string id) { - m_cache.Remove( id ); + m_cache.Remove(id); } /// @@ -250,14 +250,14 @@ namespace OpenSim.Region.CoreModules.Asset /// Cache doesn't guarantee in any situation that asset is stored to it. /// /// - public AssetBase Get( string id ) + public AssetBase Get(string id) { m_getCount++; AssetBase assetBase; - if( m_cache.TryGetValue( id, out assetBase ) ) + if (m_cache.TryGetValue(id, out assetBase)) m_hitCount++; - if( m_getCount == m_debugEpoch ) + if (m_getCount == m_debugEpoch) { Log.InfoFormat( "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", @@ -265,7 +265,7 @@ namespace OpenSim.Region.CoreModules.Asset m_getCount, ((double) m_hitCount / m_getCount) * 100.0, m_cache.Size, - m_cache.Size / m_cache.Count ); + m_cache.Size / m_cache.Count); m_getCount = 0; m_hitCount = 0; m_cachedCount = 0; @@ -292,10 +292,10 @@ namespace OpenSim.Region.CoreModules.Asset /// /// Region's scene. /// - public void AddRegion( Scene scene ) + public void AddRegion(Scene scene) { - if( m_enabled ) - scene.RegisterModuleInterface( this ); + if (m_enabled) + scene.RegisterModuleInterface(this); } /// @@ -314,19 +314,19 @@ namespace OpenSim.Region.CoreModules.Asset /// /// Configuration source. /// - public void Initialise( IConfigSource source ) + public void Initialise(IConfigSource source) { m_cache = null; m_enabled = false; IConfig moduleConfig = source.Configs[ "Modules" ]; - if( moduleConfig == null ) + if (moduleConfig == null) return; - string name = moduleConfig.GetString( "AssetCaching" ); - Log.DebugFormat( "[XXX] name = {0} (this module's name: {1}", name, Name ); + string name = moduleConfig.GetString("AssetCaching"); + Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); - if( name != Name ) + if (name != Name) return; // This module is used @@ -335,19 +335,19 @@ namespace OpenSim.Region.CoreModules.Asset TimeSpan expirationTime = DefaultExpirationTime; IConfig assetConfig = source.Configs[ "AssetCache" ]; - if( assetConfig != null ) + if (assetConfig != null) { // Get optional configurations - maxSize = assetConfig.GetLong( "MaxSize", DefaultMaxSize ); - maxCount = assetConfig.GetInt( "MaxCount", DefaultMaxCount ); + maxSize = assetConfig.GetLong("MaxSize", DefaultMaxSize); + maxCount = assetConfig.GetInt("MaxCount", DefaultMaxCount); expirationTime = - TimeSpan.FromMinutes( assetConfig.GetInt( "ExpirationTime", (int) DefaultExpirationTime.TotalMinutes ) ); + TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int) DefaultExpirationTime.TotalMinutes)); // Debugging purposes only - m_debugEpoch = assetConfig.GetInt( "DebugEpoch", 0 ); + m_debugEpoch = assetConfig.GetInt("DebugEpoch", 0); } - Initialize( maxSize, maxCount, expirationTime ); + Initialize(maxSize, maxCount, expirationTime); } /// @@ -381,7 +381,7 @@ namespace OpenSim.Region.CoreModules.Asset /// The extra function stub is just that much cleaner. /// /// - public void RegionLoaded( Scene scene ) + public void RegionLoaded(Scene scene) { } @@ -391,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Asset /// /// Region scene that is being removed. /// - public void RemoveRegion( Scene scene ) + public void RemoveRegion(Scene scene) { } diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 9540bd4..b7c269d 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -230,7 +230,7 @@ namespace Flotsam.RegionModules.AssetCache private void UpdateMemoryCache(string key, AssetBase asset) { - if( m_MemoryCacheEnabled ) + if (m_MemoryCacheEnabled) { if (m_MemoryExpiration > TimeSpan.Zero) { @@ -404,7 +404,7 @@ namespace Flotsam.RegionModules.AssetCache File.Delete(filename); } - if( m_MemoryCacheEnabled ) + if (m_MemoryCacheEnabled) m_MemoryCache.Remove(id); } catch (Exception e) @@ -423,7 +423,7 @@ namespace Flotsam.RegionModules.AssetCache Directory.Delete(dir); } - if( m_MemoryCacheEnabled ) + if (m_MemoryCacheEnabled) m_MemoryCache.Clear(); } diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index a547df5..8c3d993 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -332,7 +332,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture UUID oldID = UUID.Zero; - lock(part) + lock (part) { // mostly keep the values from before Primitive.TextureEntry tmptex = part.Shape.Textures; @@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture // remove the old asset from the cache oldID = tmptex.DefaultTexture.TextureID; - if(Face == ALL_SIDES) + if (Face == ALL_SIDES) { tmptex.DefaultTexture.TextureID = asset.FullID; } diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 036c4b8..d786df8 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions string grant = myConfig.GetString("GrantLSL",""); - if(grant.Length > 0) { + if (grant.Length > 0) { foreach (string uuidl in grant.Split(',')) { string uuid = uuidl.Trim(" \t".ToCharArray()); GrantLSL.Add(uuid, true); @@ -251,7 +251,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions } grant = myConfig.GetString("GrantCS",""); - if(grant.Length > 0) { + if (grant.Length > 0) { foreach (string uuidl in grant.Split(',')) { string uuid = uuidl.Trim(" \t".ToCharArray()); GrantCS.Add(uuid, true); @@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions } grant = myConfig.GetString("GrantVB",""); - if(grant.Length > 0) { + if (grant.Length > 0) { foreach (string uuidl in grant.Split(',')) { string uuid = uuidl.Trim(" \t".ToCharArray()); GrantVB.Add(uuid, true); @@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions } grant = myConfig.GetString("GrantJS",""); - if(grant.Length > 0) { + if (grant.Length > 0) { foreach (string uuidl in grant.Split(',')) { string uuid = uuidl.Trim(" \t".ToCharArray()); GrantJS.Add(uuid, true); @@ -563,7 +563,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions } // Group permissions - if ( ( task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0) ) + if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0)) return objectGroupMask; return objectEveryoneMask; @@ -650,7 +650,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions } // Group members should be able to edit group objects - if ( (group.GroupID != UUID.Zero) && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) && IsGroupMember(group.GroupID, currentUser, 0) ) + if ((group.GroupID != UUID.Zero) && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) && IsGroupMember(group.GroupID, currentUser, 0)) { // Return immediately, so that the administrator can shares group objects return true; @@ -731,7 +731,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions permission = true; } - if( ( parcel.landData.GroupID != UUID.Zero) && IsGroupMember(parcel.landData.GroupID, user, groupPowers) ) + if ((parcel.landData.GroupID != UUID.Zero) && IsGroupMember(parcel.landData.GroupID, user, groupPowers)) { permission = true; } @@ -758,7 +758,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions permission = true; } - if( parcel.landData.IsGroupOwned && IsGroupMember(parcel.landData.GroupID, user, groupPowers) ) + if (parcel.landData.IsGroupOwned && IsGroupMember(parcel.landData.GroupID, user, groupPowers)) { permission = true; } @@ -982,7 +982,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (part.GroupID == UUID.Zero) return false; - if( !IsGroupMember(part.GroupID, user, 0) ) + if (!IsGroupMember(part.GroupID, user, 0)) return false; if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) @@ -1002,7 +1002,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (ti.GroupID == UUID.Zero) return false; - if( !IsGroupMember(ti.GroupID, user, 0) ) + if (!IsGroupMember(ti.GroupID, user, 0)) return false; } @@ -1411,7 +1411,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (part.GroupID == UUID.Zero) return false; - if( !IsGroupMember(part.GroupID, user, 0) ) + if (!IsGroupMember(part.GroupID, user, 0)) return false; if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) @@ -1431,7 +1431,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (ti.GroupID == UUID.Zero) return false; - if( !IsGroupMember(ti.GroupID, user, 0) ) + if (!IsGroupMember(ti.GroupID, user, 0)) return false; } @@ -1504,7 +1504,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (part.GroupID == UUID.Zero) return false; - if( !IsGroupMember(part.GroupID, user, 0) ) + if (!IsGroupMember(part.GroupID, user, 0)) return false; } @@ -1521,7 +1521,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (ti.GroupID == UUID.Zero) return false; - if( !IsGroupMember(ti.GroupID, user, 0) ) + if (!IsGroupMember(ti.GroupID, user, 0)) return false; } @@ -1744,24 +1744,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); - switch(scriptType) { + switch (scriptType) { case 0: - if(GrantLSL.Count == 0 || GrantLSL.ContainsKey(ownerUUID.ToString())) { + if (GrantLSL.Count == 0 || GrantLSL.ContainsKey(ownerUUID.ToString())) { return(true); } break; case 1: - if(GrantCS.Count == 0 || GrantCS.ContainsKey(ownerUUID.ToString())) { + if (GrantCS.Count == 0 || GrantCS.ContainsKey(ownerUUID.ToString())) { return(true); } break; case 2: - if(GrantVB.Count == 0 || GrantVB.ContainsKey(ownerUUID.ToString())) { + if (GrantVB.Count == 0 || GrantVB.ContainsKey(ownerUUID.ToString())) { return(true); } break; case 3: - if(GrantJS.Count == 0 || GrantJS.ContainsKey(ownerUUID.ToString())) { + if (GrantJS.Count == 0 || GrantJS.ContainsKey(ownerUUID.ToString())) { return(true); } break; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a2a7392..8e3c688 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1526,14 +1526,14 @@ namespace OpenSim.Region.Framework.Scenes return; if (part.OwnerID != remoteClient.AgentId) - { - // Group permissions - if ( (part.GroupID == UUID.Zero) || (remoteClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0) ) - return; - } else { - if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) - return; - } + { + // Group permissions + if ((part.GroupID == UUID.Zero) || (remoteClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0)) + return; + } else { + if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) + return; + } if (!Permissions.CanCreateObjectInventory( itemBase.InvType, part.UUID, remoteClient.AgentId)) @@ -1602,18 +1602,18 @@ namespace OpenSim.Region.Framework.Scenes destId); return; } - + // Must own the object, and have modify rights if (srcPart.OwnerID != destPart.OwnerID) - { - // Group permissions - if ( (destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) || - ((destPart.GroupMask & (uint)PermissionMask.Modify) == 0) ) - return; - } else { - if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0) - return; - } + { + // Group permissions + if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) || + ((destPart.GroupMask & (uint)PermissionMask.Modify) == 0)) + return; + } else { + if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0) + return; + } if (destPart.ScriptAccessPin != pin) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9cfc84f..d18af46 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -136,7 +136,7 @@ namespace OpenSim.Region.Framework.Scenes { m_AssetService = RequestModuleInterface(); - if( m_AssetService == null ) + if (m_AssetService == null) { throw new Exception("No IAssetService available."); } @@ -1097,7 +1097,7 @@ namespace OpenSim.Region.Framework.Scenes IMessageTransferModule tr = RequestModuleInterface(); if (tr != null) - tr.SendInstantMessage(msg, delegate(bool success) {} ); + tr.SendInstantMessage(msg, delegate(bool success) {}); } m_returns.Clear(); } @@ -1465,7 +1465,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart part in group.Children.Values) { - if (part.IsJoint() && ((part.ObjectFlags&(uint)PrimFlags.Physics) != 0) ) + if (part.IsJoint() && ((part.ObjectFlags&(uint)PrimFlags.Physics) != 0)) { PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? } diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 911da5b..5c7ce43 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -342,13 +342,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools throw new Exception(errtext); } - if(m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)l) == false) { - // Not allowed to compile to this language! - string errtext = String.Empty; - errtext += ownerUUID + " is not in list of allowed users for this scripting language. Script will not be executed!"; - throw new Exception(errtext); - } - + if (m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)l) == false) { + // Not allowed to compile to this language! + string errtext = String.Empty; + errtext += ownerUUID + " is not in list of allowed users for this scripting language. Script will not be executed!"; + throw new Exception(errtext); + } + string compileScript = Script; if (l == enumCompileType.lsl) diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 5dfbdbc..3ca7f7c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs @@ -135,8 +135,8 @@ state another_state [Test] public void TestLoneIdent() { - // A lone ident should be removed completely as it's an error in C# - // (MONO at least). + // A lone ident should be removed completely as it's an error in C# + // (MONO at least). string input = @"default { touch_start(integer num_detected) @@ -150,7 +150,7 @@ state another_state "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + "\n {" + "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0);" + - "\n ;" + + "\n ;" + "\n }\n"; CSCodeGenerator cg = new CSCodeGenerator(); -- cgit v1.1