Example #1
0
        public List <EditorMessage> Filter(string filePath, ITextSnapshot snapshot)
        {
            if (snapshot == null)
            {
                return(new List <EditorMessage>());
            }
            List <MessageText> errors;

            if (m_errorsByFile == null)
            {
                return(new List <EditorMessage>());
            }
            if (!m_errorsByFile.TryGetValue(filePath, out errors))
            {
                return(new List <EditorMessage>());
            }
            List <EditorMessage> failureList = new List <EditorMessage>();

            foreach (var e in errors)
            {
                if (e.m_errorLine == null)
                {
                    continue;
                }

                var errorLine = snapshot.GetLineFromLineNumber(e.m_line - 1);
                if (errorLine == null)
                {
                    continue;
                }
                var text = errorLine.GetText();
                if (text == null)
                {
                    continue;
                }
                text = text.Trim();

                if (text.Contains(e.m_errorLine.Trim()))
                {
                    EditorMessage f = new EditorMessage(errorLine.Extent, e);
                    failureList.Add(f);
                }
            }
            return(failureList);
        }
Example #2
0
        public MessageFieldEditDialog(EditorMessage message, string modify_name)
        {
            InitializeComponent();
            checkBox1.Checked = false;

            _base_types = EditorMessageManager.singleton.GetBaseTypes();
            _my_types   = EditorMessageManager.singleton.GetDefineTypes();

            UpdateComboxTypeList();

            _message     = message;
            _modify_mode = modify_name != null;

            if (_modify_mode)
            {
                m_FieldInfo              = _message.m_message.m_fields[modify_name];
                _modify_name             = modify_name;
                _modify_index            = m_FieldInfo.m_index;
                textBoxName.Text         = modify_name;
                textBoxIndex.Text        = _modify_index.ToString();
                comboxTypeName.Text      = m_FieldInfo.m_type_name;
                checkBoxRepeated.Checked = m_FieldInfo.m_is_array;
            }
            else
            {
                m_FieldInfo = new FieldInfo();
                if (_message.m_message.m_fields.Count == 0)
                {
                    textBoxIndex.Text = "1";
                }
                else
                {
                    var index = 0;
                    foreach (var f in _message.m_message.m_fields.Values)
                    {
                        index = Math.Max(index, f.m_index);
                    }
                    textBoxIndex.Text = (index + 1).ToString();
                }
            }
            this.DialogResult = DialogResult.Cancel;
        }
 public EnumEditDialog(EditorMessage message)
 {
     InitializeComponent();
     m_IsAddNew = message == null;
     if (m_IsAddNew)
     {
         m_Message = EditorMessage.NewEnum();
     }
     else
     {
         txtBoxEnumName.Text    = message.Name;
         txtBoxEnumName.Enabled = false;
         foreach (var f in message.m_enum.m_items.OrderBy(t_ => t_.Value))
         {
             ListViewItem item = new ListViewItem(f.Key);
             item.SubItems.Add(f.Value.ToString());
             listViewEnum.Items.Add(item);
         }
         m_Message = message;
     }
     this.DialogResult = DialogResult.Cancel;
 }
Example #4
0
        public MessageEditDialog(EditorMessage message)
        {
            InitializeComponent();

            if (message == null)
            {
                m_Message = EditorMessage.NewMessage();
                IsAddNew  = true;
            }
            else
            {
                IsAddNew            = false;
                m_Message           = message;
                txtDataName.Text    = m_Message.Name;
                txtDataName.Enabled = false;

                foreach (var field in m_Message.m_message.m_fields.Values.OrderBy(t_ => t_.m_index))
                {
                    listDataField.Items.Add(CreateListViewItemByField(field));
                }
            }

            this.DialogResult = DialogResult.Cancel;
        }