Ejemplo n.º 1
0
 // TextBox
 private void textBox_TextChanged(object sender, EventArgs e)
 {
     if (this.Updating)
     {
         return;
     }
     //
     char[] text = textBox.Text.ToCharArray();
     char[] swap;
     for (int i = 0; i < text.Length; i++)
     {
         if (text[i] == '\n')
         {
             int tempSel = textBox.SelectionStart;
             swap = new char[text.Length + 2];
             for (int x = 0; x < i; x++)
             {
                 swap[x] = text[x];
             }
             swap[i]     = '[';
             swap[i + 1] = '1';
             swap[i + 2] = ']';
             for (int x = i + 3; x < swap.Length; x++)
             {
                 swap[x] = text[x - 2];
             }
             textBox.Text           = new string(swap);
             text                   = textBox.Text.ToCharArray();
             i                     += 2;
             textBox.SelectionStart = tempSel + 2;
         }
     }
     if (parserReduced.VerifySymbols(this.textBox.Text.ToCharArray(), !textView.Checked))
     {
         this.menuText.SetText(textBox.Text, textView.Checked);
         this.menuText.Error = parserReduced.Error;
         this.Updating       = true;
         int index = this.Index;
         name.Items.RemoveAt(index);
         name.Items.Insert(index, textBox.Text);
         name.Text = textBox.Text;
         name.Invalidate();
         this.Index    = index;
         this.Updating = false;
     }
     SetFreeBytesLabel();
     ownerForm.Picture.Invalidate();
 }
Ejemplo n.º 2
0
        private void description_TextChanged(object sender, EventArgs e)
        {
            char[] text = description.Text.ToCharArray();
            char[] swap;
            for (int i = 0; i < text.Length; i++)
            {
                if (text[i] == '\n')
                {
                    int tempSel = description.SelectionStart;
                    swap = new char[text.Length + 2];
                    for (int x = 0; x < i; x++)
                    {
                        swap[x] = text[x];
                    }
                    swap[i]     = '[';
                    swap[i + 1] = '1';
                    swap[i + 2] = ']';
                    for (int x = i + 3; x < swap.Length; x++)
                    {
                        swap[x] = text[x - 2];
                    }
                    description.Text = new string(swap);
                    text             = description.Text.ToCharArray();
                    i += 2;
                    description.SelectionStart = tempSel + 2;
                }
            }
            bool flag = parser.VerifySymbols(this.description.Text.ToCharArray(), byteView);

            if (flag)
            {
                this.description.BackColor = Color.FromArgb(255, 255, 255, 255);
                spell.SetDescription(this.description.Text, byteView);
            }
            if (!flag || spell.DescriptionError)
            {
                this.description.BackColor = Color.Red;
            }
            descriptionTextImage = null;
            pictureBoxSpellDesc.Invalidate();
        }