public Bot(IReadOnlyList <Command> genome, EmulationConfig config, int generationNumber = 1) { this.config = config; Genome = genome; GenerationNumber = generationNumber; Health = config.BotInitialHealth; }
private void Emulate() { _cts = new CancellationTokenSource(); if (string.IsNullOrEmpty(_fileName) && _file.Length == 0) { MessageBox.Show("Le chemin vers le fichier log est vide", "Attention", MessageBoxButton.OK, MessageBoxImage.Warning); return; } Logs.Clear(); // ReSharper disable once ComplexConditionExpression var t = new Task(() => { var config = new EmulationConfig { BoxNumber = _boxNumber, IpAddress = _ipAddress, Port = _port, SleepPeriod = _sleepPeriod * 1000, SourceOfImeIs = _sourceOfImeIs }; if (_sourceOfImeIs == SourceOfIMEIs.OneIMEI) { if (string.IsNullOrEmpty(_imei)) { MessageBox.Show("Le champs IMEI est requis", "Attention", MessageBoxButton.OK, MessageBoxImage.Warning); return; } config.IMEIs = new[] { _imei }; } TeltonikaPacketEncoder.UpdateLogDataGird += log => { Application.Current.Dispatcher.Invoke(() => { if (!Logs.Any(x => x.Equals(log))) { Logs.Add(log); } }); }; // extracting and parsing and encoding avl data. var encodedData = (!string.IsNullOrEmpty(_fileName))? TeltonikaPacketEncoder.Encoding(AvlDataParser.ParseAvlData(_fileName)): TeltonikaPacketEncoder.Encoding(AvlDataParser.ParseAvlData(_file)); // launch the emulation var emulator = new Emulator(); emulator.UpdateLogDataGird += log => { Application.Current.Dispatcher.Invoke(() => { if (!Logs.Any(x => x.Equals(log))) { Logs.Add(log); } }); }; emulator.Emulate(config, encodedData, _cts.Token); }); t.Start(); }
[DllImport(DllPath)] public static extern void SetEmulationConfig(EmulationConfig config);
public DefaultMapFiller(EmulationConfig config, Random random) { this.config = config; this.random = random; }
public DefaultMapProvider(EmulationConfig config) { this.config = config; }
public DefaultGenerationBuilder(EmulationConfig config, IGenomeBuilder genomeBuilder) { this.config = config; this.genomeBuilder = genomeBuilder; }
public UnconditionalJumpCommandFactory(EmulationConfig config) => SubtypesCount = config.GenomeSize / 2;
public DefaultGenomeBuilder(ICommandsCollection availableCommands, EmulationConfig config, Random random) { this.availableCommands = availableCommands; this.config = config; this.random = random; }