Пример #1
0
 public static TemplateFootprint Of(SampleFingerprint fp)
 {
     return(PersistentCache.Get("footprints", fp.Path, () =>
     {
         var footprint = new TemplateFootprint();
         var serialized = NativeTemplate.Serialized(fp);
         footprint.Count = 1;
         footprint.Serialized = serialized.Length;
         footprint.Hash = DataHash.Of(SerializationUtils.Normalize(serialized));
         return footprint;
     }));
 }
Пример #2
0
        public static TemplateFootprint Sum(List <TemplateFootprint> list)
        {
            var sum  = new TemplateFootprint();
            var hash = new DataHash();

            foreach (var footprint in list)
            {
                sum.Count      += footprint.Count;
                sum.Serialized += footprint.Serialized;
                hash.Add(footprint.Hash);
            }
            sum.Hash = hash.Compute();
            return(sum);
        }
Пример #3
0
        static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console(outputTemplate: "{Message:lj}{NewLine}{Exception}")
                         .CreateLogger();
            if (args.Length < 1)
            {
                return;
            }
            switch (args[0])
            {
            case "footprint":
                TemplateFootprint.Report();
                break;

            case "accuracy":
                ScalarAccuracy.Report();
                break;

            case "extractor-transparency-stats":
                TransparencyStats.Report(TransparencyStats.ExtractorTable());
                break;

            case "extractor-transparency-files":
                if (args.Length < 2)
                {
                    return;
                }
                TransparencyFile.Extractor(args[1]);
                break;

            case "normalized-extractor-transparency-files":
                if (args.Length < 2)
                {
                    return;
                }
                TransparencyFile.ExtractorNormalized(args[1]);
                break;
            }
        }