예제 #1
0
        public override string CodeOutput(int level)
        {
            string levelString = new string('\t', level);
            string Code        = "";

            if (comboBox1.SelectedIndex != -1)
            {
                if (string.IsNullOrEmpty(textBox1.Text) == false)
                {
                    CheckLetters.CheckName(textBox1.Text, true);
                    List <String> vList = Util.GetVariableList(this, 0);
                    if (vList.Contains(textBox1.Text) == true)
                    {
                        Form1.MessageBoxValue("同じ名前が存在します", false);
                    }
                    else
                    {
                        Code = levelString + "List<" + itemType + ">" + textBox1.Text + " = new List<" + itemType + ">();";
                    }
                }
                else
                {
                    Form1.MessageBoxValue("リストの名前が設定されていません", true);
                }
            }
            else
            {
                Form1.MessageBoxValue("リストの型が設定されていません", true);
            }
            return(Code);
        }
예제 #2
0
        private void TextBox1_TextChanged(object sender, EventArgs e)
        {
            CheckLetters.CheckName(textBox1.Text, false);
            List <String> vList = Util.GetVariableList(this, 0);

            if (vList.Contains(textBox1.Text) == true)
            {
                Form1.MessageBoxValue("同じ名前が存在します", false);
            }
        }
예제 #3
0
        public override string CodeOutput(int level)
        {
            string levelString = new string('\t', level);
            string CodeOutput  = "";

            if (VariableDefine.NameList.Contains(textBox1.Text))
            {
                Form1.MessageBoxValue("同じ名前の変数が既にあります", true);
            }
            else
            {
                VariableDefine.NameList.Add(textBox1.Text);
            }
            if (itemType == "")
            {
                Form1.MessageBoxValue("配列の型が選択されていません", true);
            }
            else
            {
                if (string.IsNullOrWhiteSpace(textBox1.Text))
                {
                    Form1.MessageBoxValue("配列の宣言で配列の名前が入力されていません", true);
                }
                else
                {
                    CheckLetters.CheckName(textBox1.Text, true);


                    if (string.IsNullOrWhiteSpace(textBox2.Text))
                    {
                        Form1.MessageBoxValue("配列の宣言で配列の数の値が入力されていません", true);
                    }
                    else
                    {
                        int OkNumber;
                        if (int.TryParse(textBox2.Text, out OkNumber))
                        {
                            if (OkNumber < 0)
                            {
                                Form1.MessageBoxValue("配列の宣言の配列の数で不正な数値が入力されています", true);
                            }
                            else
                            {
                                CodeOutput = levelString + itemType + "[] " + textBox1.Text + " = new " + itemType + "[" + OkNumber + "];\r\n";
                            }
                        }
                        else
                        {
                            Form1.MessageBoxValue("配列の宣言の配列の数で数値以外が入力されています", true);
                        }
                    }
                }
            }
            return(CodeOutput);
        }
예제 #4
0
        private void TextBox1_TextChanged(object sender, EventArgs e)
        {
            CheckLetters.CheckName(textBox1.Text, false);
            List <String> vList = Util.GetVariableList(this, 0);

            if (vList.Contains(textBox1.Text) == true)
            {
                Form1.MessageBoxValue("同じ名前が存在します", false);
            }
            else
            {
                if (string.IsNullOrEmpty(textBox1.Text) == false)
                {
                    ((StatementBlock)this.Parent).CheckName(textBox1.Text, Name, true);
                }
                else
                {
                    ((StatementBlock)this.Parent).CheckName(textBox1.Text, Name, false);
                }
                Name = textBox1.Text;
            }
        }
        public override string CodeOutput(int level)
        {
            string Quotation = "";


            String levelString = new string('\t', level);

            CheckLetters.CheckName(textBox1.Text, true);
            if (NameList.Contains(textBox1.Text))
            {
                Form1.MessageBoxValue("同じ名前の変数が既にあります", true);
            }
            else
            {
                NameList.Add(textBox1.Text);
                if (string.IsNullOrWhiteSpace(textBox1.Text))
                {
                    Form1.MessageBoxValue("変数の名前が入力されていません", true);
                }
            }
            switch (comboBox1.SelectedIndex)
            {
            case -1:
                Form1.MessageBoxValue("変数の型が選択されていません", true);
                break;

            case 0:
                itemType = "int";
                break;

            case 1:
                itemType = "string";
                break;

            case 2:
                itemType = "char";
                break;

            case 3:
                itemType = "double";
                break;

            case 4:
                itemType = "byte";
                break;

            case 5:
                itemType = "bool";
                break;
            }
            if (checkBox1.Checked == true)
            {
                if (String.IsNullOrWhiteSpace(textBox2.Text) == false)
                {
                    if (itemType == "char")
                    {
                        char a;
                        if (char.TryParse(textBox2.Text, out a))
                        {
                            Quotation = "\'";
                        }
                        else
                        {
                            Form1.MessageBoxValue("型にあっていません", true);
                        }
                        if (string.IsNullOrWhiteSpace(textBox1.Text))
                        {
                            Form1.MessageBoxValue("入力されていないところがあります", true);
                        }
                    }
                    else if (itemType == "string")
                    {
                        Quotation = "\"";
                    }
                    CheckLetters.CheckValue(itemType, textBox2.Text, true);
                    return(levelString + itemType + " " + this.textBox1.Text + " = " + Quotation + textBox2.Text + Quotation + ";\r\n");
                }
                else
                {
                    if (itemType != "string")
                    {
                        Form1.MessageBoxValue("変数に代入する値が入力されていません", true);
                    }
                    else
                    {
                        return(levelString + itemType + " " + this.textBox1.Text + " = " + "\"\"" + ";\r\n");
                    }
                }
            }


            return(levelString + itemType + " " + this.textBox1.Text + ";\r\n");
        }