Example #1
0
 public static Shader Check(ParsingResult result, string sourceFileName)
 {
     // Throws an exception if there are any errors.
     // Todo provide better handling
     if (result.HasErrors)
     {
         var errorText = new StringBuilder();
         errorText.AppendFormat("Unable to parse file [{0}]", sourceFileName).AppendLine();
         foreach (var reportMessage in result.Messages)
         {
             errorText.AppendLine(reportMessage.ToString());
         }
         throw new InvalidOperationException(errorText.ToString());
     }
     return(result.Shader);
 }