public HtmlEditControl()
        {
            InitializeComponent();

            AllowWebBrowserDrop = false;

            Navigate(@"about:blank");

            _htmlConversionHelper = new HtmlConversionHelper();

            //tmp dir
            _tmpFolderPath = Path.Combine(Path.GetTempPath(),
                Guid.NewGuid().ToString());

            if (!Directory.Exists(_tmpFolderPath))
            {
                Directory.CreateDirectory(_tmpFolderPath);
            }

            //timer:
            _timerTextChange.Tick += timerTextChange_Tick;

            _timerTextChange.Interval = 200;
            _timerTextChange.Start();

            // --

            setMenuShortcutKeys();

            Configure(Configuration);
        }
 public static string[] GetContainedImageFileNames(
     string html)
 {
     if (string.IsNullOrEmpty(html) || !html.Contains(ImagesFolderPathPlaceHolder))
     {
         return new string[] { };
     }
     else
     {
         using (var ch = new HtmlConversionHelper())
         {
             return ch.GetContainedImageFileNames(html, ImagesFolderPathPlaceHolder);
         }
     }
 }
        private void endClean()
        {
            if (_timerTextChange != null)
            {
                _timerTextChange.Stop();
                _timerTextChange.Dispose();
                _timerTextChange = null;
            }

            if (!string.IsNullOrEmpty(_tmpFolderPath))
            {
                if (Directory.Exists(_tmpFolderPath))
                {
                    Directory.Delete(_tmpFolderPath, true);
                }
                _tmpFolderPath = null;
            }

            if (_htmlConversionHelper != null)
            {
                ((IDisposable)_htmlConversionHelper).Dispose();
                _htmlConversionHelper = null;
            }
        }
 /// <summary>
 /// Stand-alone function to expand any placeholders inside
 /// a given HTML fragment.
 /// </summary>
 public static string ExpandImageFolderPathPlaceHolder(
     string html,
     string externalImagesFolderPath)
 {
     if (string.IsNullOrEmpty(html) || !html.Contains(ImagesFolderPathPlaceHolder))
     {
         return html;
     }
     else
     {
         using (var ch = new HtmlConversionHelper())
         {
             return ch.ConvertSetHtml(
                 html,
                 externalImagesFolderPath,
                 ImagesFolderPathPlaceHolder);
         }
     }
 }