using System;
using Confuser.Core.API;
using Confuser.Core.Services;
namespace Confuser.Core {
///
/// Core component of Confuser.
///
public class CoreComponent : ConfuserComponent {
///
/// The service ID of RNG
///
public const string _RandomServiceId = "Confuser.Random";
///
/// The service ID of Marker
///
public const string _MarkerServiceId = "Confuser.Marker";
///
/// The service ID of Trace
///
public const string _TraceServiceId = "Confuser.Trace";
///
/// The service ID of Runtime
///
public const string _RuntimeServiceId = "Confuser.Runtime";
///
/// The service ID of Compression
///
public const string _CompressionServiceId = "Confuser.Compression";
///
/// The service ID of API Store
///
public const string _APIStoreId = "Confuser.APIStore";
readonly Marker marker;
readonly ConfuserParameters parameters;
///
/// Initializes a new instance of the class.
///
/// The parameters.
/// The marker.
internal CoreComponent(ConfuserParameters parameters, Marker marker) {
this.parameters = parameters;
this.marker = marker;
}
///
public override string Name {
get { return "Confuser Core"; }
}
///
public override string Description {
get { return "Initialization of Confuser core services."; }
}
///
public override string Id {
get { return "Confuser.Core"; }
}
///
public override string FullId {
get { return "Confuser.Core"; }
}
///
protected internal override void Initialize(ConfuserContext context) {
context.Registry.RegisterService(_RandomServiceId, typeof(IRandomService), new RandomService(parameters.Project.Seed));
context.Registry.RegisterService(_MarkerServiceId, typeof(IMarkerService), new MarkerService(context, marker));
context.Registry.RegisterService(_TraceServiceId, typeof(ITraceService), new TraceService());
context.Registry.RegisterService(_RuntimeServiceId, typeof(IRuntimeService), new RuntimeService());
context.Registry.RegisterService(_CompressionServiceId, typeof(ICompressionService), new CompressionService(context));
context.Registry.RegisterService(_APIStoreId, typeof(IAPIStore), new APIStore(context));
}
///
protected internal override void PopulatePipeline(ProtectionPipeline pipeline) {
//
}
}
}