private void Run()
 {
     while (!IsStop)
     {
         var image = AssetsDistributor.Dequeue();
         if (image == null)
         {
             Thread.Sleep(1000);
             continue;
         }
         if (image.Extension == ".jpg" || image.Extension == ".jpeg")
         {
             Task.Run(() =>
             {
                 System.IO.File.Copy(image.FullName, _compareFolder + Guid.NewGuid() + image.Extension);
                 new JpegCompressService().Compress(image, _oldFolderPath, _newFolderPath);
             });
         }
         else if (image.Extension == ".png")
         {
             Task.Run(() =>
             {
                 System.IO.File.Copy(image.FullName, _compareFolder + Guid.NewGuid() + image.Extension);
                 new PngCompressService().Compress(image, _oldFolderPath, _newFolderPath);
             });
         }
     }
 }
 public static void AddToProcessQueue(FileInfo[] files)
 {
     if (!AssetsDistributor.Ready())
     {
         return;
     }
     foreach (var file in files)
     {
         if (AllowedExtensions.Contains(file.Extension))
         {
             AssetsDistributor.Enqueue(file);
         }
     }
 }