public bool CheckForShaderChange()
 {
     //test if we even have file -> no files nothing to be done
     if (null == shaderWatcherVertex || null == shaderWatcherFragment) return false;
     //test if any file is dirty
     if (!shaderWatcherVertex.Dirty && !shaderWatcherFragment.Dirty) return false;
     try
     {
         shader = ShaderLoader.FromFiles(shaderWatcherVertex.FullPath, shaderWatcherFragment.FullPath);
         shaderWatcherVertex.Dirty = false;
         shaderWatcherFragment.Dirty = false;
         form.Clear();
         return true;
     }
     catch (IOException e)
     {
         LastException = new ShaderException("ERROR", e.Message, string.Empty, string.Empty);
         form.Show(LastException);
     }
     catch (ShaderException e)
     {
         LastException = e;
         form.Show(e);
     }
     return false;
 }
 public static void ShowModal(ShaderException e)
 {
     var facade = new FormShaderExceptionFacade();
     //facade.OnSave += (s, a) => facade.
     facade.Clear();
     facade.FillData(e);
     facade.form.ShowDialog();
 }
 public void Show(ShaderException e)
 {
     if (null == lastException || e.Log != lastException.Log)
     {
         Clear(); //clears last log too -> need to store lastLog afterwards
         lastException = e;
         FillData(e);
     }
     form.Show();
     //todo: bring to front
     form.TopMost = true;
     form.TopMost = false;
 }
        private void FillData(ShaderException e)
        {
            var rtf = form.richTextBox;
            var font = rtf.Font;
            var errorFont = new Font(font, FontStyle.Strikeout);
            char[] newline = new char[] { '\n' };
            var sourceLines = e.ShaderCode.Split(newline);
            foreach (var sourceLine in sourceLines)
            {
                rtf.AppendText(sourceLine);
            }

            var log = new ShaderLog(e.Log);
            foreach (var logLine in log.Lines)
            {
                form.Errors.Add(logLine);
            }
        }
 public void Clear()
 {
     lastException = null;
     form.richTextBox.Clear();
     form.Errors.Clear();
 }