* Introduced some experimental code with regards to asset data substitution
parent
f3c7298fc5
commit
e93b782f9d
|
@ -49,6 +49,28 @@ namespace OpenSim.Framework
|
||||||
m_metadata.Name = name;
|
m_metadata.Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsTextualAsset
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return !IsBinaryAsset;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsBinaryAsset
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return
|
||||||
|
Type == (sbyte) AssetType.Animation ||
|
||||||
|
Type == (sbyte) AssetType.Gesture ||
|
||||||
|
Type == (sbyte) AssetType.ImageJPEG ||
|
||||||
|
Type == (sbyte) AssetType.ImageTGA ||
|
||||||
|
Type == (sbyte) AssetType.LSLBytecode ||;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual byte[] Data
|
public virtual byte[] Data
|
||||||
{
|
{
|
||||||
get { return m_data; }
|
get { return m_data; }
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using GlynnTucker.Cache;
|
using GlynnTucker.Cache;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -547,9 +548,49 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
req.RequestUser.SendAsset(req2);
|
req.RequestUser.SendAsset(req2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] ProcessAssetData(byte[] assetData)
|
||||||
|
{
|
||||||
|
string data = Encoding.ASCII.GetString(assetData);
|
||||||
|
|
||||||
|
data = ProcessAssetDataString(data);
|
||||||
|
|
||||||
|
return Encoding.ASCII.GetBytes( data );
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ProcessAssetDataString(string data)
|
||||||
|
{
|
||||||
|
Regex regex = new Regex("(creator_url|owner_url)\\s+(\\S+)");
|
||||||
|
|
||||||
|
data = regex.Replace(data, delegate(Match m)
|
||||||
|
{
|
||||||
|
string result = String.Empty;
|
||||||
|
|
||||||
|
string key = m.Groups[1].Captures[0].Value;
|
||||||
|
|
||||||
|
string value = m.Groups[2].Captures[0].Value;
|
||||||
|
|
||||||
|
Guid id = Util.GetHashGuid(value, AssetInfo.Secret);
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case "creator_url":
|
||||||
|
result = "creator_id " + id;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "owner_url":
|
||||||
|
result = "owner_id " + id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class AssetRequest
|
public class AssetRequest
|
||||||
{
|
{
|
||||||
public IClientAPI RequestUser;
|
public IClientAPI RequestUser;
|
||||||
|
@ -578,6 +619,8 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
Name = aBase.Name;
|
Name = aBase.Name;
|
||||||
Description = aBase.Description;
|
Description = aBase.Description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public const string Secret = "secret";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TextureImage : AssetBase
|
public class TextureImage : AssetBase
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
@ -46,6 +47,8 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <param name="userId">The target UUID</param>
|
/// <param name="userId">The target UUID</param>
|
||||||
/// <returns>A user profile. Returns null if no user profile is found.</returns>
|
/// <returns>A user profile. Returns null if no user profile is found.</returns>
|
||||||
UserProfileData GetUserProfile(UUID userId);
|
UserProfileData GetUserProfile(UUID userId);
|
||||||
|
|
||||||
|
UserProfileData GetUserProfile(Uri uri);
|
||||||
|
|
||||||
UserAgentData GetAgentByUUID(UUID userId);
|
UserAgentData GetAgentByUUID(UUID userId);
|
||||||
|
|
||||||
|
|
|
@ -73,16 +73,27 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
Assert.That(
|
Assert.That(
|
||||||
assetData, Is.EqualTo(m_assetReceived.Data), "Asset data stored differs from asset data received");
|
assetData, Is.EqualTo(m_assetReceived.Data), "Asset data stored differs from asset data received");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AssetRequestCallback(UUID assetId, AssetBase asset)
|
private void AssetRequestCallback(UUID assetId, AssetBase asset)
|
||||||
{
|
{
|
||||||
m_assetIdReceived = assetId;
|
m_assetIdReceived = assetId;
|
||||||
m_assetReceived = asset;
|
m_assetReceived = asset;
|
||||||
|
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
Monitor.PulseAll(this);
|
Monitor.PulseAll(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessAssetDataTest()
|
||||||
|
{
|
||||||
|
string url = "http://host/dir/";
|
||||||
|
string data = " creator_url " + url + " ";
|
||||||
|
|
||||||
|
AssetCache assetCache = new AssetCache();
|
||||||
|
|
||||||
|
Assert.AreEqual(" creator_id "+Util.GetHashGuid( url, AssetCache.AssetInfo.Secret )+" ", assetCache.ProcessAssetDataString( data ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,11 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserProfileData GetUserProfile(Uri uri)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public UserAgentData GetAgentByUUID(UUID userId)
|
public UserAgentData GetAgentByUUID(UUID userId)
|
||||||
{
|
{
|
||||||
foreach (IUserDataPlugin plugin in _plugins)
|
foreach (IUserDataPlugin plugin in _plugins)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -57,6 +58,11 @@ namespace OpenSim.Region.Communications.Hypergrid
|
||||||
return m_remoteUserServices.ConvertXMLRPCDataToUserProfile(data);
|
return m_remoteUserServices.ConvertXMLRPCDataToUserProfile(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserProfileData GetUserProfile(Uri uri)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a user agent from the user server
|
/// Get a user agent from the user server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -108,6 +108,11 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return userData;
|
return userData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserProfileData GetUserProfile(Uri uri)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a user agent from the user server
|
/// Get a user agent from the user server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue