/// <summary> Creates a new manager and loads settings stored in the settings file. </summary> /// <param name="generateDatabase"> Whether to read data from JSON instead of the database. </param> /// <param name="readOnlyJson"> Whether to generate the database. </param> public Manager ( IWarThunderFileManager fileManager, IWarThunderFileReader fileReader, IWarThunderSettingsManager settingsManager, IParser parser, IUnpacker unpacker, IConverter converter, IWarThunderJsonHelper jsonHelper, ICsvDeserializer csvDeserializer, IDataRepositoryFactory dataRepositoryFactory, IRandomiser randomizer, IVehicleSelector vehicleSelector, IPresetGenerator presetGenerator, IThunderSkillParser thunderSkillParser, bool generateDatabase, bool readOnlyJson, bool readPreviouslyUnpackedJson, params IConfiguredLogger[] loggers ) : base(EOrganizationLogCategory.Manager, loggers) { _generateDatabase = generateDatabase; _readOnlyJson = readOnlyJson; _readPreviouslyUnpackedJson = readPreviouslyUnpackedJson; _startupConfiguration = GetStartupConfiguration(_generateDatabase, _readOnlyJson, _readPreviouslyUnpackedJson); _excludedGaijinIdParts = new List <string>() { "_football", "germ_panzerkampflaufer_565_r", "germ_panzerkampflaufer_565_r_2", "po-2_nw", "_race", "sdi_", "_space_suit", "toon_", "_tutorial", "ucav_assault", "ucav_scout", "uk_centaur_aa_mk_", "us_m35", "us_m35_2", "ussr_sht_1", "ussr_sht_1_2", }; _fileManager = fileManager; _fileReader = fileReader; _parser = parser; _unpacker = unpacker; _converter = converter; _jsonHelper = jsonHelper; _csvDeserializer = csvDeserializer; _dataRepositoryFactory = dataRepositoryFactory; _randomizer = randomizer; _vehicleSelector = vehicleSelector; _presetGenerator = presetGenerator; _thunderSkillParser = thunderSkillParser; _cache = new List <IPersistentObject>(); PlayableVehicles = new Dictionary <string, IVehicle>();
/// <summary> Creates a new manager and loads settings stored in the <see cref="EWpfClientFile.Settings"/> file. </summary> /// <param name="generateDatabase"> Whether to read data from JSON instead of the database. </param> /// <param name="readOnlyJson"> Whether to generate the database. </param> /// <param name="readPreviouslyUnpackedJson"> Whether to extract game files. </param> public WpfClientManager ( IWarThunderFileManager fileManager, IWarThunderFileReader fileReader, IWarThunderSettingsManager settingsManager, IParser parser, IUnpacker unpacker, IConverter converter, IWarThunderJsonHelper jsonHelper, ICsvDeserializer csvDeserializer, IDataRepositoryFactory dataRepositoryFactory, IRandomiser randomizer, IVehicleSelector vehicleSelector, IPresetGenerator presetGenerator, bool generateDatabase, bool readOnlyJson, bool readPreviouslyUnpackedJson, params IConfiguredLogger[] loggers ) : base(fileManager, fileReader, settingsManager, parser, unpacker, converter, jsonHelper, csvDeserializer, dataRepositoryFactory, randomizer, vehicleSelector, presetGenerator, generateDatabase, readOnlyJson, readPreviouslyUnpackedJson, loggers) { _flagImageSources = new Dictionary <ECountry, ImageSource>(); _vehicleIconBitmapSources = new ConcurrentDictionary <string, BitmapSource>(); _vehiclePortraitBitmapSources = new ConcurrentDictionary <string, BitmapSource>(); ProcessVehicleImages = (vehicle) => { GetIconBitmapSource(vehicle); GetPortraitBitmapSource(vehicle); }; }
/// <summary> Initialises helpers. </summary> /// <param name="generateDatabase"> Whether to read data from JSON instead of the database. </param> /// <param name="readOnlyJson"> Whether to generate the database. </param> /// <param name="readPreviouslyUnpackedJson"> Whether to extract game files. </param> private static void InitialiseHelpers(bool generateDatabase, bool readOnlyJson, bool readPreviouslyUnpackedJson) { var settingsTypes = new List <Type> { typeof(Settings), typeof(WpfSettings), }; var requiredSettingNames = settingsTypes .SelectMany(settingsType => settingsType.GetProperties(BindingFlags.Public | BindingFlags.Static)) .Where(settingProperty => settingProperty.GetCustomAttribute <RequiredSettingAttribute>() is RequiredSettingAttribute) .Select(settingProperty => settingProperty.Name); WindowFactory = new WindowFactory(Loggers); FileManager = new WarThunderFileManager(Loggers); FileReader = new WarThunderFileReader(Loggers); SettingsManager = new WpfClientSettingsManager(FileManager, EWpfClientFile.Settings, requiredSettingNames, Loggers); _parser = new Parser(Loggers); _unpacker = new Unpacker(FileManager, Loggers); _dataRepositoryFactory = new DataRepositoryFactoryWarThunder(Loggers); _converter = new Converter(Loggers); _jsonHelper = new WarThunderJsonHelper(Loggers); _csvDeserializer = new CsvDeserializer(Loggers); _randomizer = new CustomRandomiserWithNormalisation(Loggers); _vehicleSelector = new VehicleSelector(_randomizer, Loggers); _presetGenerator = new PresetGenerator(_randomizer, _vehicleSelector, Loggers); _thunderSkillParser = new ThunderSkillParser(Loggers); Manager = new WpfClientManager ( FileManager, FileReader, SettingsManager, _parser, _unpacker, _converter, _jsonHelper, _csvDeserializer, _dataRepositoryFactory, _randomizer, _vehicleSelector, _presetGenerator, _thunderSkillParser, generateDatabase, readOnlyJson, readPreviouslyUnpackedJson, Loggers ); InitialiseLocalisationManager(); }
/// <summary> Creates a new manager and loads settings stored in the settings file. </summary> /// <param name="generateDatabase"> Whether to read data from JSON instead of the database. </param> /// <param name="readOnlyJson"> Whether to generate the database. </param> public Manager ( IWarThunderFileManager fileManager, IWarThunderFileReader fileReader, IWarThunderSettingsManager settingsManager, IParser parser, IUnpacker unpacker, IConverter converter, IWarThunderJsonHelper jsonHelper, ICsvDeserializer csvDeserializer, IDataRepositoryFactory dataRepositoryFactory, IRandomiser randomizer, IVehicleSelector vehicleSelector, IPresetGenerator presetGenerator, bool generateDatabase, bool readOnlyJson, bool readPreviouslyUnpackedJson, params IConfiguredLogger[] loggers ) : base(EOrganizationLogCategory.Manager, loggers) { _generateDatabase = generateDatabase; _readOnlyJson = readOnlyJson; _readPreviouslyUnpackedJson = readPreviouslyUnpackedJson; _startupConfiguration = GetStartupConfiguration(_generateDatabase, _readOnlyJson, _readPreviouslyUnpackedJson); _excludedGaijinIdParts = new List <string>() { "_football", "germ_panzerkampflaufer_565_r", "germ_panzerkampflaufer_565_r_2", "po-2_nw", "_race", "_space_suit", "_tutorial", "uk_centaur_aa_mk_", "us_m35", "us_m35_2", "ussr_sht_1", "ussr_sht_1_2", }; _fileManager = fileManager; _fileReader = fileReader; _parser = parser; _unpacker = unpacker; _converter = converter; _jsonHelper = jsonHelper; _csvDeserializer = csvDeserializer; _dataRepositoryFactory = dataRepositoryFactory; _randomizer = randomizer; _vehicleSelector = vehicleSelector; _presetGenerator = presetGenerator; _cache = new List <IPersistentObject>(); PlayableVehicles = new Dictionary <string, IVehicle>(); _settingsManager = settingsManager; _settingsManager.Initialise(_startupConfiguration.IsIn(new List <EStartup> { EStartup.ReadDatabase, EStartup.ReadUnpackedJson })); LoadSettings(); ResearchTrees = new Dictionary <ENation, ResearchTree>(); LogDebug(ECoreLogMessage.Created.FormatFluently(EOrganizationLogCategory.Manager)); }