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 GetAffectedFilesWithSpecificValue(Guid guid, IEnumerable <string> possibleNames, IAssetValue value) { myShellLocks.AssertReadAccessAllowed(); var result = 0; foreach (var possibleName in possibleNames) { result += myValuesWhichAreUniqueInWholeFile.GetCount(new MonoBehaviourFieldWithValue(new MonoBehaviourField(guid, possibleName.GetPlatformIndependentHashCode()), value.GetHashCode())); } return(result); }
public int GetAssetUsagesCountInner(IDeclaredElement declaredElement, out bool estimatedResult) { myShellLocks.AssertReadAccessAllowed(); estimatedResult = false; if (!(declaredElement is IClrDeclaredElement clrDeclaredElement)) { return(0); } if (!IsPossibleEventHandler(declaredElement)) { return(0); } if (myExternalCount.GetCount(declaredElement.ShortName) > 0) { estimatedResult = true; } const int maxProcessCount = 5; if (myLocalUsages.GetOrEmpty(declaredElement.ShortName).Count > maxProcessCount) { estimatedResult = true; } var usageCount = 0; foreach (var(assetMethodData, c) in myLocalUsages.GetOrEmpty(declaredElement.ShortName).Take(maxProcessCount)) { var solution = declaredElement.GetSolution(); var module = clrDeclaredElement.Module; // we have already cache guid in merge method for methodData in myLocalUsages var guid = (assetMethodData.TargetScriptReference as ExternalReference)?.ExternalAssetGuid; if (guid == null) { continue; } var symbolTable = GetReferenceSymbolTable(solution, module, assetMethodData, guid); var resolveResult = symbolTable.GetResolveResult(assetMethodData.MethodName); if (resolveResult.ResolveErrorType == ResolveErrorType.OK && Equals(resolveResult.DeclaredElement, declaredElement)) { usageCount += c; } } return(usageCount); }
public bool IsIndexResultEstimated(Guid ownerGuid, ITypeElement containingType, IEnumerable <string> possibleNames) { myShellLocks.AssertReadAccessAllowed(); var names = possibleNames.ToArray(); foreach (var name in names) { if (myNamesInPrefabModifications.GetCount(name) > 0) { return(true); } } return(AssetUtils.HasPossibleDerivedTypesWithMember(ownerGuid, containingType, names, myNameHashToGuids)); }
public bool IsScenePresentedAtEditorBuildSettings(string sceneName, out bool ambiguousDefinition) { ambiguousDefinition = false; var shortCount = myShortNameAtBuildSettings.GetCount(sceneName); if (shortCount > 1) { ambiguousDefinition = true; return(true); } if (shortCount == 1) { return(true); } return(myLocalCache.Scenes.SceneNamesFromBuildSettings.Contains(sceneName)); }
public int GetFilesCountWithoutChanges(MonoBehaviourProperty query, object value) { return(myValuesWhichAreUniqueInWholeFile.GetCount(new MonoBehaviourPropertyWithValue(query, value))); }