Advertisement
8877omega_java

スパゲッティだべたい^p^

Oct 16th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 33.81 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Text.RegularExpressions;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. using TestWindow1;
  14.  
  15. namespace TestWindow1
  16. {
  17.     public partial class CommandPrompt : Form
  18.     {
  19.         private TextBox textBox1;
  20.         private TextBox textBox2;
  21.         private Button button1;
  22.         private Label label1;
  23.         private TextBox textBox3;
  24.         private Label label2;
  25.         private readonly object hScrollBar1;
  26.         private TextBox textBox4;
  27.         private Label label3;
  28.         public int num = default(int);
  29.         public double num1 = default(double);
  30.         public float num2 = default(float);
  31.         public decimal num3 = default(decimal);
  32.         public byte num4 = default(byte);
  33.         public long num5 = default(long);
  34.         public short num6 = default(short);
  35.         public string[] Command = { "^p^", "cls", "Hello, World!", "speak ^p^", "view ", "looprun"};
  36.         public string[] Type = { "int", "double" };
  37.         public string[] CpCommand = { "mode default", "1"};
  38.         private object d = null;
  39.         private float s = 0;
  40.         private Label label4;
  41.         private ComboBox comboBox1;
  42.         enum Logtype {NOAMAL_LOG_TYPE,
  43.                       EDIT_LOG_TYPE   };
  44.         public bool editmodec = false;
  45.  
  46.         public CommandPrompt()
  47.         {
  48.             InitializeComponent();
  49.         }
  50.         private void InitializeComponent()
  51.         {
  52.             this.textBox1 = new System.Windows.Forms.TextBox();
  53.             this.textBox2 = new System.Windows.Forms.TextBox();
  54.             this.button1 = new System.Windows.Forms.Button();
  55.             this.label1 = new System.Windows.Forms.Label();
  56.             this.textBox3 = new System.Windows.Forms.TextBox();
  57.             this.label2 = new System.Windows.Forms.Label();
  58.             this.textBox4 = new System.Windows.Forms.TextBox();
  59.             this.label3 = new System.Windows.Forms.Label();
  60.             this.label4 = new System.Windows.Forms.Label();
  61.             this.comboBox1 = new System.Windows.Forms.ComboBox();
  62.             this.SuspendLayout();
  63.             //
  64.             // textBox1
  65.             //
  66.             this.textBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
  67.             this.textBox1.ForeColor = System.Drawing.Color.AliceBlue;
  68.             this.textBox1.Location = new System.Drawing.Point(7, 49);
  69.             this.textBox1.Multiline = true;
  70.             this.textBox1.Name = "textBox1";
  71.             this.textBox1.ReadOnly = true;
  72.             this.textBox1.Size = new System.Drawing.Size(1251, 763);
  73.             this.textBox1.TabIndex = 0;
  74.             this.textBox1.Text = ">";
  75.             this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
  76.             //
  77.             // textBox2
  78.             //
  79.             this.textBox2.BackColor = System.Drawing.SystemColors.WindowFrame;
  80.             this.textBox2.ForeColor = System.Drawing.Color.AliceBlue;
  81.             this.textBox2.Location = new System.Drawing.Point(7, 12);
  82.             this.textBox2.Name = "textBox2";
  83.             this.textBox2.Size = new System.Drawing.Size(542, 19);
  84.             this.textBox2.TabIndex = 1;
  85.             this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
  86.             //
  87.             // button1
  88.             //
  89.             this.button1.BackColor = System.Drawing.SystemColors.ControlLight;
  90.             this.button1.Location = new System.Drawing.Point(555, 12);
  91.             this.button1.Name = "button1";
  92.             this.button1.Size = new System.Drawing.Size(71, 19);
  93.             this.button1.TabIndex = 2;
  94.             this.button1.Text = "Run";
  95.             this.button1.UseVisualStyleBackColor = false;
  96.             this.button1.Click += new System.EventHandler(this.button1_Click);
  97.             //
  98.             // label1
  99.             //
  100.             this.label1.AutoSize = true;
  101.             this.label1.BackColor = System.Drawing.SystemColors.Control;
  102.             this.label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  103.             this.label1.Location = new System.Drawing.Point(12, 34);
  104.             this.label1.Name = "label1";
  105.             this.label1.Size = new System.Drawing.Size(23, 12);
  106.             this.label1.TabIndex = 4;
  107.             this.label1.Text = "Log";
  108.             //
  109.             // textBox3
  110.             //
  111.             this.textBox3.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
  112.             this.textBox3.ForeColor = System.Drawing.Color.AliceBlue;
  113.             this.textBox3.Location = new System.Drawing.Point(1264, 577);
  114.             this.textBox3.Multiline = true;
  115.             this.textBox3.Name = "textBox3";
  116.             this.textBox3.ReadOnly = true;
  117.             this.textBox3.Size = new System.Drawing.Size(539, 383);
  118.             this.textBox3.TabIndex = 5;
  119.             this.textBox3.Text = ">";
  120.             //
  121.             // label2
  122.             //
  123.             this.label2.AutoSize = true;
  124.             this.label2.Location = new System.Drawing.Point(1262, 562);
  125.             this.label2.Name = "label2";
  126.             this.label2.Size = new System.Drawing.Size(69, 12);
  127.             this.label2.TabIndex = 6;
  128.             this.label2.Text = "宣言された型";
  129.             //
  130.             // textBox4
  131.             //
  132.             this.textBox4.BackColor = System.Drawing.SystemColors.InactiveCaption;
  133.             this.textBox4.Location = new System.Drawing.Point(1264, 24);
  134.             this.textBox4.Multiline = true;
  135.             this.textBox4.Name = "textBox4";
  136.             this.textBox4.ReadOnly = true;
  137.             this.textBox4.Size = new System.Drawing.Size(539, 535);
  138.             this.textBox4.TabIndex = 7;
  139.             this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged);
  140.             //
  141.             // label3
  142.             //
  143.             this.label3.AutoSize = true;
  144.             this.label3.Location = new System.Drawing.Point(1262, 9);
  145.             this.label3.Name = "label3";
  146.             this.label3.Size = new System.Drawing.Size(26, 12);
  147.             this.label3.TabIndex = 8;
  148.             this.label3.Text = "help";
  149.             //
  150.             // label4
  151.             //
  152.             this.label4.AutoSize = true;
  153.             this.label4.Location = new System.Drawing.Point(13, 839);
  154.             this.label4.Name = "label4";
  155.             this.label4.Size = new System.Drawing.Size(112, 12);
  156.             this.label4.TabIndex = 12;
  157.             this.label4.Text = "LogBackGroundColor";
  158.             //
  159.             // comboBox1
  160.             //
  161.             this.comboBox1.FormattingEnabled = true;
  162.             this.comboBox1.Items.AddRange(new object[] {
  163.             "Black",
  164.             "White"});
  165.             this.comboBox1.Location = new System.Drawing.Point(15, 854);
  166.             this.comboBox1.Name = "comboBox1";
  167.             this.comboBox1.Size = new System.Drawing.Size(111, 20);
  168.             this.comboBox1.TabIndex = 13;
  169.             this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  170.             //
  171.             // CommandPrompt
  172.             //
  173.             this.AutoSize = true;
  174.             this.ClientSize = new System.Drawing.Size(1806, 960);
  175.             this.Controls.Add(this.comboBox1);
  176.             this.Controls.Add(this.label4);
  177.             this.Controls.Add(this.label3);
  178.             this.Controls.Add(this.textBox4);
  179.             this.Controls.Add(this.label2);
  180.             this.Controls.Add(this.textBox3);
  181.             this.Controls.Add(this.label1);
  182.             this.Controls.Add(this.button1);
  183.             this.Controls.Add(this.textBox2);
  184.             this.Controls.Add(this.textBox1);
  185.             this.Name = "CommandPrompt";
  186.             this.Text = "CommandPrompt++";
  187.             this.Load += new System.EventHandler(this.Form1_Load);
  188.             this.ResumeLayout(false);
  189.             this.PerformLayout();
  190.  
  191.         }
  192.         System.IO.StreamReader file =
  193.         new System.IO.StreamReader("CommandDescription(ReadOnly).txt", System.Text.Encoding.GetEncoding("shift_jis"));
  194.         public void nn()
  195.         {
  196.             string line1;
  197.             while ((line1 = file.ReadLine()) != null)
  198.             {
  199.                 textBox4.AppendText(line1 + "\n");
  200.             }
  201.             file.Close();
  202.         }
  203.  
  204.         private void textBox1_TextChanged(object sender, EventArgs e)
  205.         {
  206.  
  207.         }
  208.  
  209.         private void textBox2_TextChanged(object sender, EventArgs e)
  210.         {
  211.  
  212.         }
  213.  
  214.         private void button1_Click(object sender, EventArgs e)
  215.         {
  216.  
  217.             string s;
  218.             s = ">";
  219.             commandline();
  220.             textBox1.AppendText(s);            
  221.         }
  222.         public new string Text
  223.         {
  224.             get
  225.             {
  226.                 return textBox2.Text;
  227.             }
  228.  
  229.             set
  230.             {
  231.                 value = textBox2.Text;
  232.             }
  233.         }
  234.         public void put(String str)
  235.         {
  236.             textBox1.AppendText(str);
  237.         }
  238.         public void put4(String str1)
  239.         {
  240.             textBox3.AppendText(str1);
  241.         }
  242.         public void commandline()
  243.         {
  244.             Regex rs = new Regex("^(<#=/)");
  245.             Regex rf = new Regex("(/=#>)$");
  246.             Regex rsf1 = new Regex("^(#)");
  247.             Regex rsf2 = new Regex("(#)$");
  248.             Regex rsf1l = new Regex("^(l#)");
  249.             Regex rsf2l = new Regex("(#l)$");
  250.             Regex rsf1b = new Regex("^(b#)");
  251.             Regex rsf2b = new Regex("(#b)$");
  252.             Regex rsf1s = new Regex("^(s#)");
  253.             Regex rsf2s = new Regex("(#s)$");
  254.             Regex rsf3 = new Regex("^(~)");
  255.             Regex rsf4 = new Regex("(~)$");
  256.             Regex rsf1f = new Regex("^(f~)");
  257.             Regex rsf2f = new Regex("(~f)$");
  258.             Regex rsf1m = new Regex("^(m~)");
  259.             Regex rsf2m = new Regex("(~m)$");
  260.             Regex llp = new Regex("(:)$");
  261.             if (!editmodec)
  262.             {
  263.                 if (Text == cm(0))
  264.                 {
  265.                     put("^p^<コポォ\n");
  266.                 }
  267.                 else if (Text == cm(1))
  268.                 {
  269.                     textBox1.Clear();
  270.                     put("[Console]クリアしました。\n");
  271.                     textBox3.Clear();
  272.                     put4("[Console]クリアしました。\n");
  273.                 }
  274.                 else if (Text == cm(2))
  275.                 {
  276.                     put("Hello, World!\n");
  277.                 }
  278.                 else if (Text == "Textedi")
  279.                 {
  280.  
  281.                 }
  282.                 else
  283.                 {
  284.  
  285.                     if (Text == "")
  286.                     {
  287.                         put(
  288.                         "error : コマンドが入力されていません。\n");
  289.                     }
  290.                     else
  291.                     {
  292.                         put("\n");
  293.                         string[] pause = Text.Split('>');
  294.                         var r = new Regex(">");
  295.                         if (r.Match(Text).Success && pause[0] == "int")
  296.                         {
  297.                             put4("if (r.Match(Text).Success && pause[0] == 'int')=true\n");
  298.                             Regex re = new Regex(@"[^0-9]");
  299.                             put4(">文字の除外と代入 > 処理中 ");
  300.                             try
  301.                             {
  302.                                 num = int.Parse(re.Replace(pause[1], ""));
  303.                                 put4("> 完了\n");
  304.                                 put4(">intに" + num + "が代入されました\n");
  305.                                 put("宣言された型>" + num + "\n");
  306.                                 put4(">pause(String[])の初期化 > 処理中 ");
  307.                                 pause = Enumerable.Repeat<string>("", pause.Length).ToArray();
  308.                                 put4("> 完了\n");
  309.                             }
  310.                             catch (System.OverflowException e)
  311.                             {
  312.                                 string err;
  313.                                 err = e.ToString();
  314.                                 put4("\n" + err + "\n");
  315.                             }
  316.                         }
  317.                         else if (r.Match(Text).Success && pause[0] == "double")
  318.                         {
  319.                             put4("if (r.Match(Text).Success && pause[0] == 'int')=true\n");
  320.                             Regex re = new Regex(@"[^0-9,.,E]");
  321.                             put4(">文字の除外と代入 > 処理中 ");
  322.                             try
  323.                             {
  324.                                 num1 = double.Parse(re.Replace(pause[1], ""));
  325.                                 put4("> 完了\n");
  326.                                 put4(">doubleに" + num1 + "が代入されました\n");
  327.                                 put("宣言された型>" + num1 + "\n");
  328.                                 put4(">pause(String[])の初期化 > 処理中 ");
  329.                                 pause = Enumerable.Repeat<string>("", pause.Length).ToArray();
  330.                                 put4("> 完了\n");
  331.                             }
  332.                             catch (System.OverflowException e)
  333.                             {
  334.                                 string err;
  335.                                 err = e.ToString();
  336.                                 put4("\n" + err + "\n");
  337.                             }
  338.                         }
  339.                         else if (rs.IsMatch(Text) && rf.IsMatch(Text))
  340.                         {
  341.                             String[] pause1 = Text.Split('/');
  342.                             put("comment>>" + pause1[1] + "\n");
  343.                             pause1 = Enumerable.Repeat<string>("", pause1.Length).ToArray();
  344.                         }
  345.                         else if (rsf3.IsMatch(Text) && rsf4.IsMatch(Text))
  346.                         {
  347.                             String[] pause2 = Text.Split('~');
  348.                             Regex de = new Regex(@"[^0-9,.,e,E,-]");
  349.                             try
  350.                             {
  351.  
  352.                                 double i = double.Parse(de.Replace(pause2[1], ""));
  353.                                 double j = double.Parse(de.Replace(pause2[3], ""));
  354.                                 if (pause2[2] == "+")
  355.                                 {
  356.                                     put("Resalt : " + (i + j) + "\n");
  357.                                 }
  358.                                 else if (pause2[2] == "-")
  359.                                 {
  360.                                     put("Resalt : " + (i - j) + "\n");
  361.                                 }
  362.                                 else if (pause2[2] == "*")
  363.                                 {
  364.                                     put("Resalt : " + (i * j) + "\n");
  365.                                 }
  366.                                 else if (pause2[2] == "/")
  367.                                 {
  368.                                     put("Resalt : " + (i / j) + "\n");
  369.                                 }
  370.                                 else if (pause2[2] == "%")
  371.                                 {
  372.                                     put("Resalt : " + (i % j) + "\n");
  373.                                 }
  374.                                 else
  375.                                 {
  376.                                     put("演算記号が間違っています。");
  377.                                 }
  378.                             }
  379.                             catch (System.FormatException e)
  380.                             {
  381.                                 string err;
  382.                                 err = e.ToString();
  383.                                 put(err + "\n");
  384.                             }
  385.                             catch (System.OverflowException e)
  386.                             {
  387.                                 string err;
  388.                                 err = e.ToString();
  389.                                 put(err + "\n");
  390.                             }
  391.                             pause2 = Enumerable.Repeat<string>("", pause2.Length).ToArray();
  392.                         }
  393.                         else if (rsf1f.IsMatch(Text) && rsf1f.IsMatch(Text))
  394.                         {
  395.                             String[] pause3 = Text.Split('f','~');
  396.                             Regex de = new Regex(@"[^0-9,-,.,e,E,f]");
  397.                             try
  398.                             {
  399.                                 float i = float.Parse(de.Replace(pause3[1], ""));
  400.                                 float j = float.Parse(de.Replace(pause3[4], ""));
  401.                                 if (pause3[4] == "+")
  402.                                 {
  403.                                     put("Resalt : " + (i + j) + "\n");
  404.                                 }
  405.                                 else if (pause3[4] == "-")
  406.                                 {
  407.                                     put("Resalt : " + (i - j) + "\n");
  408.                                 }
  409.                                 else if (pause3[4] == "*")
  410.                                 {
  411.                                     put("Resalt : " + (i * j) + "\n");
  412.                                 }
  413.                                 else if (pause3[4] == "/")
  414.                                 {
  415.                                     put("Resalt : " + (i / j) + "\n");
  416.                                 }
  417.                                 else if (pause3[4] == "%")
  418.                                 {
  419.                                     put("Resalt : " + (i % j) + "\n");
  420.                                 }
  421.                                 else
  422.                                 {
  423.                                     put("演算記号が間違っています。");
  424.                                 }
  425.                             }
  426.                             catch (System.FormatException e)
  427.                             {
  428.                                 string err;
  429.                                 err = e.ToString();
  430.                                 put(err + "\n");
  431.                             }
  432.                             catch (System.OverflowException e)
  433.                             {
  434.                                 string err;
  435.                                 err = e.ToString();
  436.                                 put(err + "\n");
  437.                             }
  438.                             pause3 = Enumerable.Repeat<string>("", pause3.Length).ToArray();
  439.                         }
  440.                         else if (rsf1f.IsMatch(Text) && rsf1f.IsMatch(Text))
  441.                         {
  442.                             String[] pause3 = Text.Split('m', '~');
  443.                             Regex de = new Regex(@"[^0-9,-,.,e,E,m]");
  444.                             try
  445.                             {
  446.                                 decimal i = decimal.Parse(de.Replace(pause3[1], ""));
  447.                                 decimal j = decimal.Parse(de.Replace(pause3[4], ""));
  448.                                 if (pause3[4] == "+")
  449.                                 {
  450.                                     put("Resalt : " + (i + j) + "\n");
  451.                                 }
  452.                                 else if (pause3[4] == "-")
  453.                                 {
  454.                                     put("Resalt : " + (i - j) + "\n");
  455.                                 }
  456.                                 else if (pause3[4] == "*")
  457.                                 {
  458.                                     put("Resalt : " + (i * j) + "\n");
  459.                                 }
  460.                                 else if (pause3[4] == "/")
  461.                                 {
  462.                                     put("Resalt : " + (i / j) + "\n");
  463.                                 }
  464.                                 else if (pause3[4] == "%")
  465.                                 {
  466.                                     put("Resalt : " + (i % j) + "\n");
  467.                                 }
  468.                                 else
  469.                                 {
  470.                                     put("演算記号が間違っています。");
  471.                                 }
  472.                             }
  473.                             catch (System.FormatException e)
  474.                             {
  475.                                 string err;
  476.                                 err = e.ToString();
  477.                                 put(err + "\n");
  478.                             }
  479.                             catch (System.OverflowException e)
  480.                             {
  481.                                 string err;
  482.                                 err = e.ToString();
  483.                                 put(err + "\n");
  484.                             }
  485.                             pause3 = Enumerable.Repeat<string>("", pause3.Length).ToArray();
  486.                         }
  487.                         else if (rsf1.IsMatch(Text) && rsf2.IsMatch(Text))
  488.                         {
  489.                             String[] pause3 = Text.Split('#');
  490.                             Regex de = new Regex(@"[^0-9,-,.,]");
  491.                             try
  492.                             {
  493.                                 int i = int.Parse(de.Replace(pause3[1], ""));
  494.                                 int j = int.Parse(de.Replace(pause3[3], ""));
  495.                                 if (pause3[2] == "+")
  496.                                 {
  497.                                     put("Resalt : " + (i + j) + "\n");
  498.                                 }
  499.                                 else if (pause3[2] == "-")
  500.                                 {
  501.                                     put("Resalt : " + (i - j) + "\n");
  502.                                 }
  503.                                 else if (pause3[2] == "*")
  504.                                 {
  505.                                     put("Resalt : " + (i * j) + "\n");
  506.                                 }
  507.                                 else if (pause3[2] == "/")
  508.                                 {
  509.                                     put("Resalt : " + (i / j) + "\n");
  510.                                 }
  511.                                 else if (pause3[2] == "%")
  512.                                 {
  513.                                     put("Resalt : " + (i % j) + "\n");
  514.                                 }
  515.                                 else
  516.                                 {
  517.                                     put("演算記号が間違っています。");
  518.                                 }
  519.                             }
  520.                             catch (System.FormatException e)
  521.                             {
  522.                                 string err;
  523.                                 err = e.ToString();
  524.                                 put(err + "\n");
  525.                             }
  526.                             catch (System.OverflowException e)
  527.                             {
  528.                                 string err;
  529.                                 err = e.ToString();
  530.                                 put(err + "\n");
  531.                             }
  532.                             pause3 = Enumerable.Repeat<string>("", pause3.Length).ToArray();
  533.                         }
  534.                         else if (rsf1l.IsMatch(Text) && rsf2l.IsMatch(Text))
  535.                         {
  536.                             String[] pause4 = Text.Split('l', '#');
  537.                             Regex de = new Regex(@"[^0-9,-,.,l]");
  538.                             try
  539.                             {
  540.                                 long i = long.Parse(de.Replace(pause4[2], ""));
  541.                                 long j = long.Parse(de.Replace(pause4[4], ""));
  542.                                 if (pause4[3] == "+")
  543.                                 {
  544.                                     put("Resalt : " + (i + j) + "\n");
  545.                                 }
  546.                                 else if (pause4[3] == "-")
  547.                                 {
  548.                                     put("Resalt : " + (i - j) + "\n");
  549.                                 }
  550.                                 else if (pause4[3] == "*")
  551.                                 {
  552.                                     put("Resalt : " + (i * j) + "\n");
  553.                                 }
  554.                                 else if (pause4[3] == "/")
  555.                                 {
  556.                                     put("Resalt : " + (i / j) + "\n");
  557.                                 }
  558.                                 else if (pause4[3] == "%")
  559.                                 {
  560.                                     put("Resalt : " + (i % j) + "\n");
  561.                                 }
  562.                                 else
  563.                                 {
  564.                                     put("演算記号が間違っています。");
  565.                                 }
  566.                             }
  567.                             catch (System.FormatException e)
  568.                             {
  569.                                 string err;
  570.                                 err = e.ToString();
  571.                                 put(err + "\n");
  572.                             }
  573.                             catch (System.OverflowException e)
  574.                             {
  575.                                 string err;
  576.                                 err = e.ToString();
  577.                                 put(err + "\n");
  578.                             }
  579.                             pause4 = Enumerable.Repeat<string>("", pause4.Length).ToArray();
  580.                         }
  581.                         else if (rsf1b.IsMatch(Text) && rsf2b.IsMatch(Text))
  582.                         {
  583.                             String[] pause4 = Text.Split('b', '#');
  584.                             Regex de = new Regex(@"[^0-9,-,.]");
  585.                             try
  586.                             {
  587.                                 byte i = byte.Parse(de.Replace(pause4[2], ""));
  588.                                 byte j = byte.Parse(de.Replace(pause4[4], ""));
  589.                                 if (pause4[3] == "+")
  590.                                 {
  591.                                     put("Resalt : " + (i + j) + "\n");
  592.                                 }
  593.                                 else if (pause4[3] == "-")
  594.                                 {
  595.                                     put("Resalt : " + (i - j) + "\n");
  596.                                 }
  597.                                 else if (pause4[3] == "*")
  598.                                 {
  599.                                     put("Resalt : " + (i * j) + "\n");
  600.                                 }
  601.                                 else if (pause4[3] == "/")
  602.                                 {
  603.                                     put("Resalt : " + (i / j) + "\n");
  604.                                 }
  605.                                 else if (pause4[3] == "%")
  606.                                 {
  607.                                     put("Resalt : " + (i % j) + "\n");
  608.                                 }
  609.                                 else
  610.                                 {
  611.                                     put("演算記号が間違っています。");
  612.                                 }
  613.                             }
  614.                             catch (System.FormatException e)
  615.                             {
  616.                                 string err;
  617.                                 err = e.ToString();
  618.                                 put(err + "\n");
  619.                             }
  620.                             catch (System.OverflowException e)
  621.                             {
  622.                                 string err;
  623.                                 err = e.ToString();
  624.                                 put(err + "\n");
  625.                             }
  626.                             pause4 = Enumerable.Repeat<string>("", pause4.Length).ToArray();
  627.                         }
  628.                         else if (rsf1s.IsMatch(Text) && rsf2s.IsMatch(Text))
  629.                         {
  630.                             String[] pause4 = Text.Split('s', '#');
  631.                             Regex de = new Regex(@"[^0-9,-,.]");
  632.                             try
  633.                             {
  634.                                 short i = short.Parse(de.Replace(pause4[2], ""));
  635.                                 short j = short.Parse(de.Replace(pause4[4], ""));
  636.                                 if (pause4[3] == "+")
  637.                                 {
  638.                                     put("Resalt : " + (i + j) + "\n");
  639.                                 }
  640.                                 else if (pause4[3] == "-")
  641.                                 {
  642.                                     put("Resalt : " + (i - j) + "\n");
  643.                                 }
  644.                                 else if (pause4[3] == "*")
  645.                                 {
  646.                                     put("Resalt : " + (i * j) + "\n");
  647.                                 }
  648.                                 else if (pause4[3] == "/")
  649.                                 {
  650.                                     put("Resalt : " + (i / j) + "\n");
  651.                                 }
  652.                                 else if (pause4[3] == "%")
  653.                                 {
  654.                                     put("Resalt : " + (i % j) + "\n");
  655.                                 }
  656.                                 else
  657.                                 {
  658.                                     put("演算記号が間違っています。");
  659.                                 }
  660.                             }
  661.                             catch (System.FormatException e)
  662.                             {
  663.                                 string err;
  664.                                 err = e.ToString();
  665.                                 put(err + "\n");
  666.                             }
  667.                             catch (System.OverflowException e)
  668.                             {
  669.                                 string err;
  670.                                 err = e.ToString();
  671.                                 put(err + "\n");
  672.                             }
  673.                             pause4 = Enumerable.Repeat<string>("", pause4.Length).ToArray();
  674.                         }
  675.                         else if (Text == cm(4) + cm2(0))
  676.                         {
  677.                             put4("intに代入されている数値は、" + num + "です。\n");
  678.                         }
  679.                         else if (Text == cm(4) + cm2(1))
  680.                         {
  681.                             put4("doubleに代入されている数値は、" + num1 + "です。\n");
  682.                         }
  683.                         else if (Text == cm(1) + " " + cm2(0))
  684.                         {
  685.                             num = 0;
  686.                         }
  687.                         else if (Text == cm(1) + " " + cm2(1))
  688.                         {
  689.                             num1 = 0;
  690.                         }
  691.                         else if (Text == "modec method")
  692.                         {
  693.                             put("change mode method\n");
  694.                             put("back to nomal mode 'modec nomal()'\n");
  695.                             editmodec = true;
  696.                         }
  697.                         else
  698.                         {
  699.                             put(
  700.                                 "error : '" + Text + "'" + "は、\n"
  701.                                 + "実行可能なファイル又は、\n"
  702.                                 + "コマンドとして認識、定義されていません。\n");
  703.                         }
  704.                     }
  705.                 }
  706.             }
  707.             else if (editmodec)
  708.             {
  709.                 if (Text == "modec nomal()")
  710.                 {
  711.                     editmodec = false;
  712.                     put("\n");
  713.                 }
  714.                 else
  715.                 {
  716.                     put("error : There is no method called '" + Text + "'.\n");
  717.                 }
  718.             }          
  719.         }
  720.  
  721.  
  722.  
  723.         public String cm(int e)
  724.         {
  725.             return Command[e];
  726.         }
  727.  
  728.         public String cm2(int e)
  729.         {
  730.             return Type[e];
  731.         }
  732.  
  733.         public String cm1(int e)
  734.         {
  735.             return CpCommand[e];
  736.         }
  737.  
  738.         public bool rexs(String str)
  739.         {
  740.             return System.Text.RegularExpressions.Regex.IsMatch(Text, @"^(str)");
  741.         }
  742.  
  743.         public bool rexf(String str)
  744.         {
  745.             return System.Text.RegularExpressions.Regex.IsMatch(Text, @"$(str)");
  746.         }
  747.  
  748.  
  749.         private void textBox4_TextChanged(object sender, EventArgs e)
  750.         {
  751.  
  752.         }
  753.  
  754.         private void Form1_Load(object sender, EventArgs e)
  755.         {
  756.             nn();
  757.         }
  758.  
  759.         private void checkBox1_CheckedChanged(object sender, EventArgs e)
  760.         {
  761.             textBox1.ForeColor = System.Drawing.Color.AliceBlue;
  762.             textBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
  763.         }
  764.  
  765.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  766.         {
  767.             int seleItem = comboBox1.SelectedIndex;
  768.  
  769.             if (seleItem == 0)
  770.             {
  771.                 textBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
  772.                 textBox1.ForeColor = System.Drawing.Color.AliceBlue;
  773.                 textBox3.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
  774.                 textBox3.ForeColor = System.Drawing.Color.AliceBlue;
  775.             }
  776.             else if (seleItem == 1)
  777.             {
  778.                 textBox1.BackColor = System.Drawing.SystemColors.InactiveCaption;
  779.                 textBox1.ForeColor = System.Drawing.Color.Black;
  780.                 textBox3.BackColor = System.Drawing.SystemColors.InactiveCaption;
  781.                 textBox3.ForeColor = System.Drawing.Color.Black;
  782.             }
  783.         }
  784.     }
  785.    //function
  786. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement