本文整理汇总了C#中OpenSim.Framework.AssetBase.Count方法的典型用法代码示例。如果您正苦于以下问题:C# AssetBase.Count方法的具体用法?C# AssetBase.Count怎么用?C# AssetBase.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.AssetBase
的用法示例。
在下文中一共展示了AssetBase.Count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssetDetails
public void AssetDetails(string[] cmd)
{
if (MainConsole.Instance.ConsoleScene == null)
{
MainConsole.Instance.Output("Select a scene first");
return;
}
int totalBytes = 0;
int totalTextures = 0;
int couldSave = 0;
int totalChagnesTextures = 0;
int totalInventory = 0;
int totalChangesInventory = 0;
int scriptCount = 0;
int objectCount = 0;
List<UUID> converted = new List<UUID>();
NameValueCollection allAssetCount = new NameValueCollection();
List<UUID> allAssetIDLookup = new List<UUID>();
List<AssetBase> allAssets = new List<AssetBase>();
int counter = 0;
ISceneEntity[] entities = MainConsole.Instance.ConsoleScene.Entities.GetEntities();
foreach (ISceneEntity entity in entities)
foreach (ISceneChildEntity child in entity.ChildrenEntities())
{
objectCount++;
IEnumerable<UUID> textures = GetTextures(child.Shape.Textures);
foreach (UUID t in textures)
{
AssetBase ass = MainConsole.Instance.ConsoleScene.AssetService.Get(t.ToString());
if (ass != null)
{
if (!allAssetIDLookup.Contains(ass.ID))
{
totalTextures++;
totalBytes += ass.Data.Length;
allAssetIDLookup.Add(ass.ID);
ass.Description = ass.Data.Length.ToString();
ass.Data = new byte[] {};
allAssets.Add(ass);
allAssetCount.Add(ass.ID.ToString(), "1");
counter++;
}
else
{
allAssetCount[ass.ID.ToString()] = (int.Parse(allAssetCount[ass.ID.ToString()]) + 1).ToString();
}
if ((ass.ParentID != UUID.Zero) && (ass.ParentID != ass.ID))
{
if (converted.Contains(ass.ParentID))
couldSave += ass.Data.Length;
else
converted.Add(ass.ParentID);
totalChagnesTextures++;
}
}
}
foreach (TaskInventoryItem inventoryItem in child.Inventory.GetInventoryItems())
{
totalInventory++;
AssetBase ass2 = MainConsole.Instance.ConsoleScene.AssetService.Get(inventoryItem.AssetID.ToString());
if (ass2 != null)
{
if ((ass2 != null) && (ass2.ParentID != UUID.Zero) && (ass2.ParentID != ass2.ID))
totalChangesInventory++;
if ((ass2.TypeAsset == AssetType.LSLText) || (ass2.TypeAsset == AssetType.LSLBytecode))
scriptCount++;
}
}
}
AssetBase[] SortResults = new AssetBase[] {};
SortResults = SortAssetArray(allAssets.ToArray(), SortResults, 0);
MainConsole.Instance.Info("[BlkHolAssets] Total Texture Bytes " + totalBytes);
MainConsole.Instance.Info("[BlkHolAssets] Total Texture Kilobyte " + (totalBytes/1024.0));
MainConsole.Instance.Info("[BlkHolAssets] Total Texture Megabyte " + (totalBytes/1048576.0));
MainConsole.Instance.Info("[BlkHolAssets] " + totalTextures + " textures on region");
MainConsole.Instance.Info("[BlkHolAssets] " + totalChagnesTextures + " textures could be optimised");
MainConsole.Instance.Info("[BlkHolAssets] " + totalInventory + " item in object inventory");
MainConsole.Instance.Info("[BlkHolAssets] " + scriptCount + " scripts in object inventory");
MainConsole.Instance.Info("Largest Textures Top 10");
MainConsole.Instance.Info("UUID Size");
MainConsole.Instance.Info("--------------------------------------------------------------");
int loopTo = 9;
if (SortResults.Count() <= 9)
loopTo = SortResults.Count();
for (int looper = 0; looper <= loopTo; looper++)
{
double mbsize = Math.Round((int.Parse(SortResults[looper].Description)/1048576.0)*100.0)/100.0;
MainConsole.Instance.Info(SortResults[looper].ID + " " + mbsize + "MB");
}
MainConsole.Instance.Info("[BlkHolAssets] Nothing escapes the BlackHole!");
//.........这里部分代码省略.........