public IEnumerable <Level> GetLevels(Level.Sources src) { foreach (string file in GetLevelsFiles(src)) { yield return(GetLevel(src, file)); } }
private string LevelsDirectory(Level.Sources src) { if (src == Level.Sources.Game) { return("game levels"); } return(Path.Combine(path1, src == Level.Sources.Custom ? "custom" : "workshop")); }
private string[] GetLevelsFiles(Level.Sources src) { string path = LevelsDirectory(src); if (Directory.Exists(path)) { return(Directory.GetFiles(path)); } return(new string[0]); }
public Level GetLevel(Level.Sources src, string path) { if (loadedLevels.ContainsKey(path)) { return(loadedLevels[path]); } Level lvl = new Level(src, path, (src == Level.Sources.Workshop ? solvedW : solvedG).Contains(Path.GetFileName(path)), steamUser); loadedLevels.Add(path, lvl); return(lvl); }
public int CountLevels(Level.Sources src) { return(GetLevelsFiles(src).Length); }