當前位置: 首頁>>代碼示例>>C#>>正文


C# AssetBase.Count方法代碼示例

本文整理匯總了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!");
//.........這裏部分代碼省略.........
開發者ID:savino1976,項目名稱:Aurora-Sim,代碼行數:101,代碼來源:BlackholeRegionCommands.cs


注:本文中的OpenSim.Framework.AssetBase.Count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。