public int GetUsagesCount(IClassLikeDeclaration classLikeDeclaration, out bool estimatedResult)
        {
            myShellLocks.AssertReadAccessAllowed();

            // TODO : prefabs
            estimatedResult = false;

            var sourceFile = classLikeDeclaration.GetSourceFile();

            if (sourceFile == null)
            {
                return(0);
            }

            var declaredElement = classLikeDeclaration.DeclaredElement;

            if (declaredElement == null)
            {
                return(0);
            }

            var guid = GetGuidFor(declaredElement);

            return(myAssetUsages.GetOrEmpty(guid).Count);
        }
Exemplo n.º 2
0
        public int GetScriptUsagesCount(IClassLikeDeclaration classLikeDeclaration, out bool estimatedResult)
        {
            myShellLocks.AssertReadAccessAllowed();

            // TODO : prefabs
            estimatedResult = false;

            var sourceFile = classLikeDeclaration.GetSourceFile();

            if (sourceFile == null)
            {
                return(0);
            }

            var declaredElement = classLikeDeclaration.DeclaredElement;

            if (declaredElement == null)
            {
                return(0);
            }

            var guid = AssetUtils.GetGuidFor(myMetaFileGuidCache, declaredElement);

            if (guid == null)
            {
                return(0);
            }

            return(myUsagesCount.GetCount(guid.Value));
        }
        public int GetScriptUsagesCount(IClassLikeDeclaration classLikeDeclaration, out bool estimatedResult)
        {
            AssertShellLocks();
            estimatedResult = false;
            var sourceFile = classLikeDeclaration.GetSourceFile();

            if (sourceFile == null)
            {
                return(0);
            }
            var declaredElement = classLikeDeclaration.DeclaredElement;

            if (declaredElement == null)
            {
                return(0);
            }
            var guid = AssetUtils.GetGuidFor(myMetaFileGuidCache, declaredElement);

            return(guid != null?myUsagesCount.GetCount(guid.Value) : 0);
        }