Ejemplo n.º 1
0
 private void ReportDependencyCore(DependencyItem dependency)
 {
     if (IsValidDependency(dependency))
     {
         WriteDependency(() => ReportDependencyCoreNoLock(dependency));
     }
 }
Ejemplo n.º 2
0
 public void ReportDependency(DependencyItem dependency)
 {
     if (dependency == null)
     {
         throw new ArgumentNullException(nameof(dependency));
     }
     ReportDependencyCore(dependency);
 }
Ejemplo n.º 3
0
 private bool IsValidDependency(DependencyItem dependency)
 {
     if (!_types.ContainsKey(dependency.Type))
     {
         Logger.LogWarning($"dependency type {dependency.Type} isn't registered yet.");
         return(false);
     }
     return(true);
 }
Ejemplo n.º 4
0
 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)}.");
     }
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
        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)}.");
            }
        }
Ejemplo n.º 8
0
 private bool CanReadDependency(DependencyItem dependency)
 {
     return(dependency.From.SourceType == DependencyItemSourceType.File &&
            dependency.To.SourceType == DependencyItemSourceType.File &&
            dependency.ReportedBy.SourceType == DependencyItemSourceType.File);
 }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 public void ReportDependency(DependencyItem dependency)
 {
     ReportDependency(new List <DependencyItem> {
         dependency
     });
 }