public static void RegistrationByConvention(this Container container, 
            BehaviorConfiguration configuration, 
            Action<IConventionBuilderSyntax<Lifestyle, Container>> convention)
        {
            if (configuration == null)
            {
                configuration = BehaviorConfiguration.Default;
            }

            var logger = new DiagnosticLogger(configuration);
            var serviceMappingTracker = new ServiceMappingTracker(logger);
            var implementationFilter = new ImplementationFilter();
            var adapter = new SimpleInjectorContainerAdapter(container, serviceMappingTracker, implementationFilter);
            var configServiceFilter = ((IBehaviorConfiguration)configuration).GetServiceFilter();

            var asmSelector = new AssemblySelector();
            var serviceExtractor = new ServiceExtractor();
            var containerDecorator = new ContainerLogger<Lifestyle>(adapter, logger);
            var serviceFilterAggregator = new ServiceFilterAggregator(new IServiceFilter[] { configServiceFilter, implementationFilter, serviceExtractor, serviceMappingTracker });
            using (var builder = new ConventionBuilder<Lifestyle>(containerDecorator,
                asmSelector,
                serviceFilterAggregator,
                serviceExtractor))
            {
                var importer = new ConventionBuilderSyntaxDecorator<Lifestyle, Container>(builder, container, implementationFilter, asmSelector);
                convention(importer);
            }
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            LoadUI();

            Logger = new ContainerLogger(Container, true, false);
            Program.ProgramLoaded += OnProgramLoaded;

            this.Invoke((MethodInvoker)delegate { this.Text += " - Build "; });
            BackgroundWorker_Load.RunWorkerAsync();
        }
        public AutoInjector(string processName, string filePath, ContainerLogger logger)
        {
            RemoteHooking.IpcCreateServer <HookInterface>(ref ChannelName, WellKnownObjectMode.Singleton);
            PatchedClients = new List <int>();
            ProcessName    = processName;
            FilePath       = filePath;
            Running        = false;
            Logger         = logger;

            try
            {
                ExistingProcessInjection();
            }
            catch (Exception ex) { Logger.Error("(ProcessInjector) " + ex.Message); }
        }
Beispiel #4
0
        public static void LoadProgram(ContainerLogger logger)
        {
            int time = Environment.TickCount;

            ConsoleManager.InitLogger(logger);
            logger.Info("#Démarrage de la solution...");

            if (!ConfigurationManager.IsFileExists() || ConfigurationManager.GetEntryByName("GamePath") == null)
            {
                logger.Warning("Aucun fichier de configuration trouvé.");

                ConfigurationManager.SerializeConfig();

                Application.Run(new PathForm());

                if (ConfigurationManager.GetEntryByName("GamePath") == null)
                {
                    System.Environment.Exit(1);
                    return;
                }

                logger.Debug("Configuration définie.");
            }
            else
            {
                ConfigurationManager.DeserializeConfig();
                logger.Debug("Fichier de configuration chargé.");
            }

            ProtocolTypeManager.Initialize();
            MessageReceiver.Initialize();

            try
            {
                NetworkManager.StartServers();
                logger.Debug("Serveurs démarrés.");
            }
            catch (Exception ex)
            {
                logger.Error("[SERVERS] " + ex.Message);
                logger.Error("SERVERS - OFF");
            }

            logger.Debug(string.Format("{0}ms", Environment.TickCount - time));

            OnProgramLoaded(null);
        }
 public static void InitLogger(ContainerLogger logger)
 {
     Logger = logger;
 }
 static ConsoleManager()
 {
     Logger = null;
 }