using CefSharp;
using CefSharp.WinForms;
using Markdig;
using System.Linq.Expressions;
namespace MintHTML
{
public partial class Form1 : Form
{
string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string markfile;
string htmlfile = "
Welcome to MintHTML
Open a markdown file and press \"Render preview\" to see the output here.
";
string csssuffix = @"
";
string logo = @"
";
string css;
// Custom functions
private void convert()
{
htmlfile = Markdown.ToHtml(markfile);
}
// Custom functions end
public Form1()
{
if (File.Exists(appdata + "/SweeZero/MintHTML/RootCache/lockfile"))
{
if (MessageBox.Show("There is another instance of MintHTML running. If there isn't, press Yes to try opening anyways.", "Cef Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
try
{
File.Delete(appdata + "/SweeZero/MintHTML/RootCache/lockfile");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Cef Error (fatal)", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
var settings = new CefSettings()
{
RootCachePath = appdata + "/SweeZero/MintHTML/RootCache",
};
InitializeComponent();
Cef.Initialize(settings);
css = @"