diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 41755c6..8bbe74a 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -75,15 +75,16 @@ // openDevToolsToolStripMenuItem.Enabled = false; openDevToolsToolStripMenuItem.Name = "openDevToolsToolStripMenuItem"; - openDevToolsToolStripMenuItem.Size = new Size(154, 22); + openDevToolsToolStripMenuItem.Size = new Size(180, 22); openDevToolsToolStripMenuItem.Text = "Open DevTools"; openDevToolsToolStripMenuItem.Click += openDevToolsToolStripMenuItem_Click_1; // // exitToolStripMenuItem // exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - exitToolStripMenuItem.Size = new Size(154, 22); + exitToolStripMenuItem.Size = new Size(180, 22); exitToolStripMenuItem.Text = "Exit"; + exitToolStripMenuItem.Click += exitToolStripMenuItem_Click; // // helpToolStripMenuItem // diff --git a/Form1.cs b/Form1.cs index 2cc85e2..cb3a4ac 100644 --- a/Form1.cs +++ b/Form1.cs @@ -1,5 +1,6 @@ using CefSharp; using CefSharp.WinForms; +using System.Linq.Expressions; namespace MintHTML { @@ -27,53 +28,55 @@ border-width: 1px string line; while ((line = reader.ReadLine()) != null) { + try + { // Header 1 - if (line[0..1] == "# ") + if (line[1..2] == "# ") { line = "

" + line[1..] + "

"; } // Header 2 - else if (line[0..2] == "## ") + else if (line[1..3] == "## ") { line = "

" + line[1..] + "

"; } // Header 3 - else if (line[0..3] == "### ") + else if (line[1..4] == "### ") { line = "

" + line[1..] + "

"; } // Header 4 - else if (line[0..4] == "#### ") + else if (line[1..5] == "#### ") { line = "

" + line[1..] + "

"; } // Header 5 - else if (line[0..5] == "##### ") + else if (line[1..6] == "##### ") { line = "
" + line[1..] + "
"; } // Header 6 - else if (line[0..6] == "###### ") + else if (line[1..7] == "###### ") { line = "
" + line[1..] + "
"; } // Bullet point - else if (line[0..1] == "* ") + else if (line[1..2] == "* ") { line = "
  • " + line[1..] + "
  • "; } - else if (line[0..1] == "- ") + else if (line[1..2] == "- ") { line = "
  • " + line[1..] + "
  • "; - } + } } catch{} // Code block - else if (line.Contains("`")) + if (line.Contains("`")) { line = "
    " + line[1..^1] + "
    "; } @@ -119,7 +122,7 @@ font-family: sans-serif private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { - MessageBox.Show("MintHTML is a simple Markdown converter and renderer made by SweeZero.", "About", MessageBoxButtons.OK); + MessageBox.Show("MintHTML is a simple Markdown converter and renderer made by SweeZero's founder \"Swee.\"", "About", MessageBoxButtons.OK); } private void button2_Click(object sender, EventArgs e) @@ -235,5 +238,10 @@ font-family: monospace serifToolStripMenuItem.Checked = false; chromiumWebBrowser1.LoadHtml(css + htmlfile); } + + private void exitToolStripMenuItem_Click(object sender, EventArgs e) + { + Application.Exit(); + } } }