Пример #1
0
 /// <summary>
 /// 序列化对象
 /// </summary>
 /// <param name="file">保存文件</param>
 /// <param name="rr">对象</param>
 public static void Serialize(string file, TestCase rr)
 {
     Stream stream = File.Open(file, FileMode.Create);
     BinaryFormatter formatter = new BinaryFormatter();
     formatter.Serialize(stream, rr);
     stream.Close();
 }
Пример #2
0
 public static void Serialize(TestCase rr)
 {
     Serialize(rr.ExeDir + "\\default.tccfg", rr);
 }
Пример #3
0
        private void toolStripButtonStart_Click(object sender, EventArgs e)
        {
            if(!File.Exists(toolStripTextBoxTclInterp.Text))
            {
                MessageBox.Show("解释器文件不存在,请检查解释器路径。","解释器不存在", MessageBoxButtons.OK);
                return;
            }

            int port = 0;
            if (!int.TryParse(toolStripTextBoxAgentPort.Text, out port))
            {
                MessageBox.Show("端口错误,请输入有效端口。", "端口错误", MessageBoxButtons.OK);
                return;

            }

            socket = new TestCase(Properties.Resources.Socket, toolStripTextBoxTclInterp.Text);
            socket.Run();
            socket.WriteToTcl(toolStripTextBoxAgentPort.Text);

            timerOutput.Start();
            toolStripButtonStart.Enabled = false;
            toolStripButtonStop.Enabled = true;
        }