Changing the AssetBase constructors to avoid initializing assets with an unknown asset type, and log an error if it ever does happen

This commit is contained in:
John Hurliman
2009-11-05 13:10:58 -08:00
parent e6d7303b29
commit afef1ac191
31 changed files with 105 additions and 122 deletions

View File

@@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
// HGAssetService dispatches it to the remote grid.
// It's not pretty, but the best that can be done while
// not having a global naming infrastructure
AssetBase asset1 = new AssetBase();
AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type);
Copy(asset, asset1);
try
{

View File

@@ -627,11 +627,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
{
AssetBase asset = new AssetBase();
asset.Name = name;
AssetBase asset = new AssetBase(UUID.Random(), name, assetType);
asset.Description = description;
asset.Type = assetType;
asset.FullID = UUID.Random();
asset.Data = (data == null) ? new byte[1] : data;
return asset;

View File

@@ -1918,14 +1918,10 @@ namespace OpenSim.Region.Framework.Scenes
}
AssetBase Animasset = new AssetBase();
AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation);
Animasset.Data = anim.ToBytes();
Animasset.Temporary = true;
Animasset.Local = true;
Animasset.FullID = UUID.Random();
Animasset.ID = Animasset.FullID.ToString();
Animasset.Name = "Random Animation";
Animasset.Type = (sbyte)AssetType.Animation;
Animasset.Description = "dance";
//BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);