/// <summary> /// Находит главный forge.jar и его версию /// </summary> private void FindForgeVersion() { var forges = Directory.GetFiles(_minecraftPath, "*forge*.jar", SearchOption.AllDirectories) // исключаем папку mods .Where(x => !PathsHelper.PlacedInFolder(x, "mods")) .ToList(); _forgeJarPath = PathsHelper.GetTopPath(forges); CheckPathsAndThrow(_forgeJarPath); _minecraftVersion = ParseJarVersion(_forgeJarPath); }
public void TestContainsIgnoreCaseInDir() { var paths = new List <string> { @"H:\Users\Tom\AppData\Roaming\.minecraft\MODS\bdlib-1.12.4.25-mc1.10.2.jar", @"H:\Users\Tom\AppData\Roaming\.minecraft\MODS\bdlib-1.12.4.25-mc1.10.2.jar", @"H:\Users\Tom\AppData\Roaming\.minecraft\mOdS\fghfgh\bdlib-1.12.4.25-mc1.10.2.jar", @"H:\Users\Tom\AppData\Roaming\.minecraft\modS\fghfgh\\fghfghfg\hfghfg\hfghbdlib-1.12.4.25-mc1.10.2.jar", @"H:\Users\Tom\AppData\Roaming\.minecraft\MoDS\bdlib-1.12.fghfgh4.25-mc1.10.2.jar", @"H:\.minecraft\mods\bdlib-1.12.fgh4.25-mc1.10.2.jar", }; foreach (var path in paths) { Assert.IsTrue(PathsHelper.PlacedInFolder(path, "mods", StringComparison.OrdinalIgnoreCase)); } }
public void TestContainsInDir() { var paths = new List <string> { @"H:\Users\Tom\AppData\Roaming\.minecraft\mods\bdlib-1.12.4.25-mc1.10.2.jar", @"H:\Users\Tom\AppData\Roaming\.minecraft\mods\bdlib-1.12.4.25-mc1.10.2.jar", @"H:\Users\Tom\AppData\Roaming\.minecraft\mods\fghfgh\bdlib-1.12.4.25-mc1.10.2.jar", @"H:\Users\Tom\AppData\Roaming\.minecraft\mods\fghfgh\\fghfghfg\hfghfg\hfghbdlib-1.12.4.25-mc1.10.2.jar", @"H:\Users\Tom\AppData\Roaming\.minecraft\mods\bdlib-1.12.fghfgh4.25-mc1.10.2.jar", @"H:\.minecraft\mods\bdlib-1.12.fgh4.25-mc1.10.2.jar", }; foreach (var path in paths) { Assert.IsTrue(PathsHelper.PlacedInFolder(path, "mods")); } }