Skip to the content.

7. Services Reference

All classes live in BatchConvertToCHD/Services/. Namespaces are BatchConvertToCHD.Services unless noted.


7.1 AppHttpClient

internal static class AppHttpClient (AppHttpClient.cs:13)

Thread-safe singleton HttpClient used by BugReportService, StatsService, and UpdateService.


7.2 ArchiveService

internal class ArchiveService : IDisposable (ArchiveService.cs:23)

Decompresses archives and compressed images for the conversion pipeline.

Construction

ArchiveService(string sevenZipExePath, bool isSevenZipAvailable) — the app passes Path.Combine(baseDirectory, AppConfig.SevenZipExeName) plus whether the file exists.

API

Member Purpose
ExtractCsoAsync(originalCsoPath, tempOutputIsoPath, tempDirectoryRoot, onLog, token) Decompresses a .cso/.ciso to an ISO via CSOSharp (CsoFile.OpenExtractToIso). Returns (Success, FilePath, TempDir, ErrorMessage).
ExtractArchiveAsync(originalArchivePath, tempDirectoryRoot, onLog, token) Dispatches by extension: .zipExtractZipWith7ZaFallbackAsync; .7zExtractSevenZipArchiveAsync; .rarExtractRarArchive. Returns (Success, List<string> FilePaths, TempDir, ErrorMessage).
ExtractArchiveWithFallback<TArchive>(...) (static) Shared SharpCompress extraction with temp-copy fallback; TArchive : IArchive, IDisposable.
IsMultiPartRarError(Exception) (static) True for SharpCompress multi-part RAR messages.
IsNetworkUnavailableError(Exception) (static) True for network-unavailable messages (disconnected drive).

Key behaviors


7.3 BugReportApiSink

internal class BugReportApiSink : ILogEventSink (BugReportApiSink.cs:13)

Serilog sink that forwards Warning and above log events to BugReportService.SendBugReportAsync.


7.4 BugReportService

internal class BugReportService (BugReportService.cs:14)

Client for the PureLogicCode BugReport API. Full details and the exclusion list in Bug Reporting System.


7.5 FileWatcherService

internal sealed class FileWatcherService : IDisposable (FileWatcherService.cs:12)

Explains why a file disappeared mid-batch.

The watcher is started when the user picks the conversion input folder and is consumed in ProcessSingleFileForConversionAsync when a selected file is gone.


7.6 LegacyCleanupService

internal static class LegacyCleanupService (LegacyCleanupService.cs:10)

Runs once at startup on a background thread and deletes leftovers from older versions next to the executable:

All failures are silently ignored (files may be in use).


7.7 ScreenshotService

internal class ScreenshotService (ScreenshotService.cs:16)

Captures the foreground window via GDI (GetForegroundWindowGetWindowRectBitBlt) and saves a PNG:


7.8 StatsService

internal class StatsService (StatsService.cs:8)

Records anonymous usage statistics once per launch.


7.9 UpdateService

internal class UpdateService (UpdateService.cs:13)

Checks GitHub for new releases at startup.