private void LoadPersistentData() { scenes = CsvData.Get <SceneDto>(FileName.SceneData); restrictedScenes = CsvData.Get <RestrictedSceneDto>(FileName.SceneRestrictions); try { allViewers.Load(); } catch (Exception ex) { Console.WriteLine("Exception loading allViewers data: " + ex.Message); Debugger.Break(); } }
static void AddLevelDocs(StringBuilder finalReadme) { var levels = CsvData.Get <LevelDto>(FileName.SceneLevels); var levelTemplate = File.ReadAllText(FileName.LevelTemplate).Split("\r\n"); bool needToAddScenes = false; //var scenes = CsvData.Get<SceneDto>(FileName.SceneData); var scenes = GoogleSheets.Get <SceneDto>(); foreach (var level in levels) { List <SceneDto> filteredScenes = scenes.Where(x => x.LevelStr == level.Level && x.LimitToUser == "") .OrderBy(x => x.ChatShortcut) .ToList(); if (filteredScenes.Count == 0) { continue; } foreach (string line in levelTemplate) { string replacedLine = line.Replace("$LevelNumber$", level.Level) .Replace("$LevelDoc$", level.Doc) .Replace("$LevelPic$", GetPicMarkDown(level.Pic)); if (needToAddScenes) { foreach (SceneDto scene in filteredScenes) { string sceneLine = replacedLine.Replace("$Shortcut$", scene.ChatShortcut) .Replace("$Scene$", GetSceneName(scene.SceneName)) .Replace("$Category$", scene.Category); finalReadme.AppendLine(sceneLine); } needToAddScenes = false; } else { finalReadme.AppendLine(replacedLine); } if (line.StartsWith("|") && line.IndexOf("-") > 0) { needToAddScenes = true; } } } }