本文整理汇总了C#中AssetBase类的典型用法代码示例。如果您正苦于以下问题:C# AssetBase类的具体用法?C# AssetBase怎么用?C# AssetBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssetBase类属于命名空间,在下文中一共展示了AssetBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CheckContainsReferences
private void CheckContainsReferences(AssetType assetType, bool expected)
{
AssetBase asset = new AssetBase();
asset.Type = (sbyte)assetType;
bool actual = asset.ContainsReferences;
Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+".");
}
开发者ID:ChrisD,项目名称:opensim,代码行数:7,代码来源:AssetBaseTest.cs
示例2: StoreAsset
public bool StoreAsset(AssetBase asset)
{
try
{
if (asset.Name.Length > 64)
asset.Name = asset.Name.Substring(0, 64);
if (asset.Description.Length > 128)
asset.Description = asset.Description.Substring(0, 128);
if (ExistsAsset(asset.ID))
{
AssetBase oldAsset = GetAsset(asset.ID);
if (oldAsset == null || (oldAsset.Flags & AssetFlags.Rewritable) == AssetFlags.Rewritable)
{
MainConsole.Instance.Debug("[LocalAssetDatabase]: Asset already exists in the db, overwriting - " + asset.ID);
Delete(asset.ID, true);
InsertAsset(asset, asset.ID);
}
else
{
MainConsole.Instance.Warn("[LocalAssetDatabase]: Asset already exists in the db, fixing ID... - " + asset.ID);
InsertAsset(asset, UUID.Random());
}
}
else
{
InsertAsset(asset, asset.ID);
}
}
catch (Exception e)
{
MainConsole.Instance.ErrorFormat("[LocalAssetDatabase]: Failure creating asset {0} with name \"{1}\". Error: {2}",
asset.ID, asset.Name, e);
}
return true;
}
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:35,代码来源:LocalAssetMainConnector.cs
示例3: AddToInventory
public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
{
if (this.InventoryFolders.ContainsKey(folderID))
{
LLUUID NewItemID = LLUUID.Random();
InventoryItem Item = new InventoryItem();
Item.FolderID = folderID;
Item.OwnerID = AgentID;
Item.AssetID = asset.FullID;
Item.ItemID = NewItemID;
Item.Type = asset.Type;
Item.Name = asset.Name;
Item.Description = asset.Description;
Item.InvType = asset.InvType;
this.InventoryItems.Add(Item.ItemID, Item);
InventoryFolder Folder = InventoryFolders[Item.FolderID];
Folder.Items.Add(Item);
return (Item.ItemID);
}
else
{
return (null);
}
}
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:25,代码来源:AgentInventory.cs
示例4: AddUpload
public void AddUpload(LLUUID transactionID, AssetBase asset)
{
AssetTransaction upload = new AssetTransaction();
lock (this.transactions)
{
upload.Asset = asset;
upload.TransactionID = transactionID;
this.transactions.Add(transactionID, upload);
}
if (upload.Asset.Data.Length > 2)
{
//is complete
upload.UploadComplete = true;
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
response.AssetBlock.Type = asset.Type;
response.AssetBlock.Success = true;
response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID);
this.ourClient.OutPacket(response);
m_assetCache.AddAsset(asset);
}
else
{
upload.UploadComplete = false;
upload.XferID = Util.GetNextXferID();
RequestXferPacket xfer = new RequestXferPacket();
xfer.XferID.ID = upload.XferID;
xfer.XferID.VFileType = upload.Asset.Type;
xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID);
xfer.XferID.FilePath = 0;
xfer.XferID.Filename = new byte[0];
this.ourClient.OutPacket(xfer);
}
}
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:33,代码来源:AgentAssetUpload.cs
示例5: LoadAsset
protected static void LoadAsset(AssetBase info, string path)
{
// bool image =
// (info.Type == (sbyte)AssetType.Texture ||
// info.Type == (sbyte)AssetType.TextureTGA ||
// info.Type == (sbyte)AssetType.ImageJPEG ||
// info.Type == (sbyte)AssetType.ImageTGA);
FileInfo fInfo = new FileInfo(path);
long numBytes = fInfo.Length;
if (fInfo.Exists)
{
FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read);
byte[] idata = new byte[numBytes];
BinaryReader br = new BinaryReader(fStream);
idata = br.ReadBytes((int)numBytes);
br.Close();
fStream.Close();
info.Data = idata;
//info.loaded=true;
}
else
{
m_log.ErrorFormat("[ASSETS]: file: [{0}] not found !", path);
}
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:26,代码来源:AssetLoaderFileSystem.cs
示例6: SaveBitmap
public UUID SaveBitmap(Bitmap data, bool lossless, bool temporary)
{
AssetBase asset = new AssetBase(UUID.Random(), "MRMDynamicImage", AssetType.Texture,
m_scene.RegionInfo.RegionID)
{
Data = OpenJPEG.EncodeFromImage(data, lossless),
Description = "MRM Image",
Flags = (temporary) ? AssetFlags.Temporary : 0
};
asset.ID = m_scene.AssetService.Store(asset);
return asset.ID;
}
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:13,代码来源:Graphics.cs
示例7: AddBasePart
/// <summary>
/// Adds the given <see cref="AssetBase"/> to the <see cref="Asset.BaseParts"/> collection of this asset.
/// </summary>
/// <remarks>If the <see cref="Asset.BaseParts"/> collection already contains the argument. this method does nothing.</remarks>
/// <param name="newBasePart">The base to add to the <see cref="Asset.BaseParts"/> collection.</param>
public void AddBasePart(AssetBase newBasePart)
{
if (newBasePart == null) throw new ArgumentNullException(nameof(newBasePart));
if (BaseParts == null)
{
BaseParts = new List<AssetBase>();
}
if (BaseParts.All(x => x.Id != newBasePart.Id))
{
BaseParts.Add(newBasePart);
}
}
开发者ID:cg123,项目名称:xenko,代码行数:19,代码来源:AssetComposite.cs
示例8: CreateAsset
protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type)
{
AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, LIBRARY_OWNER_ID.ToString());
if (!String.IsNullOrEmpty(path))
{
//m_log.InfoFormat("[ASSETS]: Loading: [{0}][{1}]", name, path);
LoadAsset(asset, path);
}
else
{
m_log.InfoFormat("[ASSETS]: Instantiated: [{0}]", name);
}
return asset;
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:17,代码来源:AssetLoaderFileSystem.cs
示例9: StoreAsset
public override void StoreAsset(AssetBase asset)
{
byte[] idBytes = asset.FullID.Guid.ToByteArray();
string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0]
+ Path.DirectorySeparatorChar + idBytes[1];
if (!Directory.Exists(m_dir + Path.DirectorySeparatorChar + idBytes[0]))
Directory.CreateDirectory(m_dir + Path.DirectorySeparatorChar + idBytes[0]);
if (!Directory.Exists(cdir))
Directory.CreateDirectory(cdir);
FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create);
m_xs.Serialize(x, asset);
x.Flush();
x.Close();
}
开发者ID:ChrisD,项目名称:opensim,代码行数:19,代码来源:FileAssetClient.cs
示例10: CreateAsset
protected static AssetBase CreateAsset(string assetIdStr, string name, string path, bool isImage)
{
AssetBase asset = new AssetBase(
new UUID(assetIdStr),
name
);
if (!String.IsNullOrEmpty(path))
{
//m_log.InfoFormat("[ASSETS]: Loading: [{0}][{1}]", name, path);
LoadAsset(asset, isImage, path);
}
else
{
m_log.InfoFormat("[ASSETS]: Instantiated: [{0}]", name);
}
return asset;
}
开发者ID:kf6kjg,项目名称:halcyon,代码行数:20,代码来源:AssetLoaderFileSystem.cs
示例11: LoadAssetBase
private AssetBase LoadAssetBase(OSDMap map)
{
AssetBase asset = new AssetBase();
asset.Data = map["AssetData"].AsBinary();
asset.TypeString = map["ContentType"].AsString();
asset.CreationDate = map["CreationDate"].AsDate();
asset.CreatorID = map["CreatorID"].AsUUID();
asset.Description = map["Description"].AsString();
asset.ID = map["ID"].AsUUID();
asset.Name = map["Name"].AsString();
asset.Type = map["Type"].AsInteger();
return asset;
}
开发者ID:chazzmac,项目名称:Aurora-Sim,代码行数:13,代码来源:LLLoginService.cs
示例12: CreateMetaDataMap
private void CreateMetaDataMap(AssetBase data, OSDMap map)
{
map["ContentType"] = OSD.FromString(data.TypeString);
map["CreationDate"] = OSD.FromDate(data.CreationDate);
map["CreatorID"] = OSD.FromUUID(data.CreatorID);
map["Description"] = OSD.FromString(data.Description);
map["ID"] = OSD.FromUUID(data.ID);
map["Name"] = OSD.FromString(data.Name);
map["Type"] = OSD.FromInteger(data.Type);
}
开发者ID:chazzmac,项目名称:Aurora-Sim,代码行数:10,代码来源:LLLoginService.cs
示例13: Store
public string Store(AssetBase asset)
{
//m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
m_Database.StoreAsset(asset);
return asset.ID;
}
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:7,代码来源:AssetService.cs
示例14: AssetRequestCallback
/// <summary>
/// Called back by the asset cache when it has the asset
/// </summary>
/// <param name="assetID"></param>
/// <param name="sender"></param>
/// <param name="asset"></param>
public void AssetRequestCallback(string assetID, object sender, AssetBase asset)
{
try
{
lock (this)
{
//MainConsole.Instance.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id);
m_requestCallbackTimer.Stop();
if (m_requestState == RequestState.Aborted)
{
MainConsole.Instance.WarnFormat(
"[ARCHIVER]: Received information about asset {0} after archive save abortion. Ignoring.",
assetID);
return;
}
if (asset != null)
{
// MainConsole.Instance.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
m_foundAssetUuids.Add(asset.ID);
m_assetsArchiver.WriteAsset(asset);
}
else
{
// MainConsole.Instance.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id);
m_notFoundAssetUuids.Add(new UUID(assetID));
}
if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired)
{
m_requestState = RequestState.Completed;
MainConsole.Instance.InfoFormat(
"[ARCHIVER]: Successfully added {0} assets ({1} assets notified missing)",
m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);
// We want to stop using the asset cache thread asap
// as we now need to do the work of producing the rest of the archive
Util.FireAndForget(PerformAssetsRequestCallback);
}
else
m_requestCallbackTimer.Start();
}
}
catch (Exception e)
{
MainConsole.Instance.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e);
}
}
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:58,代码来源:AssetsRequest.cs
示例15: Store
public string Store(AssetBase asset)
{
//m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
m_Database.StoreAsset (asset);
IImprovedAssetCache cache = m_registry.RequestModuleInterface<IImprovedAssetCache> ();
if (cache != null && asset != null)
{
cache.Expire (asset.ID);
cache.Cache (asset);
}
return asset.ID;
}
开发者ID:RevolutionSmythe,项目名称:Aurora-Sim,代码行数:13,代码来源:AssetService.cs
示例16: SetUpAssetDatabase
private void SetUpAssetDatabase()
{
try
{
Console.WriteLine("setting up Asset database");
AssetBase Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
Image.Name = "Bricks";
this.LoadAsset(Image, true, "bricks.jp2");
AssetStorage store = new AssetStorage();
store.Data = Image.Data;
store.Name = Image.Name;
store.UUID = Image.FullID;
db.Set(store);
db.Commit();
Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
Image.Name = "Plywood";
this.LoadAsset(Image, true, "plywood.jp2");
store = new AssetStorage();
store.Data = Image.Data;
store.Name = Image.Name;
store.UUID = Image.FullID;
db.Set(store);
db.Commit();
Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
Image.Name = "Rocks";
this.LoadAsset(Image, true, "rocks.jp2");
store = new AssetStorage();
store.Data = Image.Data;
store.Name = Image.Name;
store.UUID = Image.FullID;
db.Set(store);
db.Commit();
Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
Image.Name = "Granite";
this.LoadAsset(Image, true, "granite.jp2");
store = new AssetStorage();
store.Data = Image.Data;
store.Name = Image.Name;
store.UUID = Image.FullID;
db.Set(store);
db.Commit();
Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
Image.Name = "Hardwood";
this.LoadAsset(Image, true, "hardwood.jp2");
store = new AssetStorage();
store.Data = Image.Data;
store.Name = Image.Name;
store.UUID = Image.FullID;
db.Set(store);
db.Commit();
Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
Image.Name = "Prim Base Texture";
this.LoadAsset(Image, true, "plywood.jp2");
store = new AssetStorage();
store.Data = Image.Data;
store.Name = Image.Name;
store.UUID = Image.FullID;
db.Set(store);
db.Commit();
Image = new AssetBase();
Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
Image.Name = "Shape";
this.LoadAsset(Image, false, "base_shape.dat");
store = new AssetStorage();
store.Data = Image.Data;
store.Name = Image.Name;
store.UUID = Image.FullID;
db.Set(store);
db.Commit();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:89,代码来源:LocalAssetServer.cs
示例17: RunRequests
private void RunRequests()
{
while (true)
{
byte[] idata = null;
bool found = false;
AssetStorage foundAsset = null;
ARequest req = this._assetRequests.Dequeue();
IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
if (result.Count > 0)
{
foundAsset = (AssetStorage)result.Next();
found = true;
}
AssetBase asset = new AssetBase();
if (found)
{
asset.FullID = foundAsset.UUID;
asset.Type = foundAsset.Type;
asset.InvType = foundAsset.Type;
asset.Name = foundAsset.Name;
idata = foundAsset.Data;
}
else
{
asset.FullID = LLUUID.Zero;
}
asset.Data = idata;
_receiver.AssetReceived(asset, req.IsTexture);
}
}
开发者ID:BackupTheBerlios,项目名称:ulife-svn,代码行数:32,代码来源:LocalAssetServer.cs
示例18: SaveFileCacheForAsset
private void SaveFileCacheForAsset(UUID AssetId, OpenJPEG.J2KLayerInfo[] Layers)
{
if (m_useCache)
m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10));
if (m_cache != null)
{
string assetID = "j2kCache_" + AssetId.ToString();
AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, AssetType.Notecard,
UUID.Zero)
{Flags = AssetFlags.Local | AssetFlags.Temporary};
#region Serialize Layer Data
StringBuilder stringResult = new StringBuilder();
string strEnd = "\n";
for (int i = 0; i < Layers.Length; i++)
{
if (i == Layers.Length - 1)
strEnd = String.Empty;
stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End,
Layers[i].End - Layers[i].Start, strEnd);
}
layerDecodeAsset.Data = Util.UTF8.GetBytes(stringResult.ToString());
#endregion Serialize Layer Data
m_cache.Cache(assetID, layerDecodeAsset);
}
}
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:33,代码来源:J2KDecoderModule.cs
示例19: SculptTextureCallback
public void SculptTextureCallback(UUID textureID, AssetBase texture)
{
if (m_shape.SculptEntry)
{
// commented out for sculpt map caching test - null could mean a cached sculpt map has been found
//if (texture != null)
{
if (texture != null)
m_shape.SculptData = texture.Data;
if (PhysActor != null)
{
// Tricks physics engine into thinking we've changed the part shape.
PrimitiveBaseShape m_newshape = m_shape.Copy();
PhysActor.Shape = m_newshape;
m_shape = m_newshape;
m_parentGroup.Scene.SceneGraph.PhysicsScene.AddPhysicsActorTaint(PhysActor);
}
}
}
}
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:22,代码来源:SceneObjectPart.cs
示例20: CreateAsset
protected AssetBase CreateAsset(string assetIdStr, string name, string path, AssetType type)
{
AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type, m_service.LibraryOwner);
if (!String.IsNullOrEmpty(path))
{
//MainConsole.Instance.InfoFormat("[ASSETS]: Loading: [{0}][{1}]", name, path);
LoadAsset(asset, path);
}
else
{
MainConsole.Instance.InfoFormat("[ASSETS]: Instantiated: [{0}]", name);
}
return asset;
}
开发者ID:aurora-sim,项目名称:Aurora-Sim-Optional-Modules,代码行数:17,代码来源:DefaultAssetXMLLoader.cs
注:本文中的AssetBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论