private void LoadLevelDetails() { log.Info("Loading level types"); LevelTypes = mpqProvider .GetTextFile(ResourcePaths.LevelType) .Skip(1) .Where(x => !String.IsNullOrWhiteSpace(x)) .Select(x => x.Split('\t')) .Where(x => x.Count() == 36 && x[0] != "Expansion") .Select(x => x.ToLevelType()) .ToImmutableList(); log.Info("Loading level presets"); LevelPresets = mpqProvider .GetTextFile(ResourcePaths.LevelPreset) .Skip(1) .Where(x => !String.IsNullOrWhiteSpace(x)) .Select(x => x.Split('\t')) .Where(x => x.Count() == 24 && x[0] != "Expansion") .Select(x => x.ToLevelPreset()) .ToImmutableList(); log.Info("Loading level details"); Levels = mpqProvider .GetTextFile(ResourcePaths.LevelDetails) .Skip(1) .Where(x => !String.IsNullOrWhiteSpace(x)) .Select(x => x.Split('\t')) .Where(x => x.Count() > 80 && x[0] != "Expansion") .Select(x => x.ToLevelDetail(LevelPresets, LevelTypes)) .ToImmutableList(); }
private void LoadLevelTypes() { var data = mpqProvider .GetTextFile(ResourcePaths.LevelType) .Skip(1) .Where(x => !String.IsNullOrWhiteSpace(x)) .Select(x => x.Split('\t')) .Where(x => x.Count() == 36 && x[0] != "Expansion") .ToArray() .Select(x => x.ToLevelType()); LevelTypes = new List <LevelType>(data); }
public Credits( IRenderWindow renderWindow, ISceneManager sceneManager, IMPQProvider mpqProvider, Func <eButtonType, IButton> createButton ) { this.renderWindow = renderWindow; this.sceneManager = sceneManager; this.mpqProvider = mpqProvider; backgroundSprite = renderWindow.LoadSprite(ResourcePaths.CreditsBackground, Palettes.Sky); btnExit = createButton(eButtonType.Medium); btnExit.Text = "Exit".ToUpper(); btnExit.Location = new Point(20, 550); btnExit.OnActivate = OnActivateClicked; textFont = renderWindow.LoadFont(ResourcePaths.FontFormal10, Palettes.Static); creditsText = new Stack <string>(( File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Environment.GetCommandLineArgs().First()), "credits.txt")) .Concat(mpqProvider.GetTextFile(ResourcePaths.CreditsText)) ).Reverse()); }
private void LoadSoundData() { log.Info("Loading sound configuration data"); var soundDescFile = mpqProvider.GetTextFile("data\\global\\excel\\Sounds.txt"); foreach (var row in soundDescFile.Skip(1).Where(x => !String.IsNullOrWhiteSpace(x))) { var soundEntry = row.ToSoundEntry(); soundTable[soundEntry.Handle] = soundEntry; } }
private void LoadDictionary() { var text = mpqProvider.GetTextFile(ResourcePaths.EnglishTable); var rowsToLoad = text.Where( x => x.Length > 0 && !x.StartsWith("//") && !x.StartsWith("#") && x.Split(',').Length >= 3 ).Select(x => x.Split(new[] { ',' }, 3).Select(z => z.Trim()).ToArray()); foreach (var row in rowsToLoad) { lookupTable[row[1]] = !(row[2].StartsWith("\"") && row[2].EndsWith("\"")) ? row[2] : row[2].Substring(1, row[2].Length - 2); } }