private void InitializeOverrideData() { Stopwatch time = new Stopwatch(); Console.WriteLine($"Loading data overriders..."); time.Start(); if (OverrideBuild.HasValue) { XmlDataOverriders = XmlDataOverriders.Load(GameData, OverrideBuild.Value); } else if (HotsBuild.HasValue) { XmlDataOverriders = XmlDataOverriders.Load(GameData, HotsBuild.Value); } else { XmlDataOverriders = XmlDataOverriders.Load(GameData); } foreach (string overrideFileName in XmlDataOverriders.LoadedFileNames) { ReadOnlySpan <char> fileNameNoExtension = Path.GetFileNameWithoutExtension(overrideFileName).AsSpan(); if (int.TryParse(fileNameNoExtension.Slice(fileNameNoExtension.IndexOf('_') + 1), out int loadedOverrideBuild)) { if ((StorageMode == StorageMode.Mods && HotsBuild.HasValue && HotsBuild.Value != loadedOverrideBuild) || (StorageMode == StorageMode.CASC && HotsBuild.HasValue && HotsBuild.Value != loadedOverrideBuild)) { Console.ForegroundColor = ConsoleColor.Yellow; } else { Console.ForegroundColor = ConsoleColor.Cyan; } } else // default override { Console.ForegroundColor = ConsoleColor.Cyan; } Console.WriteLine($"Loaded {Path.GetFileName(overrideFileName)}"); Console.ResetColor(); } time.Stop(); Console.WriteLine($"Finished in {time.Elapsed.TotalSeconds} seconds"); Console.WriteLine(); }
public void LoadedDataOverridersGetOverriderIsNull() { XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(App.AssemblyPath, _gameData, _overrideFileNameSuffix); IOverrideLoader overrideLoader = xmlDataOverriders.GetOverrider(typeof(XmlDataOverridersTests)); Assert.IsNull(overrideLoader); }
public void LoadedDataOverridersGetOverrider(Type type) { XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(GameData, OverrideFileNameSuffix); IOverrideLoader overrideLoader = xmlDataOverriders.GetOverrider(type); Assert.IsNotNull(overrideLoader); }
public void LoadedDataOverridersHasBuildTest() { XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(App.AssemblyPath, _gameData, 12000, _overrideFileNameSuffix); List <string> loadedOverrideFileNames = xmlDataOverriders.LoadedFileNames.ToList(); Assert.AreEqual(3, xmlDataOverriders.Count); Assert.AreEqual("hero-overrides-test_12000.xml", Path.GetFileName(loadedOverrideFileNames[0])); }
public void LoadedDataOverridersNoBuildTest() { XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(GameData, OverrideFileNameSuffix); List <string> loadedOverrideFileNames = xmlDataOverriders.LoadedFileNames.ToList(); Assert.AreEqual(3, xmlDataOverriders.Count); Assert.AreEqual("hero-overrides-test.xml", Path.GetFileName(loadedOverrideFileNames[0])); }
public OverrideBaseTests() { GameData gameData = new FileGameData(ModsTestFolder); XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(gameData, OverrideFileNameSuffix); HeroOverrideLoader = (HeroOverrideLoader)xmlDataOverriders.GetOverrider(typeof(HeroDataParser)); HeroDataOverride = HeroOverrideLoader.GetOverride(CHeroId); LoadInitialValues(); }
private void LoadTestData() { _gameData = new FileGameData(_modsTestFolder); _gameData.LoadAllData(); _configuration = new Configuration(); _configuration.Load(); _gameStringParser = new GameStringParser(_configuration, _gameData); ParseGameStrings(); _defaultData = new DefaultData(_gameData); _defaultData.Load(); XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(App.AssemblyPath, _gameData, _overrideFileNameSuffix); _heroOverrideLoader = (HeroOverrideLoader)xmlDataOverriders.GetOverrider(typeof(HeroDataParser)); _xmlDataService = new XmlDataService(_configuration, _gameData, _defaultData); }
private void LoadTestData() { GameData = new FileGameData(ModsTestFolder); GameData.LoadAllData(); Configuration = new Configuration(); Configuration.Load(); GameStringParser = new GameStringParser(Configuration, GameData); ParseGameStrings(); DefaultData = new DefaultData(GameData); DefaultData.Load(); XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(GameData, OverrideFileNameSuffix); HeroOverrideLoader = (HeroOverrideLoader)xmlDataOverriders.GetOverrider(typeof(HeroDataParser)); XmlDataService = new XmlDataService(Configuration, GameData, DefaultData); }
private void LoadTestData() { XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(App.AssemblyPath, GameData, _overrideFileNameSuffix); _matchAwardOverrideLoader = (MatchAwardOverrideLoader)xmlDataOverriders.GetOverrider(typeof(MatchAwardParser)); }
private void LoadTestData() { XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(GameData, OverrideFileNameSuffix); UnitOverrideLoader = (UnitOverrideLoader)xmlDataOverriders.GetOverrider(typeof(UnitParser)); }
private void LoadTestData() { XmlDataOverriders xmlDataOverriders = XmlDataOverriders.Load(GameData, OverrideFileNameSuffix); MatchAwardOverrideLoader = (MatchAwardOverrideLoader)xmlDataOverriders.GetOverrider(typeof(MatchAwardParser)); }