Ejemplo n.º 1
0
        private static void Identify(string path, string stdin)
        {
            var results = DnaShell.Identify(path, stdin);

            var candidates = Rank.Top(results, "", 10, new Criteria()
            {
                MinMarkerScore = 0.90,
                MinDistance    = .99,
                MinCallScore   = .90
            });

            var items = candidates.First().Value;

            foreach (var candidate in items)
            {
                Console.WriteLine("{0} {1} Distance {2} ", candidate.Api, candidate.Version, candidate.Distance);
            }

            // because only looking at 1 top candidate, can flatten entire list.
            //var apiVersionList = Rank.Usage(candidates.SelectMany(c => c.Value).ToList());
            //foreach (var apiVersion in apiVersionList)
            //{
            //    Console.WriteLine(apiVersion.SummaryReport());
            //}
        }
Ejemplo n.º 2
0
 private static void Detect(string jsLib, string traceFileOrDirectory)
 {
     if (Directory.Exists(traceFileOrDirectory))
     {
         foreach (var trace in Directory.EnumerateFiles(traceFileOrDirectory, "*.json"))
         {
             DnaShell.Detect(jsLib, trace);
         }
     }
 }
Ejemplo n.º 3
0
        private static void Demo(string apiPath, string traceFileDir)
        {
            foreach (var traceFile in Directory.GetFiles(traceFileDir))
            {
                Console.WriteLine(traceFile);
                var results    = DnaShell.DetectApi(apiPath, traceFile);
                var candidates = Rank.Top(results, apiPath, 1, new Criteria()
                {
                    MinMarkerScore = 0.90,
                    MinDistance    = .99,
                    MinCallScore   = .90
                });

                Console.WriteLine(string.Format("Scanned {0} scripts.", candidates.Count));

                // because only looking at 1 top candidate, can flatten entire list.
                var apiVersionList = Rank.Usage(candidates.SelectMany(c => c.Value).ToList());
                foreach (var apiVersion in apiVersionList)
                {
                    Console.WriteLine(apiVersion.SummaryReport());
                }
            }
        }
Ejemplo n.º 4
0
 // TODO Metric -- inclusive, exclusion (calls/markers)
 // TODO Json output.
 private static void Sequence(string apisRootDirectory)
 {
     DnaShell.SequenceApis(apisRootDirectory);
 }