public Readme GetReadme() { if (String.IsNullOrEmpty(m_strReadmePath) || !Readme.IsValidReadme(m_strReadmePath)) { return(null); } return(new Readme(m_strReadmePath, TextUtil.ByteToString(GetFileContents(m_strReadmePath)))); }
/// <summary> /// The default constructor. /// </summary> /// <param name="p_rmeReadme">The <see cref="Readme" /> to be viewed.</param> public ViewReadmeForm(Readme p_rmeReadme) { InitializeComponent(); Icon = Resources.fomm02; Settings.Default.windowPositions.GetWindowPosition("ReadmeViewer", this); switch (p_rmeReadme.Format) { case ReadmeFormat.PlainText: case ReadmeFormat.RichText: var rtbReadme = new RichTextBox(); rtbReadme.Multiline = true; rtbReadme.ScrollBars = RichTextBoxScrollBars.Vertical; rtbReadme.BorderStyle = BorderStyle.None; rtbReadme.BackColor = SystemColors.Control; rtbReadme.ReadOnly = true; rtbReadme.TabStop = false; rtbReadme.LinkClicked += rtbReadme_LinkClicked; if (p_rmeReadme.Format == ReadmeFormat.PlainText) { rtbReadme.Font = new Font(FontFamily.GenericMonospace, rtbReadme.Font.Size, rtbReadme.Font.Style); rtbReadme.Text = p_rmeReadme.Text; } else { rtbReadme.Rtf = p_rmeReadme.Text; } rtbReadme.Dock = DockStyle.Fill; Controls.Add(rtbReadme); break; case ReadmeFormat.HTML: var wbrBrowser = new WebBrowser(); Controls.Add(wbrBrowser); wbrBrowser.Dock = DockStyle.Fill; wbrBrowser.DocumentCompleted += delegate { Text = String.IsNullOrEmpty(wbrBrowser.DocumentTitle) ? "Readme" : wbrBrowser.DocumentTitle; }; wbrBrowser.WebBrowserShortcutsEnabled = false; wbrBrowser.AllowWebBrowserDrop = false; wbrBrowser.AllowNavigation = false; wbrBrowser.DocumentText = p_rmeReadme.Text; break; } }
internal void SetReadme(Readme p_rmeReadme) { if (HasReadme) { DeleteFile(m_strReadmePath); } if (p_rmeReadme == null) { m_strReadmePath = null; } else { if (m_strReadmePath == null) { m_strReadmePath = (Settings.Default.UseDocsFolder ? "docs/" : "") + "Readme - " + Path.GetFileNameWithoutExtension(filepath) + ".rtf"; } m_strReadmePath = Path.ChangeExtension(m_strReadmePath, p_rmeReadme.Extension); ReplaceFile(m_strReadmePath, p_rmeReadme.Text); } }
internal void SetReadme(Readme p_rmeReadme) { if (HasReadme) DeleteFile(m_strReadmePath); if (p_rmeReadme == null) m_strReadmePath = null; else { if (m_strReadmePath == null) m_strReadmePath = (Properties.Settings.Default.UseDocsFolder ? "docs/" : "") + "Readme - " + Path.GetFileNameWithoutExtension(filepath) + ".rtf"; m_strReadmePath = Path.ChangeExtension(m_strReadmePath, p_rmeReadme.Extension); ReplaceFile(m_strReadmePath, p_rmeReadme.Text); } }