Changed asset CreatorID to a string

slimupdates
John Hurliman 2010-02-22 14:18:59 -08:00
parent 71c6559a91
commit df76e95aa2
30 changed files with 49 additions and 46 deletions

View File

@ -1564,7 +1564,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
assets = doc.GetElementsByTagName("RequiredAsset");
foreach (XmlNode asset in assets)
{
AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type","")), UUID.Zero);
AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset, "name", ""), SByte.Parse(GetStringAttribute(asset, "type", "")), UUID.Zero.ToString());
rass.Description = GetStringAttribute(asset,"desc","");
rass.Local = Boolean.Parse(GetStringAttribute(asset,"local",""));
rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary",""));

View File

@ -261,7 +261,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
modified = (asset != null);
created = !modified;
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero);
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero.ToString());
asset.Description = xml.GetAttribute("desc");
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
@ -338,7 +338,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
modified = (asset != null);
created = !modified;
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero);
asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero.ToString());
asset.Description = xml.GetAttribute("desc");
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;

View File

@ -1871,7 +1871,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Create AssetBase entity to hold the inlined asset
asset = new AssetBase(uuid, name, type, UUID.Zero);
asset = new AssetBase(uuid, name, type, UUID.Zero.ToString());
asset.Description = desc;
asset.Local = local;

View File

@ -136,7 +136,7 @@ namespace OpenSim.Data.MSSQL
new UUID((Guid)reader["id"]),
(string)reader["name"],
Convert.ToSByte(reader["assetType"]),
UUID.Zero
UUID.Zero.ToString()
);
// Region Main
asset.Description = (string)reader["description"];

View File

@ -122,7 +122,7 @@ namespace OpenSim.Data.MySQL
{
if (dbReader.Read())
{
asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], UUID.Zero);
asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], UUID.Zero.ToString());
asset.Data = (byte[])dbReader["data"];
asset.Description = (string)dbReader["description"];

View File

@ -235,7 +235,7 @@ namespace OpenSim.Data.SQLite
new UUID((String)row["UUID"]),
(String)row["Name"],
Convert.ToSByte(row["Type"]),
UUID.Zero
UUID.Zero.ToString()
);
asset.Description = (String) row["Description"];

View File

@ -66,9 +66,9 @@ namespace OpenSim.Data.Tests
[Test]
public void T010_StoreSimpleAsset()
{
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero.ToString());
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, UUID.Zero.ToString());
AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, UUID.Zero.ToString());
a1.Data = asset1;
a2.Data = asset1;
a3.Data = asset1;

View File

@ -297,8 +297,8 @@ namespace OpenSim.Data.Tests
public void AssetShouldMatch()
{
UUID uuid1 = UUID.Random();
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero.ToString());
AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero.ToString());
var constraint = Constraints.PropertyCompareConstraint(expected);
@ -309,8 +309,8 @@ namespace OpenSim.Data.Tests
public void AssetShouldNotMatch()
{
UUID uuid1 = UUID.Random();
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero.ToString());
AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture, UUID.Zero.ToString());
var constraint = Constraints.PropertyCompareConstraint(expected);
@ -321,8 +321,8 @@ namespace OpenSim.Data.Tests
public void AssetShouldNotMatch2()
{
UUID uuid1 = UUID.Random();
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero.ToString());
AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture, UUID.Zero.ToString());
var constraint = Constraints.PropertyCompareConstraint(expected);

View File

@ -165,7 +165,7 @@ namespace OpenSim.Data.Tests
[Test]
public void TestScramble()
{
AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture, UUID.Zero.ToString());
new PropertyScrambler<AssetBase>().Scramble(actual);
}
@ -173,7 +173,7 @@ namespace OpenSim.Data.Tests
public void DontScramble()
{
UUID uuid = UUID.Random();
AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture, UUID.Zero);
AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture, UUID.Zero.ToString());
new PropertyScrambler<AssetBase>()
.DontScramble(x => x.Metadata)
.DontScramble(x => x.FullID)

View File

@ -59,9 +59,10 @@ namespace OpenSim.Framework
m_metadata.FullID = UUID.Zero;
m_metadata.ID = UUID.Zero.ToString();
m_metadata.Type = (sbyte)AssetType.Unknown;
m_metadata.CreatorID = String.Empty;
}
public AssetBase(UUID assetID, string name, sbyte assetType, UUID creatorID)
public AssetBase(UUID assetID, string name, sbyte assetType, string creatorID)
{
if (assetType == (sbyte)AssetType.Unknown)
{
@ -74,9 +75,10 @@ namespace OpenSim.Framework
m_metadata.FullID = assetID;
m_metadata.Name = name;
m_metadata.Type = assetType;
m_metadata.CreatorID = creatorID;
}
public AssetBase(string assetID, string name, sbyte assetType, UUID creatorID)
public AssetBase(string assetID, string name, sbyte assetType, string creatorID)
{
if (assetType == (sbyte)AssetType.Unknown)
{
@ -89,6 +91,7 @@ namespace OpenSim.Framework
m_metadata.ID = assetID;
m_metadata.Name = name;
m_metadata.Type = assetType;
m_metadata.CreatorID = creatorID;
}
public bool ContainsReferences
@ -229,7 +232,7 @@ namespace OpenSim.Framework
private byte[] m_sha1;
private bool m_local;
private bool m_temporary;
private UUID m_creatorid;
private string m_creatorid;
public UUID FullID
{
@ -322,7 +325,7 @@ namespace OpenSim.Framework
set { m_temporary = value; }
}
public UUID CreatorID
public string CreatorID
{
get { return m_creatorid; }
set { m_creatorid = value; }

View File

@ -46,7 +46,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type)
{
AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_ID);
AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_ID.ToString());
if (!String.IsNullOrEmpty(path))
{

View File

@ -888,7 +888,7 @@ namespace OpenSim.Framework.Capabilities
}
AssetBase asset;
asset = new AssetBase(assetID, assetName, assType, m_agentID);
asset = new AssetBase(assetID, assetName, assType, m_agentID.ToString());
asset.Data = data;
if (AddNewAsset != null)
AddNewAsset(asset);

View File

@ -67,7 +67,7 @@ namespace OpenSim.Framework.Tests
private void CheckContainsReferences(AssetType assetType, bool expected)
{
AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType, UUID.Zero);
AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType, UUID.Zero.ToString());
bool actual = asset.ContainsReferences;
Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+".");
}

View File

@ -197,7 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void Initialise(UUID fileID, string fileName)
{
m_asset = new AssetBase(fileID, fileName, type, UUID.Zero);
m_asset = new AssetBase(fileID, fileName, type, UUID.Zero.ToString());
m_asset.Data = new byte[0];
m_asset.Description = "empty";
m_asset.Local = true;
@ -212,7 +212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void RequestStartXfer(IClientAPI pRemoteClient)
{
m_asset.Metadata.CreatorID = pRemoteClient.AgentId;
m_asset.Metadata.CreatorID = pRemoteClient.AgentId.ToString();
if (!String.IsNullOrEmpty(m_asset.Name))
{

View File

@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
bool storeLocal, bool tempFile)
{
ourClient = remoteClient;
m_asset = new AssetBase(assetID, "blank", type, remoteClient.AgentId);
m_asset = new AssetBase(assetID, "blank", type, remoteClient.AgentId.ToString());
m_asset.Data = data;
m_asset.Description = "empty";
m_asset.Local = storeLocal;

View File

@ -240,7 +240,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
{
string assetID = "j2kCache_" + AssetId.ToString();
AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID);
AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID.ToString());
layerDecodeAsset.Local = true;
layerDecodeAsset.Temporary = true;

View File

@ -416,7 +416,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
//m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType, UUID.Zero);
AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType, UUID.Zero.ToString());
asset.Data = data;
m_scene.AssetService.Store(asset);

View File

@ -161,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
AssetBase asset =
CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId);
CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString());
item.AssetID = asset.FullID;
m_Scene.AssetService.Store(asset);
@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
objectGroup.GetPartDescription(objectGroup.RootPart.LocalId),
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml),
objectGroup.OwnerID);
objectGroup.OwnerID.ToString());
m_Scene.AssetService.Store(asset);
assetID = asset.FullID;
@ -641,7 +641,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
/// <param name="assetType"></param>
/// <param name="data"></param>
/// <returns></returns>
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID)
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, string creatorID)
{
AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID);
asset.Description = description;

View File

@ -310,7 +310,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
// Create a new asset for user
AssetBase asset = new AssetBase(UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture,
scene.RegionInfo.RegionID);
scene.RegionInfo.RegionID.ToString());
asset.Data = assetData;
asset.Description = String.Format("URL image : {0}", Url);
asset.Local = false;

View File

@ -347,7 +347,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
//m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero);
AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString());
asset.Data = data;
// We're relying on the asset service to do the sensible thing and not store the asset if it already

View File

@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType, UUID.Zero);
AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType, UUID.Zero.ToString());
asset.Description = metadata.Description;
asset.Data = data;

View File

@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
{
m_asset = new AssetBase(UUID.Zero, pClientFilename, type, pRemoteClient.AgentId);
m_asset = new AssetBase(UUID.Zero, pClientFilename, type, pRemoteClient.AgentId.ToString());
m_asset.Data = new byte[0];
m_asset.Description = "empty";
m_asset.Local = true;

View File

@ -1081,7 +1081,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_scene.RegionInfo.RegionSettings.TerrainImageID,
"terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(),
(sbyte)AssetType.Texture,
m_scene.RegionInfo.RegionID);
m_scene.RegionInfo.RegionID.ToString());
asset.Data = data;
asset.Description = m_scene.RegionInfo.RegionName;
asset.Temporary = temporary;

View File

@ -384,7 +384,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
}
}
AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation, m_scenePresence.UUID);
AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation, m_scenePresence.UUID.ToString());
Animasset.Data = anim.ToBytes();
Animasset.Temporary = true;
Animasset.Local = true;

View File

@ -572,7 +572,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data, UUID creatorID)
{
AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID);
AssetBase asset = new AssetBase(UUID.Random(), name, assetType, creatorID.ToString());
asset.Description = description;
asset.Data = (data == null) ? new byte[1] : data;

View File

@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary)
{
AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture, m_scene.RegionInfo.RegionID);
AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", (sbyte)AssetType.Texture, m_scene.RegionInfo.RegionID.ToString());
asset.Data = OpenJPEG.EncodeFromImage(data, lossless);
asset.Description = "MRM Image";
asset.Local = false;

View File

@ -1474,7 +1474,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
// Create new asset
AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID);
AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString());
asset.Description = "Script Generated Notecard";
string notecardData = String.Empty;

View File

@ -243,7 +243,7 @@ namespace OpenSim.Services.Connectors
if (metadata == null)
return false;
asset = new AssetBase(metadata.FullID, metadata.Name, metadata.Type, UUID.Zero);
asset = new AssetBase(metadata.FullID, metadata.Name, metadata.Type, UUID.Zero.ToString());
asset.Metadata = metadata;
}
asset.Data = data;

View File

@ -131,7 +131,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
Bitmap m = new Bitmap(filename + ".jpg");
//m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
byte[] imageData = OpenJPEG.EncodeFromImage(m, true);
AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture, regionID);
AssetBase ass = new AssetBase(UUID.Random(), "region " + filename, (sbyte)AssetType.Texture, regionID.ToString());
// !!! for now
//info.RegionSettings.TerrainImageID = ass.FullID;

View File

@ -40,7 +40,7 @@ namespace OpenSim.Tests.Common
/// </summary>
public static AssetBase CreateAsset(UUID assetUuid, string data, UUID creatorID)
{
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, creatorID);
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, creatorID.ToString());
asset.Data = Encoding.ASCII.GetBytes(data);
return asset;
}
@ -53,7 +53,7 @@ namespace OpenSim.Tests.Common
/// <returns></returns>
public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog)
{
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, sog.OwnerID);
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, sog.OwnerID.ToString());
asset.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog));
return asset;
}