Exemple #1
0
 public PiCalculator(uint times, FinishOnce onceCall, FinishedAll allCall)
 {
     this.times = times;
     once       = onceCall;
     all        = allCall;
 }
Exemple #2
0
        public void ConversionWorker(string webRootPath, Guid id, string originalFilePath, string sourceFormat,
                                     bool scan, string item)
        {
            List <Task> pool = new()
            {
                new(() => FinishedRenderingJpeg4kThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "JPEG", "4k", true, scan,
                                                                           item))),
                new(() => FinishedRenderingJpeg1440Thumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                             sourceFormat, "JPEG", "1440p", true, scan,
                                                                             item))),
                new(() => FinishedRenderingJpegHdThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "JPEG", "hd", true, scan,
                                                                           item))),
                new(() => FinishedRenderingJpeg4k?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "JPEG", "4k", false, scan, item))),
                new(() => FinishedRenderingJpeg1440?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                    "JPEG", "1440p", false, scan, item))),
                new(() => FinishedRenderingJpegHd?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "JPEG", "hd", false, scan, item))),
                new(() => FinishedRenderingJp2k4kThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "JP2K", "4k", true, scan,
                                                                           item))),
                new(() => FinishedRenderingJp2k1440Thumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                             sourceFormat, "JP2K", "1440p", true, scan,
                                                                             item))),
                new(() => FinishedRenderingJp2kHdThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "JP2K", "hd", true, scan,
                                                                           item))),
                new(() => FinishedRenderingJp2k4k?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "JP2K", "4k", false, scan, item))),
                new(() => FinishedRenderingJp2k1440?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                    "JP2K", "1440p", false, scan, item))),
                new(() => FinishedRenderingJp2kHd?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "JP2K", "hd", false, scan, item))),
                new(() => FinishedRenderingWebp4kThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "WEBP", "4k", true, scan,
                                                                           item))),
                new(() => FinishedRenderingWebp1440Thumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                             sourceFormat, "WEBP", "1440p", true, scan,
                                                                             item))),
                new(() => FinishedRenderingWebpHdThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "WEBP", "hd", true, scan,
                                                                           item))),
                new(() => FinishedRenderingWebp4k?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "WEBP", "4k", false, scan, item))),
                new(() => FinishedRenderingWebp1440?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                    "WEBP", "1440p", false, scan, item))),
                new(() => FinishedRenderingWebpHd?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "WEBP", "hd", false, scan, item))),
                new(() => FinishedRenderingHeif4kThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "HEIF", "4k", true, scan,
                                                                           item))),
                new(() => FinishedRenderingHeif1440Thumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                             sourceFormat, "HEIF", "1440p", true, scan,
                                                                             item))),
                new(() => FinishedRenderingHeifHdThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "HEIF", "hd", true, scan,
                                                                           item))),
                new(() => FinishedRenderingHeif4k?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "HEIF", "4k", false, scan, item))),
                new(() => FinishedRenderingHeif1440?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                    "HEIF", "1440p", false, scan, item))),
                new(() => FinishedRenderingHeifHd?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "HEIF", "hd", false, scan, item))),
                new(() => FinishedRenderingAvif4kThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "AVIF", "4k", true, scan,
                                                                           item))),
                new(() => FinishedRenderingAvif1440Thumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                             sourceFormat, "AVIF", "1440p", true, scan,
                                                                             item))),
                new(() => FinishedRenderingAvifHdThumbnail?.Invoke(Convert(webRootPath, id, originalFilePath,
                                                                           sourceFormat, "AVIF", "hd", true, scan,
                                                                           item))),
                new(() => FinishedRenderingAvif4k?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "AVIF", "4k", false, scan, item))),
                new(() => FinishedRenderingAvif1440?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                    "AVIF", "1440p", false, scan, item))),
                new(() => FinishedRenderingAvifHd?.Invoke(Convert(webRootPath, id, originalFilePath, sourceFormat,
                                                                  "AVIF", "hd", false, scan, item)))
            };

            foreach (Task thread in pool)
            {
                thread.Start();
            }

            Task.WaitAll(pool.ToArray());

            FinishedAll?.Invoke(true);
        }