public void EnterRoom(ref RichTextBox t, int mode, string username, string password, int rid, int rpassword, ref WatchStream w, int privacy) { textb = t; this.w = w; if (mode == 1) { byte[] bytes = Socket.ApplyConnection(username, password, 1, rid, rpassword); string info = Encoding.ASCII.GetString(bytes); if (info == "1") { w.Show(); StartRecieving(ref t); isCapturing = true; MessageBox.Show("Successfully Entered Room"); Sending = new Thread(SendText); Sending.Start(); sending = false; } else { w.Close(); w.d.Show(); isCapturing = false; MessageBox.Show("Incorrect Room ID or Password"); } } else { byte[] roomInfo = Socket.ApplyConnection(username, password, 0, privacy); string info = Encoding.ASCII.GetString(roomInfo); string[] data = info.Split(','); StartRecieving(ref t); } }
public void JoinPublicRoom(ref RichTextBox t, int mode, string username, string password, ref WatchStream w) { textb = t; this.w = w; byte[] bytes = Socket.ApplyConnection(username, password, mode); string info = Encoding.ASCII.GetString(bytes); if (info == "1") { isCapturing = true; w.Show(); StartRecieving(ref t); MessageBox.Show("Successfully Entered Room"); Sending = new Thread(SendText); Sending.Start(); sending = false; } else { w.Close(); w.d.Show(); MessageBox.Show("Cannot Find Public Room right now, try again later"); } }
private void button1_Click(object sender, EventArgs e) { if (!Program.sr.isCapturing) { this.Hide(); WatchStream w = new WatchStream(0, 0, this, 2); } }
void UpdateUI(WatchStream t) { if (t.InvokeRequired) { var d = new UpdateGUIdel3(UpdateUI); t.Invoke(d, new object[] { t }); } else { t.d.Show(); t.Close(); } }
public WatchStream(int RID, int Password, Dashboard_ d, int Mode) { InitializeComponent(); this.d = d; WatchStream Ref = this; FormClosing += w_FormClosing; if (Mode == 0) { Program.sr.EnterRoom(ref richTextBox1, 1, Program.User.SharesUsername, Program.User.SharesPassword, RID, Password, ref Ref, 0); } else { Program.sr.JoinPublicRoom(ref richTextBox1, 2, Program.User.SharesUsername, Program.User.SharesPassword, ref Ref); } }