本文整理汇总了C#中OpenSim.Framework.AssetBase类的典型用法代码示例。如果您正苦于以下问题:C# AssetBase类的具体用法?C# AssetBase怎么用?C# AssetBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssetBase类属于OpenSim.Framework命名空间,在下文中一共展示了AssetBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: T010_StoreSimpleAsset
public void T010_StoreSimpleAsset()
{
AssetBase a1 = new AssetBase(uuid1, "asset one");
AssetBase a2 = new AssetBase(uuid2, "asset two");
AssetBase a3 = new AssetBase(uuid3, "asset three");
a1.Data = asset1;
a2.Data = asset1;
a3.Data = asset1;
db.CreateAsset(a1);
db.CreateAsset(a2);
db.CreateAsset(a3);
AssetBase a1a = db.FetchAsset(uuid1);
Assert.That(a1.ID, Is.EqualTo(a1a.ID), "Assert.That(a1.ID, Is.EqualTo(a1a.ID))");
Assert.That(a1.Name, Is.EqualTo(a1a.Name), "Assert.That(a1.Name, Is.EqualTo(a1a.Name))");
AssetBase a2a = db.FetchAsset(uuid2);
Assert.That(a2.ID, Is.EqualTo(a2a.ID), "Assert.That(a2.ID, Is.EqualTo(a2a.ID))");
Assert.That(a2.Name, Is.EqualTo(a2a.Name), "Assert.That(a2.Name, Is.EqualTo(a2a.Name))");
AssetBase a3a = db.FetchAsset(uuid3);
Assert.That(a3.ID, Is.EqualTo(a3a.ID), "Assert.That(a3.ID, Is.EqualTo(a3a.ID))");
Assert.That(a3.Name, Is.EqualTo(a3a.Name), "Assert.That(a3.Name, Is.EqualTo(a3a.Name))");
}
示例2: TestWriteAndRetrieveAssets
public void TestWriteAndRetrieveAssets()
{
if (!_runTests) return;
AssetBase baseAsset = new AssetBase();
baseAsset.Data = new byte[] { 0xA, 0x9, 0x8, 0x7, 0x6, 0x5, 0xA, 0x9, 0x8, 0x7, 0x6, 0x5 };
baseAsset.Name = "Name1234567 ΏΏ";
baseAsset.Description = "Description TEstttt ΏΏΏÿÿ";
baseAsset.FullID = UUID.Random();
baseAsset.Local = true;
baseAsset.Temporary = true;
baseAsset.Type = 5;
baseAsset.Metadata.CreationDate = DateTime.Now;
int start = Environment.TickCount;
_client.StoreAsset(baseAsset);
Console.WriteLine("Time to store: {0}", Environment.TickCount - start);
start = Environment.TickCount;
AssetBase cfAsset = _client.RequestAssetSync(baseAsset.FullID);
Console.WriteLine("Time to read: {0}", Environment.TickCount - start);
CompareObjects comp = new CompareObjects();
comp.CompareStaticFields = false;
comp.CompareStaticProperties = false;
Assert.IsTrue(comp.Compare(baseAsset, cfAsset), comp.DifferencesString);
CollectionAssert.AreEqual(baseAsset.Data, cfAsset.Data);
start = Environment.TickCount;
//cleanup
_client.PurgeAssetSync(baseAsset.FullID);
Console.WriteLine("Time to purge: {0}", Environment.TickCount - start);
}
示例3: AssetReceived
public void AssetReceived(AssetBase asset, bool isTexture)
{
Console.WriteLine("[RegionClient]: Asset received " + asset.FullID);
if (isTexture)
{
TextureSender sender = null;
lock (textureSenders)
{
if (textureSenders.TryGetValue(asset.FullID, out sender))
textureSenders.Remove(asset.FullID);
else
Console.WriteLine("[RegionClient]: received texture but there is no texture sender!");
}
if (sender != null)
sender.TextureReceived(asset);
}
else
{
AssetSender sender = null;
lock (assetSenders)
{
if (assetSenders.TryGetValue(asset.FullID, out sender))
assetSenders.Remove(asset.FullID);
else
Console.WriteLine("[RegionClient]: received asset but there is no asset sender!");
}
if (sender != null)
sender.AssetReceived(asset);
}
}
示例4: TestBasicCacheRetrieval
public void TestBasicCacheRetrieval()
{
Cache.DiskWriteBackCache wbc = new Cache.DiskWriteBackCache();
AssetBase baseAsset = new AssetBase();
baseAsset.Data = new byte[] { 0xA, 0x9, 0x8, 0x7, 0x6, 0x5, 0xA, 0x9, 0x8, 0x7, 0x6, 0x5 };
baseAsset.Name = "Name";
baseAsset.Description = "Description";
baseAsset.FullID = UUID.Random();
baseAsset.Local = true;
baseAsset.Temporary = true;
baseAsset.Type = 5;
baseAsset.Metadata.CreationDate = DateTime.Now;
var stAsset = StratusAsset.FromAssetBase(baseAsset);
wbc.StoreAsset(stAsset);
CompareObjects comp = new CompareObjects();
comp.CompareStaticFields = false;
comp.CompareStaticProperties = false;
var cacheAsset = wbc.GetAsset(baseAsset.FullID.Guid);
Assert.IsTrue(comp.Compare(cacheAsset, stAsset), comp.DifferencesString);
CollectionAssert.AreEqual(cacheAsset.Data, stAsset.Data);
}
示例5: AssetLandmark
public AssetLandmark(AssetBase a)
: base(a.FullID, a.Name, a.Type)
{
Data = a.Data;
Description = a.Description;
InternData();
}
示例6: PostAsset
public bool PostAsset(string url, AssetBase asset)
{
if (asset != null)
{
// See long comment in AssetCache.AddAsset
if (!asset.Temporary || asset.Local)
{
// We need to copy the asset into a new asset, because
// we need to set its ID to be URL+UUID, so that the
// 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(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID);
Copy(asset, asset1);
try
{
asset1.ID = url + "/" + asset.ID;
}
catch
{
m_log.Warn("[HG ASSET MAPPER]: Oops.");
}
m_scene.AssetService.Store(asset1);
m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
}
return true;
}
else
m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache.");
return false;
}
示例7: AssetXferUploader
public AssetXferUploader(AgentAssetTransactions transactions, Scene scene, UUID assetID, bool dumpAssetToFile)
{
m_transactions = transactions;
m_Scene = scene;
m_asset = new AssetBase() { FullID = assetID };
m_dumpAssetToFile = dumpAssetToFile;
}
示例8: AssetLandmark
public AssetLandmark(AssetBase a)
: base(a.ID, a.Name, a.TypeAsset, a.CreatorID)
{
Data = a.Data;
Description = a.Description;
InternData();
}
示例9: Save
private void Save(AssetBase asset)
{
AssetBase temp = (AssetBase)manager.Get(typeof(AssetBase), asset.FullID);
if (temp == null)
{
manager.Insert(asset);
}
}
示例10: Store
public string Store(AssetBase asset)
{
m_log.DebugFormat("[MOCK ASSET SERVICE]: Storing asset {0}", asset.ID);
Assets[asset.ID] = asset;
return asset.ID;
}
示例11: EstateTerrainXferHandler
public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
{
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;
m_asset.Temporary = true;
}
示例12: AssetLandmark
public AssetLandmark(AssetBase a)
{
Data = a.Data;
FullID = a.FullID;
Type = a.Type;
Name = a.Name;
Description = a.Description;
InternData();
}
示例13: BaseFetchExistingAssetDataTest
public static void BaseFetchExistingAssetDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response)
{
Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data", null, null, response), "Failed on fetching data without trailing slash.");
Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch.");
Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on first fetch.");
Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data/", null, null, response), "Failed on fetching data with trailing slash.");
Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch.");
Assert.AreEqual(EXPECTED_CONTENT_TYPE, response.ContentType, "Wrong http content type on second fetch.");
}
示例14: SaveBitmap
public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary)
{
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;
asset.Temporary = temporary;
m_scene.AssetService.Store(asset);
return asset.FullID;
}
示例15: EstateTerrainXferHandler
public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
{
m_asset = new AssetBase();
m_asset.FullID = UUID.Zero;
m_asset.Type = type;
m_asset.Data = new byte[0];
m_asset.Name = pClientFilename;
m_asset.Description = "empty";
m_asset.Local = true;
m_asset.Temporary = true;
}