mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Formatting cleanup. Ignore some generated files.
This commit is contained in:
@@ -114,12 +114,12 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// <summary>
|
||||
/// Asset's default expiration time in the cache.
|
||||
/// </summary>
|
||||
public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes( 30.0 );
|
||||
public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0);
|
||||
|
||||
/// <summary>
|
||||
/// Log manager instance.
|
||||
/// </summary>
|
||||
private static readonly ILog Log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType );
|
||||
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Cache object.
|
||||
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
Initialize( DefaultMaxSize, DefaultMaxCount, DefaultExpirationTime );
|
||||
Initialize(DefaultMaxSize, DefaultMaxCount, DefaultExpirationTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -174,16 +174,16 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// <param name="expirationTime">
|
||||
/// Asset's expiration time.
|
||||
/// </param>
|
||||
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<string, AssetBase>.Synchronized( new CnmMemoryCache<string, AssetBase>(
|
||||
maximalSize, maximalCount, expirationTime ) );
|
||||
CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>(
|
||||
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
|
||||
/// <param name="asset">
|
||||
/// The asset that is being cached.
|
||||
/// </param>
|
||||
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
|
||||
/// <param name="id">
|
||||
/// The expired asset's id.
|
||||
/// </param>
|
||||
public void Expire( string id )
|
||||
public void Expire(string id)
|
||||
{
|
||||
m_cache.Remove( id );
|
||||
m_cache.Remove(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -250,14 +250,14 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// Cache doesn't guarantee in any situation that asset is stored to it.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
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
|
||||
/// <param name="scene">
|
||||
/// Region's scene.
|
||||
/// </param>
|
||||
public void AddRegion( Scene scene )
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
if( m_enabled )
|
||||
scene.RegisterModuleInterface<IImprovedAssetCache>( this );
|
||||
if (m_enabled)
|
||||
scene.RegisterModuleInterface<IImprovedAssetCache>(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -314,19 +314,19 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// <param name="source">
|
||||
/// Configuration source.
|
||||
/// </param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -381,7 +381,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// The extra function stub is just that much cleaner.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public void RegionLoaded( Scene scene )
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// <param name="scene">
|
||||
/// Region scene that is being removed.
|
||||
/// </param>
|
||||
public void RemoveRegion( Scene scene )
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user