private void ReportDependencyCore(DependencyItem dependency) { if (IsValidDependency(dependency)) { WriteDependency(() => ReportDependencyCoreNoLock(dependency)); } }
public void ReportDependency(DependencyItem dependency) { if (dependency == null) { throw new ArgumentNullException(nameof(dependency)); } ReportDependencyCore(dependency); }
private bool IsValidDependency(DependencyItem dependency) { if (!_types.ContainsKey(dependency.Type)) { Logger.LogWarning($"dependency type {dependency.Type} isn't registered yet."); return(false); } return(true); }
private void ReportDependencyCoreNoLock(DependencyItem dependency) { if (_dependencyItems.Add(dependency)) { CreateOrUpdate(_indexOnFrom, dependency.From, dependency); CreateOrUpdate(_indexOnReportedBy, dependency.ReportedBy, dependency); Logger.LogDiagnostic($"Dependency item is successfully reported: {JsonUtility.Serialize(dependency)}."); } }
private bool IsValidDependency(DependencyItem dependency) { DependencyType dt; if (!_types.TryGetValue(dependency.Type, out dt)) { Logger.LogWarning($"dependency type {dependency.Type} isn't registered yet."); return(false); } return(true); }
private bool IsValidDependency(DependencyItem dependency) { if (!_types.ContainsKey(dependency.Type)) { // When the processor contains no files other than overwrites, this processor will not even loaded, // As a result, the dependency types inside this processer will not be registered // This is a common case from now on so there is no need to log warning // Logger.LogWarning($"dependency type {dependency.Type} isn't registered yet."); return(false); } return(true); }
private void ReportDependencyCoreNoLock(DependencyItem dependency) { if (_dependencyItems.Add(dependency)) { if (CanReadDependency(dependency)) { CreateOrUpdate(_indexOnFrom, dependency.From.Value, dependency); CreateOrUpdate(_indexOnReportedBy, dependency.ReportedBy.Value, dependency); CreateOrUpdate(_indexOnTo, dependency.To.Value, dependency); } else { _isResolved = false; } Logger.LogDiagnostic($"Dependency item is successfully reported: {JsonUtility.Serialize(dependency)}."); } }
private bool CanReadDependency(DependencyItem dependency) { return(dependency.From.SourceType == DependencyItemSourceType.File && dependency.To.SourceType == DependencyItemSourceType.File && dependency.ReportedBy.SourceType == DependencyItemSourceType.File); }
private static void CreateOrUpdate(Dictionary <string, HashSet <DependencyItem> > index, string key, DependencyItem value) { HashSet <DependencyItem> items; if (!index.TryGetValue(key, out items)) { items = new HashSet <DependencyItem>(); index[key] = items; } items.Add(value); }
public void ReportDependency(DependencyItem dependency) { ReportDependency(new List <DependencyItem> { dependency }); }