예제 #1
0
파일: RCM.cs 프로젝트: ff11mail/ff11rcm
 private void button2_Click(object sender, EventArgs e)
 {
     if (button2.Text == "スタート")
     {
         System.Diagnostics.Process p;
         p = (System.Diagnostics.Process)WindowerPids[comboBox3.SelectedItem];
         w1 = new XIWindower(p.Id);
         button2.Text = "停止";
         comboBox3.Enabled = false;
         groupBox1.Enabled = false;
         radioButton1.Enabled = false;
         radioButton2.Enabled = false;
         textBoxAddress.Enabled = false;
         textBoxPassword.Enabled = false;
         numericUpDown1.Enabled = false;
         if (radioButton1.Checked)
         {
             serv = new RCMNetServer(this);
             serv.Start();
             thread1 = new Thread(new ThreadStart(comNetThread));
             thread1.IsBackground = true;
             thread1.Start();
         }
         else
         {
             client = new RCMNetClient(this);
             if (!client.Start())
             {
                 MessageBox.Show(this, "接続に失敗しました。");
                 enableNetGui();
             }
             else
             {
                 thread1 = new Thread(new ThreadStart(comNetThread));
                 thread1.IsBackground = true;
                 thread1.Start();
             }
         }
     }
     else
     {
         if (serv != null)
         {
             serv.Stop();
             serv = null;
         }
         else
         {
             client.Stop();
             client = null;
         }
         if (thread1 != null && thread1.IsAlive)
             thread1.Abort();
         thread1 = null;
         button2.Text = "スタート";
         radioButton1.Enabled = true;
         radioButton2.Enabled = true;
         textBoxAddress.Enabled = true;
         textBoxPassword.Enabled = true;
         numericUpDown1.Enabled = true;
         groupBox1.Enabled = true;
     }
 }
예제 #2
0
파일: RCMNet.cs 프로젝트: ff11mail/ff11rcm
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="c">TCPClient</param>
 /// <param name="s">Server</param>
 /// <param name="r">RCM</param>
 public RCMNetSession(TcpClient c, RCMNetServer s, RCM r)
 {
     isReady = false;
     serv = s;
     client = c;
     ns = client.GetStream();
     rcm = r;
     challenge = SendChallenge(); // C & R 認証
 }