Exemplo n.º 1
0
        private static void ParseScorecard(FileStore dataStore, ScorecardDetails md)
        {
            CricketMatch m = dataStore.Load <CricketMatch>(CricketMatch.GenerateId(md.Season, md.MatchCode));

            if (m != null)
            {
                Log.InfoFormat("Match {0} ({1}) has already been imported", md.MatchCode, m);
                return;
            }

            Log.InfoFormat("Parsing scorecard for {0}", md);

            string scorecard = dataStore.LoadText(md.GenerateScorecardKey(), "html");

            if (string.IsNullOrEmpty(scorecard))
            {
                return;
            }

            DependencyFinder finder = new DependencyFinder(dataStore);
            ScorecardParser  parser = new ScorecardParser(md, finder);

            parser.Parse(scorecard);

            CricketMatch match = parser.Match;

            dataStore.Save(match, match.Id);

            Log.Info(match.ToLongString());
        }
Exemplo n.º 2
0
        public override IServiceCollection AddService(IServiceCollection services)
        {
            IDependencyFinder finder = new DependencyFinder();
            var types = finder.FinderAll();

            foreach (var type in types)
            {
                var interfance = type.GetInterfaces().FirstOrDefault(x => x.IsInterface && !x.IsDefined(typeof(IgnoreDependency), false));
                if (interfance != null)
                {
                    if (typeof(IScopeDependcy).IsAssignableFrom(interfance))
                    {
                        services.AddScoped(interfance, type);
                    }
                    else if (typeof(ITransientDependcy).IsAssignableFrom(interfance))
                    {
                        services.AddTransient(interfance, type);
                    }
                    else if (typeof(ISingletonDependcy).IsAssignableFrom(interfance))
                    {
                        services.AddSingleton(interfance, type);
                    }
                    else
                    {
                        services = AddAttbuiteDependenty(services, interfance, type);
                    }
                }
            }
            return(services);
        }
Exemplo n.º 3
0
        private static void ParseScorecard(FileStore dataStore, ScorecardDetails md)
        {
            CricketMatch m = dataStore.Load<CricketMatch>(CricketMatch.GenerateId(md.Season, md.MatchCode));
            if (m != null)
            {
                Log.InfoFormat("Match {0} ({1}) has already been imported", md.MatchCode, m);
                return;
            }

            Log.InfoFormat("Parsing scorecard for {0}", md);

            string scorecard = dataStore.LoadText(md.GenerateScorecardKey(), "html");
            if (string.IsNullOrEmpty(scorecard))
                return;

            DependencyFinder finder = new DependencyFinder(dataStore);
            ScorecardParser parser = new ScorecardParser(md, finder);
            parser.Parse(scorecard);

            CricketMatch match = parser.Match;

            dataStore.Save(match, match.Id);

            Log.Info(match.ToLongString());
        }
Exemplo n.º 4
0
 public ResourceEmbedder(DependencyFinder dependencyFinder, ModuleReader moduleReader, EmbedTask embedTask, Logger logger)
 {
     streams = new List <Stream>();
     this.dependencyFinder = dependencyFinder;
     this.moduleReader     = moduleReader;
     this.embedTask        = embedTask;
     this.logger           = logger;
 }
Exemplo n.º 5
0
 public ResourceEmbedder(DependencyFinder dependencyFinder, ModuleReader moduleReader, EmbedTask embedTask, Logger logger)
 {
     streams = new List<Stream>();
     this.dependencyFinder = dependencyFinder;
     this.moduleReader = moduleReader;
     this.embedTask = embedTask;
     this.logger = logger;
 }
Exemplo n.º 6
0
        public void AnalyseAssembly_returns_correct_dependency_count_when_assembly_has_no_dependencies()
        {
            var dependencyReporter = new DependencyFinder(_assemblyLoader);

            var dependencies = dependencyReporter.AnalyseAssembly(_mockAssemblyE, PATH);

            Assert.That(dependencies.Count, Is.EqualTo(0));
        }
Exemplo n.º 7
0
        public void AnalyseAssembly_returns_correct_dependency_count_when_assembly_has_only_one_dependency()
        {
            var dependencyReporter = new DependencyFinder(_assemblyLoader);

            var dependencies = dependencyReporter.AnalyseAssembly(_mockAssemblyC, PATH);

            Assert.That(dependencies.Count, Is.EqualTo(1));
            Assert.That(dependencies[0].ReferencedAssembly, Is.EqualTo(_assemblyNameE));
        }
Exemplo n.º 8
0
        public FarmZilla(ConfigurationConstants configuration)
        {
            _configuration = configuration;

            _dependencyFinder = new DependencyFinder();
            _fileCacheFarmer  = new FileCacheFarmer();
            _serviceFinder    = new ServiceFinder();
            _summarizer       = new Summarizer(configuration.SummaryOutputPath);
        }
Exemplo n.º 9
0
        public void AnalyseAssembly_returns_correct_dependency_count_in_the_middle_of_the_chain()
        {
            var dependencyReporter = new DependencyFinder(_assemblyLoader);

            var dependencies = dependencyReporter.AnalyseAssembly(_mockAssemblyB, PATH);

            Assert.That(dependencies.Count, Is.EqualTo(4));
            Assert.That(dependencies.Where(x => x.ReferencedAssembly == _assemblyNameC).Count(), Is.EqualTo(1));
            Assert.That(dependencies.Where(x => x.ReferencedAssembly == _assemblyNameD).Count(), Is.EqualTo(1));
            Assert.That(dependencies.Where(x => x.ReferencedAssembly == _assemblyNameE).Count(), Is.EqualTo(2));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Execute the command
        /// </summary>
        /// <returns>Returns 0 for success, otherwise 1.</returns>
        public int Execute()
        {
            var accessor = new CacheContextAccessor();
            var cache    = new Cache(accessor);

            var finder = new DependencyFinder(accessor, cache, _environment, _assemblyFolder);

            ICollection <string> tpa = finder.GetDependencies(Constants.BootstrapperCoreclrManagedName);

            // ordering the tpa list make it easier to compare the difference
            UpdateSourceFile(tpa.OrderBy(one => one).ToArray());

            return(0);
        }
Exemplo n.º 11
0
 public ScorecardParser(ScorecardDetails details, DependencyFinder finder)
 {
     _finder = finder;
     _match = new CricketMatch
                  {
                      Id = CricketMatch.GenerateId(details.Season, details.MatchCode),
                      MatchCode = details.MatchCode,
                      HomeTeam = details.HomeTeam,
                      AwayTeam = details.AwayTeam,
                      Season = details.Season,
                      StartDate = details.Date,
                      Players = "11 per side",
                      Innings = new List<Innings>()
                  };
 }
Exemplo n.º 12
0
 public ScorecardParser(ScorecardDetails details, DependencyFinder finder)
 {
     _finder = finder;
     _match  = new CricketMatch
     {
         Id        = CricketMatch.GenerateId(details.Season, details.MatchCode),
         MatchCode = details.MatchCode,
         HomeTeam  = details.HomeTeam,
         AwayTeam  = details.AwayTeam,
         Season    = details.Season,
         StartDate = details.Date,
         Players   = "11 per side",
         Innings   = new List <Innings>()
     };
 }
		static void Main(string[] args)
		{
			if (args.Length < 2)
			{
				Console.WriteLine("usage: SevenDigital.Tools.DependencyManager.exe pathContainingAssemblies startingassembly.dll");
				return;
			}

            var outputPath = args[0];
			var assembly = new WrappedAssembly(Assembly.LoadFrom(Path.Combine(outputPath, args[1])));

			var finder = new DependencyFinder(new AssemblyLoader());
			var dependencies = finder.AnalyseAssembly(assembly, outputPath);

			var logger = new Logger();
			PrintSummary(logger, dependencies);
			logger.ReadLine();
		}
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("usage: SevenDigital.Tools.DependencyManager.exe pathContainingAssemblies startingassembly.dll");
                return;
            }

            var outputPath = args[0];
            var assembly   = new WrappedAssembly(Assembly.LoadFrom(Path.Combine(outputPath, args[1])));

            var finder       = new DependencyFinder(new AssemblyLoader());
            var dependencies = finder.AnalyseAssembly(assembly, outputPath);

            var logger = new Logger();

            PrintSummary(logger, dependencies);
            logger.ReadLine();
        }
Exemplo n.º 15
0
        public int Execute()
        {
            var accessor = new CacheContextAccessor();
            var cache    = new Cache(accessor);
            var finder   = new DependencyFinder(accessor, cache, _environment, _assemblyFolder);

            var dependencies = new Dictionary <string, HashSet <string> >();

            dependencies[KeyRuntime] = new HashSet <string>();

            foreach (var name in _runtimeProjects)
            {
                dependencies[KeyRuntime].AddRange(finder.GetDependencies(name));
            }

            foreach (var name in _sdkProjects)
            {
                dependencies[name] = finder.GetDependencies(name);
            }

            foreach (var pair in dependencies.Skip(1))
            {
                pair.Value.ExceptWith(dependencies[KeyRuntime]);
            }

            using (var output = _outputFile != null ? new StreamWriter(_outputFile) : Console.Out)
            {
                foreach (var root in dependencies)
                {
                    output.WriteLine("-" + root.Key);
                    foreach (var contract in root.Value)
                    {
                        output.WriteLine(contract);
                    }
                }

                output.Write("-");
                output.Flush();
            }

            return(0);
        }
Exemplo n.º 16
0
 public HashSet <IEntity> FindDependencies(Statement s)
 {
     return(DependencyFinder.FindDependencies(_parent, s));
 }
Exemplo n.º 17
0
 public ReferenceDeleter(DependencyFinder dependencyFinder, EmbedTask embedTask, Logger logger)
 {
     this.dependencyFinder = dependencyFinder;
     this.embedTask        = embedTask;
     this.logger           = logger;
 }
Exemplo n.º 18
0
 public ResourceCaseFixer(DependencyFinder dependencyFinder, ModuleReader moduleReader, EmbedTask embedTask, Logger logger)
 {
     this.moduleReader = moduleReader;
 }
Exemplo n.º 19
0
 public MatchInfoParser(CricketMatch match, DependencyFinder finder)
 {
     _match = match;
     _finder = finder;
 }
Exemplo n.º 20
0
 public ReferenceDeleter(DependencyFinder dependencyFinder, EmbedTask embedTask, Logger logger)
 {
     this.dependencyFinder = dependencyFinder;
     this.embedTask = embedTask;
     this.logger = logger;
 }
Exemplo n.º 21
0
 public ResourceCaseFixer(DependencyFinder dependencyFinder, ModuleReader moduleReader, EmbedTask embedTask, Logger logger)
 {
     this.moduleReader = moduleReader;
 }
Exemplo n.º 22
0
 public HashSet <IEntity> FindDependencies(Function f)
 {
     return(DependencyFinder.FindDependencies(_parent, f));
 }
Exemplo n.º 23
0
 public MatchInfoParser(CricketMatch match, DependencyFinder finder)
 {
     _match  = match;
     _finder = finder;
 }