//
// ServiceCollectionExtensions.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Extensions.DependencyInjection;
using NosSmooth.LocalBinding.Objects;
using NosSmooth.LocalBinding.Structs;
namespace NosSmooth.LocalBinding.Extensions;
///
/// Contains extension methods for .
///
public static class ServiceCollectionExtensions
{
///
/// Adds bindings to Nostale objects along with to initialize those.
///
///
/// Adds and .
/// You have to initialize these using
/// prior to requesting them from the provider, otherwise an exception
/// will be thrown.
///
/// The service collection.
/// The collection.
public static IServiceCollection AddNostaleBindings(this IServiceCollection serviceCollection)
{
return serviceCollection
.AddSingleton()
.AddSingleton()
.AddSingleton(p => p.GetRequiredService().PlayerManager)
.AddSingleton(p => p.GetRequiredService().SceneManager)
.AddSingleton(p => p.GetRequiredService().PetManagerList)
.AddSingleton(p => p.GetRequiredService().SceneManager)
.AddSingleton(p => p.GetRequiredService().PetManagerList)
.AddSingleton(p => p.GetRequiredService().PlayerManager)
.AddSingleton(p => p.GetRequiredService().PetManager)
.AddSingleton(p => p.GetRequiredService().UnitManager)
.AddSingleton(p => p.GetRequiredService().Network);
}
///
/// Configures what functions to hook and allows the user to make pattern, offset changes.
///
/// The service collection.
/// Function for configuring the hook config.
/// The collection.
public static IServiceCollection ConfigureHooks(this IServiceCollection serviceCollection, Action configure)
{
var builder = new HooksConfigBuilder();
configure(builder);
builder.Apply(serviceCollection);
return serviceCollection;
}
}