// Copyright (c) StellaOps. All rights reserved. // Licensed under BUSL-1.1. See LICENSE in the project root. using Microsoft.Extensions.DependencyInjection; namespace StellaOps.BinaryIndex.Decompiler; /// /// Extension methods for registering decompiler services. /// public static class DecompilerServiceCollectionExtensions { /// /// Adds decompiler services to the service collection. /// /// The service collection. /// The service collection for chaining. public static IServiceCollection AddDecompilerServices(this IServiceCollection services) { ArgumentNullException.ThrowIfNull(services); // Register parser services.AddSingleton(); // Register comparison engine services.AddSingleton(); // Register normalizer services.AddSingleton(); // Register decompiler service services.AddScoped(); return services; } /// /// Adds decompiler services with custom options. /// /// The service collection. /// Action to configure decompiler options. /// The service collection for chaining. public static IServiceCollection AddDecompilerServices( this IServiceCollection services, Action configureOptions) { ArgumentNullException.ThrowIfNull(services); ArgumentNullException.ThrowIfNull(configureOptions); services.Configure(configureOptions); return services.AddDecompilerServices(); } }