using Ninject;
using SteamTool.Core;
using System;
using System.Collections.Generic;
using System.Text;
namespace SteamTool.Core
{
public class SteamToolCore
{
private static SteamToolCore instance = null;
private static readonly object syncRoot = new Object();
///
/// IoC 容器
///
private IKernel Kernel { get; set; } = new StandardKernel();
public SteamToolCore()
{
Kernel.Bind().ToConstant(new ConfigService());
Kernel.Bind().ToConstant(new RegistryKeyService());
Kernel.Bind().ToSelf();
Kernel.Bind().To();
Kernel.Bind().ToConstant(new HttpServices());
Kernel.Bind().ToConstant(new HostsService());
}
public TInterface Get()
{
return Kernel.Get();
}
public void Dispose()
{
Kernel.Dispose();
}
///
/// 创建或者从缓存中获取对应业务类的实例
///
public static SteamToolCore Instance
{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
{
instance = new SteamToolCore();
}
}
}
return instance;
}
}
}
}