当前位置: 首页>>代码示例>>C#>>正文


C# AssetBase.Count方法代码示例

本文整理汇总了C#中AssetBase.Count方法的典型用法代码示例。如果您正苦于以下问题:C# AssetBase.Count方法的具体用法?C# AssetBase.Count怎么用?C# AssetBase.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在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);

            m_Log.Info("[BlkHolAssets] Total Texture Bytes " + totalBytes);
            m_Log.Info("[BlkHolAssets] Total Texture Kilobyte " + (totalBytes / 1024.0));
            m_Log.Info("[BlkHolAssets] Total Texture Megabyte " + (totalBytes / 1048576.0));
            m_Log.Info("[BlkHolAssets] " + totalTextures + " textures on region");
            m_Log.Info("[BlkHolAssets] " + totalChagnesTextures + " textures could be optimised");
            m_Log.Info("[BlkHolAssets] " + totalInventory + " item in object inventory");
            m_Log.Info("[BlkHolAssets] " + scriptCount + " scripts in object inventory");
            m_Log.Info("Largest Textures Top 10");
            m_Log.Info("UUID                                 Size");
            m_Log.Info("--------------------------------------------------------------");

            int loopTo = 9;
            if (SortResults.Count() <= 9)
                loopTo = SortResults.Count();
//.........这里部分代码省略.........
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:101,代码来源:BlackholeRegionCommands.cs


注:本文中的AssetBase.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。