예제 #1
0
파일: Form1.cs 프로젝트: virqin/MumbleSharp
        private void btnConnect_Click(object sender, EventArgs e)
        {
            string name = textBoxUserName.Text;
            string pass = textBoxUserPassword.Text;
            int    port;
            string addr;

            if (textBoxServer.Text.Contains(':'))
            {
                var server = textBoxServer.Text.Split(':');
                addr = server[0];
                port = Int32.Parse(server[1]);
            }
            else
            {
                addr = textBoxServer.Text;
                port = 64738;
            }

            if (connection != null)
            {
                connection.Close();
                connection = null;
                protocol.Close();
                tvUsers.Nodes.Clear();
            }

            connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses(addr).First(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork), port), protocol);
            connection.Connect(name, pass, new string[0], addr);

            while (connection.Protocol.LocalUser == null)
            {
                connection.Process();
            }
        }
예제 #2
0
 private static void UpdateLoop(MumbleConnection connection)
 {
     while (connection.State != ConnectionStates.Disconnected)
     {
         connection.Process();
     }
 }
예제 #3
0
파일: Form1.cs 프로젝트: virqin/MumbleSharp
 private void mumbleUpdater_Tick(object sender, EventArgs e)
 {
     if (connection != null)
     {
         connection.Process();
     }
 }
예제 #4
0
 private static void UpdateLoop(MumbleConnection connection)
 {
     while (connection.State != ConnectionStates.Disconnected)
     {
         connection.Process();
     }
 }
예제 #5
0
 private void mumbleUpdater_Tick(object sender, EventArgs e)
 {
     if (connection != null)
     {
         if (connection.Process())
         {
             Thread.Yield();
         }
         else
         {
             Thread.Sleep(1);
         }
     }
 }
예제 #6
0
 private static void UpdateLoop(MumbleConnection connection, out Exception exception)
 {
     exception = null;
     try
     {
         while (connection.State != ConnectionStates.Disconnected)
         {
             if (connection.Process())
             {
                 Thread.Yield();
             }
             else
             {
                 Thread.Sleep(1);
             }
         }
     } catch (Exception ex)
     {
         exception = ex;
     }
 }
예제 #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            string name = textBox1.Text;
            string pass = "";
            int    port = 64738;
            string addr = textBox2.Text;

            if (connection != null)
            {
                connection.Close();
                connection = null;
                protocol.Close();
                tvUsers.Nodes.Clear();
            }

            connection = new MumbleConnection(new IPEndPoint(Dns.GetHostAddresses(addr).First(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork), port), protocol);
            connection.Connect(name, pass, new string[0], addr);

            while (connection.Protocol.LocalUser == null)
            {
                connection.Process();
            }
        }
예제 #8
0
        public Form1()
        {
            InitializeComponent();

            connection = new MumbleConnection("mumble.placeholder-software.co.uk", 64738);
            protocol   = connection.Connect <BasicMumbleProtocol>("testuser", "", "mumble.placeholder-software.co.uk");
            protocol.MessageRecieved += Protocol_MessageRecieved;
            while (connection.Protocol.LocalUser == null)
            {
                connection.Process();
            }

            Dictionary <uint, ChannelTree> channels = new Dictionary <uint, ChannelTree>();

            foreach (var channel in protocol.Channels)
            {
                channels.Add(channel.Id, new ChannelTree(channel));
            }
            foreach (var channelTree in channels.Values)
            {
                if (channelTree.Channel.Id != 0)
                {
                    channelTree.Parent = channels[channelTree.Channel.Parent];
                    channelTree.Parent.Children.Add(channelTree);
                }
            }
            foreach (var user in protocol.Users)
            {
                channels[user.Channel.Id].Users.Add(user);
            }
            ChannelTree RootChannel = channels[0];

            tvUsers.Nodes.Add(MakeNode(RootChannel));
            tvUsers.ExpandAll();

            //MessageBox.Show("Connected as " + connection.Protocol.LocalUser.Id);
        }
예제 #9
0
 private static void UpdateLoop(MumbleConnection connection)
 {
     while (true)
         connection.Process();
 }