Пример #1
0
        private bool InternalParseScript()
        {
            bool ret = false;

            listViewErrors.Items.Clear();
            ScriptContainer newContainer = new ScriptContainer(_document.Container, _currText);

            ScriptError[] errs = ScriptUtils.Parse(newContainer);

            if (errs.Length == 0)
            {
                ret = true;
            }
            else
            {
                foreach (var err in errs)
                {
                    ListViewItem item = listViewErrors.Items.Add(err.Severity);
                    item.SubItems.Add(err.Description);
                    item.SubItems.Add(err.Line.ToString());
                    item.SubItems.Add(err.Column.ToString());
                    item.Tag = err;
                }
            }

            return(ret);
        }
Пример #2
0
        private void validateParserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ScriptError[] errors = ScriptUtils.Parse(_document.Container);

            if (errors.Length == 0)
            {
                MessageBox.Show(this, CANAPE.Properties.Resources.ParserDocumentControl_Validation,
                                CANAPE.Properties.Resources.ParserDocumentControl_ValidationCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                StringBuilder builder = new StringBuilder();

                foreach (ScriptError error in errors)
                {
                    builder.AppendLine(error.Description);
                }

                MessageBox.Show(this, builder.ToString(), CANAPE.Properties.Resources.ParserDocumentControl_ValidationError,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }