private void LoadItems() { try { _game.ItemManager.AddItems(ItemContentCollection.LoadItemsFrom($"{PackagePath}/Items")); } catch (DirectoryNotFoundException) { _logger.Debug($"Package: {PackageName} does not contain any items, skipping..."); } }
public static ItemContentCollection LoadItemsFrom(string directoryPath) { var result = new ItemContentCollection(); var itemDirectoryPaths = Directory.GetDirectories(directoryPath); foreach (var location in itemDirectoryPaths) { var path = location.Replace('\\', '/'); var itemName = path.Split('/').Last(); var itemDataPath = $"{path}/{itemName}.json"; result.AddFromPath(itemDataPath); } return(result); }