Beispiel #1
0
 public static void PreProcessing(bool startStopwatch = true, bool showSize = true)
 {
     dirSizePre = 0;
     dirSizePre = IOUtils.GetDirSize(new DirectoryInfo(currentDir));
     if (showSize)
     {
         Logger.Log("\nFolder size before processing: " + FormatUtils.Bytes(dirSizePre) + "\n");
     }
     timer.Reset();
     if (startStopwatch)
     {
         timer.Start();
     }
 }
Beispiel #2
0
        public static void PostProcessing(string sourcePath, string outPath, long bytesSrc, bool delSrc, string note = "")
        {
            long   bytesPost = new FileInfo(outPath).Length;
            string noteStr   = string.IsNullOrWhiteSpace(note) ? "" : $" ({note})";
            string filename  = Path.GetFileNameWithoutExtension(outPath).Trunc(35) + Path.GetExtension(outPath);

            Logger.Log(
                $"Saved {filename}{noteStr}. Size Before: {FormatUtils.Bytes(bytesSrc)}" +
                $" - Size After: {FormatUtils.Bytes(bytesPost)} ({FormatUtils.Ratio(bytesSrc, bytesPost)})");

            if (!string.IsNullOrWhiteSpace(sourcePath) && delSrc)
            {
                DelSource(sourcePath, outPath);
            }
        }
Beispiel #3
0
        public static void PostProcessing(int amount, bool showStopwatch = false, bool showSize = true)
        {
            timer.Stop();
            dirSizeAfter = 0;
            dirSizeAfter = IOUtils.GetDirSize(new DirectoryInfo(currentDir));

            progBar.Value = 0;
            Logger.Log("\nDone.");

            if (showStopwatch)
            {
                string rate = ((float)amount / (timer.ElapsedMilliseconds / 1000f)).ToString("0.00");
                Logger.Log($"Processing time: {FormatUtils.TimeSw(timer)} for {amount} files ({rate}/Sec)");
            }


            if (showSize)
            {
                Logger.Log("Folder size after processing: " + FormatUtils.Bytes(dirSizeAfter) + " from " + FormatUtils.Bytes(dirSizePre));
                Logger.Log("Size ratio: " + FormatUtils.Ratio(dirSizePre, dirSizeAfter) + " of original size");
            }
        }