protected void FindZips()
 {
     _ids = new HashSet <string>();
     _log.SearchingZips(_io.GetFullPath_In(""));
     foreach (var zip in _io.FindRelativeZipPaths())
     {
         _ids.Add(zip);
     }
     _log.FoundZips(_ids.Count);
 }
Exemple #2
0
        public void Run()
        {
            Console.WriteLine("Comparing two folder of contexts:");
            Console.WriteLine("A: {0}", _ioA.GetFullPath_In(""));
            Console.WriteLine("B: {0}", _ioB.GetFullPath_In(""));

            Console.WriteLine("Reading A ...");
            var zipsA = _ioA.FindRelativeZipPaths();

            Console.WriteLine("Found {0} zips.", zipsA.Count);


            Console.WriteLine("Reading B ...");
            var zipsB = _ioB.FindRelativeZipPaths();

            Console.WriteLine("Found {0} zips.", zipsB.Count);

            var notInB = Sets.NewHashSet <string>();

            foreach (var zip in zipsA)
            {
                if (!zipsB.Contains(zip))
                {
                    notInB.Add(zip);
                }
            }

            var notInA = Sets.NewHashSet <string>();

            foreach (var zip in zipsB)
            {
                if (!zipsA.Contains(zip))
                {
                    notInA.Add(zip);
                }
            }

            Console.WriteLine("== {0} zips in common ==", zipsA.Count - notInB.Count);

            Console.WriteLine("== {0} zips not in A ==", notInA.Count);
            foreach (var zip in notInA)
            {
                Console.WriteLine("* {0}", zip);
            }

            Console.WriteLine("== {0} zips not in B ==", notInB.Count);
            foreach (var zip in notInB)
            {
                Console.WriteLine("* {0}", zip);
            }


            var gainedSize = Sets.NewHashSet <string>();

            Console.WriteLine("== reduced size ==");
            foreach (var zip in zipsA)
            {
                if (!notInB.Contains(zip))
                {
                    var sizeA    = _ioA.GetSize_In(zip);
                    var sizeB    = _ioB.GetSize_In(zip);
                    var delta    = (sizeB / (double)sizeA - 1) * 100;
                    var deltaAbs = Math.Abs(delta);
                    if (deltaAbs >= 0.1) // 0.001 or 0.1%
                    {
                        var sign = delta > 0 ? '+' : '-';
                        var str  = "* {0}  ({1}{2:0.0}%)".FormatEx(zip, sign, deltaAbs);

                        if (delta < 0)
                        {
                            Console.WriteLine(str);
                        }

                        if (delta > 0)
                        {
                            gainedSize.Add(str);
                        }
                    }
                }
            }

            Console.WriteLine("== gained size ==");
            foreach (var str in gainedSize)
            {
                Console.WriteLine(str);
            }
        }
Exemple #3
0
        private void Initialize()
        {
            var zips = _io.FindRelativeZipPaths();

            _data = new PreprocessingData(zips);
        }