Example #1
0
 private void LoadCmdBtn_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog op = new OpenFileDialog()) {
         op.Title  = "Chose CMD";
         op.Filter = "CMD files (*.cmd)|*.cmd|All files (*.*)|*.*";
         if (op.ShowDialog() == DialogResult.OK)
         {
             var fileStream = op.OpenFile();
             CmdTb.Clear();
             DataTb.Clear();
             using (StreamReader reader = new StreamReader(fileStream))
             {
                 string line;
                 cmd_array.Clear();
                 int i = 0;
                 while ((line = reader.ReadLine()) != null)
                 {
                     string[] data_array = line.Split(new char[] { ' ' });
                     cmd_array.Add(data_array);
                     CmdTb.AppendText("[" + i.ToString() + "] " + line + "\r\n");
                     i++;
                 }
             }
         }
     }
 }
Example #2
0
 private void ClearBtn_Click(object sender, EventArgs e)
 {
     CmdTb.Clear();
     DataTb.Clear();
 }