/// <summary> /// Reads the markdown file and stores it in lists of lines /// </summary> /// <param name="name">File to load</param> protected override void ReadText(string name) { Data = new Parser.BBSCodeResult(); string txt; if (TextHelper.IsUrl(name)) { WebClient webClient = new WebClient(); txt = webClient.DownloadString(name); Uri dir = new Uri(new Uri(name), "."); basePath = dir.OriginalString; } else { txt = File.ReadAllText(GetFile(name)); basePath = Path.GetDirectoryName(name); } MarkdownDocument md = new MarkdownDocument(); md.Parse(txt); mdStyles = (NameValueCollection)ConfigurationManager.GetSection("Markdown"); foreach (var b in md.Blocks) { Text.AddRange(BlockProcessing(b, 0)); } Footer.Add(string.Empty); }
/// <summary> /// Reads the text and stores it in lists of lines /// </summary> /// <param name="name">File to load</param> protected override void ReadText(string name) { Data = new Parser.BBSCodeResult(); List <string> txt; if (TextHelper.IsUrl(name)) { WebClient webClient = new WebClient(); txt = TextHelper.SplitString(webClient.DownloadString(name)); } else { txt = File.ReadAllLines(GetFile(name)).ToList(); } foreach (string s in txt) { if (s.Length <= client.screenWidth) { Text.Add(s); } else { Text.AddRange(TextHelper.WordWrap(s, client.screenWidth)); } } Footer.Add(string.Empty); }