public static IEnumerable <LoadedContentItem <T> > LoadAllForMod(ModContentPack mod) { string contentDirPath = Path.Combine(mod.RootDir, GenFilePaths.ContentPath <T>()); DirectoryInfo contentDir = new DirectoryInfo(contentDirPath); if (contentDir.Exists) { DeepProfiler.Start("Loading assets of type " + typeof(T) + " for mod " + mod); FileInfo[] files = contentDir.GetFiles("*.*", SearchOption.AllDirectories); foreach (FileInfo file in files) { if (ModContentLoader <T> .IsAcceptableExtension(file.Extension)) { LoadedContentItem <T> loadedItem = ModContentLoader <T> .LoadItem(file.FullName, contentDirPath); if (loadedItem != null) { yield return(loadedItem); /*Error: Unable to find new state assignment for yield return*/; } } } DeepProfiler.End(); } }
public static IEnumerable <LoadedContentItem <T> > LoadAllForMod(ModContentPack mod) { string contentDirPath = Path.Combine(mod.RootDir, GenFilePaths.ContentPath <T>()); DirectoryInfo contentDir = new DirectoryInfo(contentDirPath); if (contentDir.Exists) { DeepProfiler.Start(string.Concat(new object[] { "Loading assets of type ", typeof(T), " for mod ", mod })); FileInfo[] files = contentDir.GetFiles("*.*", SearchOption.AllDirectories); for (int i = 0; i < files.Length; i++) { FileInfo file = files[i]; if (ModContentLoader <T> .IsAcceptableExtension(file.Extension)) { LoadedContentItem <T> loadedItem = ModContentLoader <T> .LoadItem(file.FullName, contentDirPath); if (loadedItem != null) { yield return(loadedItem); } } } DeepProfiler.End(); } }